Author: toad
Date: 2009-01-22 23:52:00 +0000 (Thu, 22 Jan 2009)
New Revision: 25229

Modified:
   branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
Log:
Never pad. We don't know what the algo was. Throw an error if the last data 
block is not the standard size and ignoreLastDataBlock wasn't set - this can 
happen if the last block of a nonfinal segment is the wrong size, or in future 
if it's using new metadata.


Modified: 
branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSegment.java 
2009-01-22 23:46:40 UTC (rev 25228)
+++ branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSegment.java 
2009-01-22 23:52:00 UTC (rev 25229)
@@ -409,17 +409,10 @@
                                                lastBlock.removeFrom(container);
                                        dataBuckets[dataBuckets.length-1].data 
= null;
                                } else if(lastBlock.size() != 
CHKBlock.DATA_LENGTH) {
-                                       try {
-                                               
dataBuckets[dataBuckets.length-1].data =
-                                                       
BucketTools.pad(lastBlock, CHKBlock.DATA_LENGTH, 
context.persistentBucketFactory, (int) lastBlock.size());
-                                               lastBlock.free();
-                                               if(persistent) {
-                                                       
lastBlock.removeFrom(container);
-                                                       
dataBuckets[dataBuckets.length-1].storeTo(container);
-                                               }
-                                       } catch (IOException e) {
-                                               fail(new 
FetchException(FetchException.BUCKET_ERROR, e), container, context, true);
-                                       }
+                                       // All new inserts will have the last 
block padded. If it was an old insert, ignoreLastDataBlock
+                                       // would be set. Another way we can get 
here is if the last data block of a segment other than
+                                       // the last data block is too short.
+                                       fail(new 
FetchException(FetchException.INVALID_METADATA, "Last data block is not the 
standard size"), container, context, true);
                                }
                        }
                        if(codec == null)

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to