Author: nextgens
Date: 2008-08-17 15:15:17 +0000 (Sun, 17 Aug 2008)
New Revision: 21967

Modified:
   trunk/freenet/src/freenet/support/io/LineReadingInputStream.java
Log:
logging in order to debug bug #2501

Modified: trunk/freenet/src/freenet/support/io/LineReadingInputStream.java
===================================================================
--- trunk/freenet/src/freenet/support/io/LineReadingInputStream.java    
2008-08-17 14:49:14 UTC (rev 21966)
+++ trunk/freenet/src/freenet/support/io/LineReadingInputStream.java    
2008-08-17 15:15:17 UTC (rev 21967)
@@ -3,6 +3,7 @@
  * http://www.gnu.org/ for further details of the GPL. */
 package freenet.support.io;

+import freenet.support.HexUtil;
 import java.io.FilterInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -43,7 +44,7 @@
                        // 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 "+new String(buf, 0, ctr, utf ? "UTF-8" : 
"ISO-8859-1"));
+                                       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) {
@@ -84,7 +85,7 @@
                                return new String(buf, 0, ctr, utf ? "UTF-8" : 
"ISO-8859-1");
                        }
                        if(ctr >= maxLength)
-                               throw new TooLongException("We reached 
maxLength="+maxLength+ " parsing "+new String(buf, 0, ctr, utf ? "UTF-8" : 
"ISO-8859-1"));
+                                       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(ctr >= buf.length) {
                                byte[] newBuf = new byte[Math.min(buf.length * 
2, maxLength)];
                                System.arraycopy(buf, 0, newBuf, 0, buf.length);


Reply via email to