Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1811)

Unified Diff: base/android/java/src/org/chromium/base/CommandLine.java

Issue 2675713004: Increase the maximum Java command line size (Closed)
Patch Set: Merge branch 'master' into command_line Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/java/src/org/chromium/base/CommandLine.java
diff --git a/base/android/java/src/org/chromium/base/CommandLine.java b/base/android/java/src/org/chromium/base/CommandLine.java
index efef22a871fec06bf20fae8b9c3e3389046445c0..b6246f3f21030608b8525b4e22566889c939235a 100644
--- a/base/android/java/src/org/chromium/base/CommandLine.java
+++ b/base/android/java/src/org/chromium/base/CommandLine.java
@@ -134,8 +134,8 @@ public abstract class CommandLine {
* @param file The fully qualified command line file.
*/
public static void initFromFile(String file) {
- // Arbitrary clamp of 8k on the amount of file we read in.
- char[] buffer = readUtf8FileFully(file, 8 * 1024);
+ // Arbitrary clamp of 16k on the amount of file we read in.
+ char[] buffer = readUtf8FileFullyCrashIfTooBig(file, 16 * 1024);
init(buffer == null ? null : tokenizeQuotedAruments(buffer));
}
@@ -238,10 +238,10 @@ public abstract class CommandLine {
/**
* @param fileName the file to read in.
* @param sizeLimit cap on the file size.
- * @return Array of chars read from the file, or null if the file cannot be read
- * or if its length exceeds |sizeLimit|.
+ * @return Array of chars read from the file, or null if the file cannot be read.
+ * @throws RuntimeException if the file size exceeds |sizeLimit|.
*/
- private static char[] readUtf8FileFully(String fileName, int sizeLimit) {
+ private static char[] readUtf8FileFullyCrashIfTooBig(String fileName, int sizeLimit) {
Reader reader = null;
File f = new File(fileName);
long fileLength = f.length();
@@ -251,9 +251,8 @@ public abstract class CommandLine {
}
if (fileLength > sizeLimit) {
- Log.w(TAG, "File " + fileName + " length " + fileLength + " exceeds limit "
- + sizeLimit);
- return null;
+ throw new RuntimeException(
+ "File " + fileName + " length " + fileLength + " exceeds limit " + sizeLimit);
}
try {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698