Author: nextgens
Date: 2008-08-17 16:10:23 +0000 (Sun, 17 Aug 2008)
New Revision: 21973
Modified:
trunk/freenet/src/freenet/support/io/LineReadingInputStream.java
Log:
bug #2501: Fix the first problem
Modified: trunk/freenet/src/freenet/support/io/LineReadingInputStream.java
===================================================================
--- trunk/freenet/src/freenet/support/io/LineReadingInputStream.java
2008-08-17 16:03:48 UTC (rev 21972)
+++ trunk/freenet/src/freenet/support/io/LineReadingInputStream.java
2008-08-17 16:10:23 UTC (rev 21973)
@@ -43,8 +43,6 @@
}
// REDFLAG this is definitely safe with the above
charsets, it may not be safe with some wierd ones.
for(; ctr < buf.length; ctr++) {
- if(ctr >= maxLength)
- throw new TooLongException("We reached
maxLength="+maxLength+ " parsing\n "+HexUtil.bytesToHex(buf, 0, ctr) + "\n" +
new String(buf, 0, ctr, utf ? "UTF-8" : "ISO-8859-1"));
if(buf[ctr] == '\n') {
String toReturn = "";
if(ctr != 0) {
@@ -55,6 +53,8 @@
skip(ctr + 1);
return toReturn;
}
+ if(ctr >= maxLength)
+ throw new TooLongException("We reached
maxLength="+maxLength+ " parsing\n "+HexUtil.bytesToHex(buf, 0, ctr) + "\n" +
new String(buf, 0, ctr, utf ? "UTF-8" : "ISO-8859-1"));
}
if(x > 0) {
byte[] newBuf = new byte[Math.min(buf.length *
2, maxLength)];