Author: toad
Date: 2005-11-25 18:49:34 +0000 (Fri, 25 Nov 2005)
New Revision: 7606

Modified:
   trunk/freenet/src/freenet/client/FetchException.java
   trunk/freenet/src/freenet/client/Segment.java
   trunk/freenet/src/freenet/client/StandardOnionFECCodec.java
   trunk/freenet/src/freenet/node/Version.java
   trunk/freenet/src/freenet/support/LimitedRangeIntByteArrayMap.java
Log:
225: (mandatory)
Fix a few ERRORs.
Make sure that Segment finishes even if it fails to decode.

Modified: trunk/freenet/src/freenet/client/FetchException.java
===================================================================
--- trunk/freenet/src/freenet/client/FetchException.java        2005-11-25 
18:36:39 UTC (rev 7605)
+++ trunk/freenet/src/freenet/client/FetchException.java        2005-11-25 
18:49:34 UTC (rev 7606)
@@ -39,11 +39,11 @@
                Logger.minor(this, "FetchException("+getMessage(mode)+"): 
"+e,e);
        }

-       public FetchException(int mode, IOException e) {
-               super(getMessage(INVALID_METADATA)+": "+e.getMessage());
+       public FetchException(int mode, Throwable t) {
+               super(getMessage(mode)+": "+t.getMessage());
                this.mode = mode;
-               initCause(e);
-               Logger.minor(this, "FetchException("+getMessage(mode)+"): 
"+e.getMessage(),e);
+               initCause(t);
+               Logger.minor(this, "FetchException("+getMessage(mode)+"): 
"+t.getMessage(),t);
        }

        public FetchException(int mode, String msg) {

Modified: trunk/freenet/src/freenet/client/Segment.java
===================================================================
--- trunk/freenet/src/freenet/client/Segment.java       2005-11-25 18:36:39 UTC 
(rev 7605)
+++ trunk/freenet/src/freenet/client/Segment.java       2005-11-25 18:49:34 UTC 
(rev 7606)
@@ -181,7 +181,14 @@
                parentFetcher.gotBlocks(this);
                if(succeeded.length >= minFetched)
                        // Not finished yet, need to decode
-                       successfulFetch();
+                       try {
+                               successfulFetch();
+                       } catch (Throwable t) {
+                               Logger.error(this, "Caught "+t+" decoding 
"+this);
+                               finished = true;
+                               failureException = new 
FetchException(FetchException.INTERNAL_ERROR, t);
+                               parentFetcher.segmentFinished(this);
+                       }
                else {
                        failureException = new 
SplitFetchException(failed.length, fatalErrors.length, succeeded.length, 
minFetched);
                        finished = true;

Modified: trunk/freenet/src/freenet/client/StandardOnionFECCodec.java
===================================================================
--- trunk/freenet/src/freenet/client/StandardOnionFECCodec.java 2005-11-25 
18:36:39 UTC (rev 7605)
+++ trunk/freenet/src/freenet/client/StandardOnionFECCodec.java 2005-11-25 
18:49:34 UTC (rev 7606)
@@ -142,7 +142,7 @@
                synchronized(runningDecodesSync) {
                        while(runningDecodes >= PARALLEL_DECODES) {
                                try {
-                                       wait();
+                                       runningDecodesSync.wait();
                                } catch (InterruptedException e) {
                                        // Ignore
                                }
@@ -292,7 +292,7 @@
                synchronized(runningDecodesSync) {
                        while(runningDecodes >= PARALLEL_DECODES) {
                                try {
-                                       wait();
+                                       runningDecodesSync.wait();
                                } catch (InterruptedException e) {
                                        // Ignore
                                }

Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2005-11-25 18:36:39 UTC (rev 
7605)
+++ trunk/freenet/src/freenet/node/Version.java 2005-11-25 18:49:34 UTC (rev 
7606)
@@ -20,10 +20,10 @@
        public static final String protocolVersion = "1.0";

        /** The build number of the current revision */
-       public static final int buildNumber = 224;
+       public static final int buildNumber = 225;

        /** Oldest build of Fred we will talk to */
-       public static final int lastGoodBuild = 221;
+       public static final int lastGoodBuild = 225;

        /** The highest reported build of fred */
        public static int highestSeenBuild = buildNumber;

Modified: trunk/freenet/src/freenet/support/LimitedRangeIntByteArrayMap.java
===================================================================
--- trunk/freenet/src/freenet/support/LimitedRangeIntByteArrayMap.java  
2005-11-25 18:36:39 UTC (rev 7605)
+++ trunk/freenet/src/freenet/support/LimitedRangeIntByteArrayMap.java  
2005-11-25 18:49:34 UTC (rev 7606)
@@ -61,7 +61,7 @@
         LimitedRangeIntByteArrayMapElement wrapper = 
(LimitedRangeIntByteArrayMapElement) contents.get(i);
         if(wrapper != null)
             return wrapper.createdTime;
-        else throw new IllegalArgumentException();
+        else return -1;
     }

     /**


Reply via email to