Author: toad
Date: 2006-07-26 02:10:41 +0000 (Wed, 26 Jul 2006)
New Revision: 9767

Modified:
   trunk/freenet/src/freenet/client/async/SplitFileInserter.java
   trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java
   trunk/freenet/src/freenet/node/Version.java
Log:
903: Fix "Error: Failed to parse metadata: Unknown splitfile algorithm -1".

Modified: trunk/freenet/src/freenet/client/async/SplitFileInserter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileInserter.java       
2006-07-25 23:56:42 UTC (rev 9766)
+++ trunk/freenet/src/freenet/client/async/SplitFileInserter.java       
2006-07-26 02:10:41 UTC (rev 9767)
@@ -132,10 +132,14 @@
                } catch (NumberFormatException e) {
                        throw new ResumeException("Corrupt CompressionCodec: 
"+e+" : "+ccodec);
                }
-               String scodec = fs.get("CompressionCodec");
-               if(scodec == null) throw new ResumeException("No compression 
codec");
+               String scodec = fs.get("SplitfileCodec");
+               if(scodec == null) throw new ResumeException("No splitfile 
codec");
                try {
-                       splitfileAlgorithm = Short.parseShort(scodec);
+                       // FIXME remove soon, backwards compat hack!
+                       short t = Short.parseShort(scodec);
+                       if(t == -1)
+                               t = 1;
+                       splitfileAlgorithm = t;
                } catch (NumberFormatException e) {
                        throw new ResumeException("Corrupt SplitfileCodec: 
"+e+" : "+scodec);
                }

Modified: trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java        
2006-07-25 23:56:42 UTC (rev 9766)
+++ trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java        
2006-07-26 02:10:41 UTC (rev 9767)
@@ -182,6 +182,7 @@
                        }
                        splitfileAlgo = FECCodec.getCodec(splitfileAlgorithm, 
dataBlockCount, checkBlocks.length);
                } else {
+                       encoded = false;
                        splitfileAlgo = FECCodec.getCodec(splitfileAlgorithm, 
dataBlockCount);
                        int checkBlocksCount = splitfileAlgo.countCheckBlocks();
                        this.checkURIs = new FreenetURI[checkBlocksCount];
@@ -250,7 +251,10 @@
                                Bucket data = checkBlocks[i];
                                if(data != null &&
                                                data instanceof 
SerializableToFieldSetBucket) {
-                                       block.put("Data", 
((SerializableToFieldSetBucket)data).toFieldSet());
+                                       SimpleFieldSet tmp = 
((SerializableToFieldSetBucket)data).toFieldSet();
+                                       if(tmp != null)
+                                               Logger.minor(this, "Could not 
serialize "+data+" - check block "+i+" of "+segNo);
+                                       block.put("Data", tmp);
                                } else if(encoded) {
                                        Logger.minor(this, "Could not save to 
disk (null or not serializable to fieldset): "+data);
                                        return null;

Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2006-07-25 23:56:42 UTC (rev 
9766)
+++ trunk/freenet/src/freenet/node/Version.java 2006-07-26 02:10:41 UTC (rev 
9767)
@@ -18,7 +18,7 @@
        public static final String protocolVersion = "1.0";

        /** The build number of the current revision */
-       private static final int buildNumber = 902;
+       private static final int buildNumber = 903;

        /** Oldest build of Fred we will talk to */
        private static final int oldLastGoodBuild = 870;


Reply via email to