Author: nextgens
Date: 2008-08-17 14:49:14 +0000 (Sun, 17 Aug 2008)
New Revision: 21966

Modified:
   trunk/freenet/src/freenet/node/fcp/FCPConnectionInputHandler.java
   trunk/freenet/src/freenet/support/io/LineReadingInputStream.java
   trunk/freenet/src/freenet/support/io/TooLongException.java
Log:
logging in order to debug #2501

Modified: trunk/freenet/src/freenet/node/fcp/FCPConnectionInputHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPConnectionInputHandler.java   
2008-08-17 13:30:46 UTC (rev 21965)
+++ trunk/freenet/src/freenet/node/fcp/FCPConnectionInputHandler.java   
2008-08-17 14:49:14 UTC (rev 21966)
@@ -14,6 +14,7 @@
 import freenet.support.SimpleFieldSet;
 import freenet.support.io.Closer;
 import freenet.support.io.LineReadingInputStream;
+import freenet.support.io.TooLongException;

 public class FCPConnectionInputHandler implements Runnable {

@@ -31,6 +32,8 @@
            freenet.support.Logger.OSThread.logPID(this);
                try {
                        realRun();
+               } catch (TooLongException e) {
+                       Logger.normal(this, "Caught"+e.getMessage(),e);
                } catch (IOException e) {
                        if(Logger.shouldLog(Logger.MINOR, this))
                                Logger.minor(this, "Caught "+e, e);

Modified: trunk/freenet/src/freenet/support/io/LineReadingInputStream.java
===================================================================
--- trunk/freenet/src/freenet/support/io/LineReadingInputStream.java    
2008-08-17 13:30:46 UTC (rev 21965)
+++ trunk/freenet/src/freenet/support/io/LineReadingInputStream.java    
2008-08-17 14:49:14 UTC (rev 21966)
@@ -43,7 +43,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();
+                                       throw new TooLongException("We reached 
maxLength="+maxLength+ " parsing "+new String(buf, 0, ctr, utf ? "UTF-8" : 
"ISO-8859-1"));
                                if(buf[ctr] == '\n') {
                                        String toReturn = "";
                                        if(ctr != 0) {
@@ -84,7 +84,7 @@
                                return new String(buf, 0, ctr, utf ? "UTF-8" : 
"ISO-8859-1");
                        }
                        if(ctr >= maxLength)
-                               throw new TooLongException();
+                               throw new TooLongException("We reached 
maxLength="+maxLength+ " parsing "+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);

Modified: trunk/freenet/src/freenet/support/io/TooLongException.java
===================================================================
--- trunk/freenet/src/freenet/support/io/TooLongException.java  2008-08-17 
13:30:46 UTC (rev 21965)
+++ trunk/freenet/src/freenet/support/io/TooLongException.java  2008-08-17 
14:49:14 UTC (rev 21966)
@@ -9,4 +9,7 @@
 public class TooLongException extends IOException {
        private static final long serialVersionUID = -1;

+       TooLongException(String s) {
+               super(s);
+       }
 }
\ No newline at end of file


Reply via email to