Author: toad
Date: 2009-02-14 12:29:55 +0000 (Sat, 14 Feb 2009)
New Revision: 25644

Modified:
   branches/db4o/freenet/src/freenet/client/FECJob.java
Log:
Fix some bugs related to getCodec()


Modified: branches/db4o/freenet/src/freenet/client/FECJob.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/FECJob.java        2009-02-14 
12:25:26 UTC (rev 25643)
+++ branches/db4o/freenet/src/freenet/client/FECJob.java        2009-02-14 
12:29:55 UTC (rev 25644)
@@ -18,7 +18,7 @@
 public class FECJob {
        
        private transient FECCodec codec;
-       private short fecAlgo;
+       private final short fecAlgo;
        final Bucket[] dataBlocks, checkBlocks;
        final SplitfileBlock[] dataBlockStatus, checkBlockStatus;
        final BucketFactory bucketFactory;
@@ -77,6 +77,7 @@
        public FECJob(FECCodec codec, FECQueue queue, Bucket[] dataBlocks, 
Bucket[] checkBlocks, int blockLength, BucketFactory bucketFactory, FECCallback 
callback, boolean isADecodingJob, short priority, boolean persistent) {
                this.hashCode = super.hashCode();
                this.codec = codec;
+               this.fecAlgo = codec.getAlgorithm();
                this.queue = queue;
                this.priority = priority;
                this.addedTime = System.currentTimeMillis();
@@ -93,7 +94,9 @@
 
        public FECCodec getCodec() {
                if(codec == null) {
-                       codec = FECCodec.getCodec(fecAlgo, dataBlocks.length);
+                       codec = FECCodec.getCodec(fecAlgo, dataBlocks.length, 
checkBlocks.length);
+                       if(codec == null)
+                               Logger.error(this, "No codec found for algo 
"+fecAlgo+" data blocks length "+dataBlocks.length+" check blocks length 
"+checkBlocks.length);
                }
                return codec;
        }

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

Reply via email to