Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Commit 11f682e

Browse files
committed
Resolve bug #185
1 parent fbade79 commit 11f682e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/main/java/com/searchcode/app/util/Helpers.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,15 @@ public List<String> readFileLinesGuessEncoding(String filePath, int maxFileLineD
149149
try {
150150
bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(filePath), this.guessCharset(new File(filePath))));
151151

152-
char[] chars = new char[8192];
152+
char[] chars = new char[MAX_FILE_LENGTH_READ];
153153
for (int len; (len = bufferedReader.read(chars)) > 0;) {
154154
stringBuilder.append(String.copyValueOf(chars).trim());
155155

156156
if (stringBuilder.length() >= this.MAX_FILE_LENGTH_READ) {
157157
break;
158158
}
159159
}
160+
160161
}
161162
finally {
162163
IOUtils.closeQuietly(bufferedReader);

src/test/java/com/searchcode/app/util/HelpersTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void testReadFileLinesIssue168() throws IOException {
4242
}
4343
}
4444

45-
this.helpers.MAX_FILE_LENGTH_READ = 100;
45+
this.helpers.MAX_FILE_LENGTH_READ = 8192;
4646
List<String> result = this.helpers.readFileLinesGuessEncoding(tempDir + "/no_newlines", 10);
4747
assertThat(result.size()).isEqualTo(1);
4848
assertThat(result.get(0).length()).isEqualTo(8192);

0 commit comments

Comments
 (0)