Author: toad
Date: 2007-02-22 02:37:18 +0000 (Thu, 22 Feb 2007)
New Revision: 11898

Modified:
   trunk/freenet/src/freenet/client/async/SplitFileFetcher.java
   trunk/freenet/src/freenet/support/compress/GzipCompressor.java
Log:
Detect too big splitfile *before* fetching it.

Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcher.java        
2007-02-22 02:23:06 UTC (rev 11897)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcher.java        
2007-02-22 02:37:18 UTC (rev 11898)
@@ -89,6 +89,9 @@
                        finalLength = overrideLength;
                }

+               if(overrideLength > 0 && newCtx.maxOutputLength > 0 && 
overrideLength > newCtx.maxOutputLength)
+                       throw new FetchException(FetchException.TOO_BIG, 
overrideLength, false /* FIXME should be true but then need to ensure it is 
false if we are in a MultiLevel etc */, clientMetadata.getMIMEType());
+               
                if(splitfileType == Metadata.SPLITFILE_NONREDUNDANT) {
                        // Don't need to do much - just fetch everything and 
piece it together.
                        blocksPerSegment = -1;

Modified: trunk/freenet/src/freenet/support/compress/GzipCompressor.java
===================================================================
--- trunk/freenet/src/freenet/support/compress/GzipCompressor.java      
2007-02-22 02:23:06 UTC (rev 11897)
+++ trunk/freenet/src/freenet/support/compress/GzipCompressor.java      
2007-02-22 02:37:18 UTC (rev 11898)
@@ -67,7 +67,7 @@
                        int l = (int) Math.min(buffer.length, maxLength - 
written);
                        int x = gis.read(buffer, 0, 4096);
                        if(l < x) {
-                               Logger.error(this, "l="+l+", x="+x+", 
written="+written+", maxLength="+maxLength+" throwing a 
CompressionOutputSizeException");
+                               Logger.normal(this, "l="+l+", x="+x+", 
written="+written+", maxLength="+maxLength+" throwing a 
CompressionOutputSizeException");
                                if(maxCheckSizeBytes > 0) {
                                        written += x;
                                        while(true) {


Reply via email to