Author: toad
Date: 2007-08-15 21:43:03 +0000 (Wed, 15 Aug 2007)
New Revision: 14714
Modified:
trunk/freenet/src/freenet/support/compress/GzipCompressor.java
Log:
comments, restore too big detection
Modified: trunk/freenet/src/freenet/support/compress/GzipCompressor.java
===================================================================
--- trunk/freenet/src/freenet/support/compress/GzipCompressor.java
2007-08-15 21:38:08 UTC (rev 14713)
+++ trunk/freenet/src/freenet/support/compress/GzipCompressor.java
2007-08-15 21:43:03 UTC (rev 14714)
@@ -67,7 +67,10 @@
byte[] buffer = new byte[4096];
while(true) {
int l = (int) Math.min(buffer.length, maxLength -
written);
- int x = gis.read(buffer, 0, l);
+ // We can over-read to determine whether we have
over-read.
+ // We enforce maximum size this way.
+ // FIXME there is probably a better way to do this!
+ int x = gis.read(buffer, 0, buffer.length);
if(l < x) {
Logger.normal(this, "l="+l+", x="+x+",
written="+written+", maxLength="+maxLength+" throwing a
CompressionOutputSizeException");
if(maxCheckSizeBytes > 0) {