Author: toad
Date: 2007-05-02 16:42:55 +0000 (Wed, 02 May 2007)
New Revision: 13102

Modified:
   trunk/freenet/src/freenet/client/async/SingleFileFetcher.java
Log:
If extract returns null it will call onFailure first.

Modified: trunk/freenet/src/freenet/client/async/SingleFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SingleFileFetcher.java       
2007-05-02 16:21:02 UTC (rev 13101)
+++ trunk/freenet/src/freenet/client/async/SingleFileFetcher.java       
2007-05-02 16:42:55 UTC (rev 13102)
@@ -117,11 +117,15 @@
        public void onSuccess(ClientKeyBlock block, boolean fromStore, int 
token) {
                parent.completedBlock(fromStore);
                // Extract data
+               
+               if(block == null) {
+                       Logger.error(this, "block is null! 
fromStore="+fromStore+", token="+token, new Exception("error"));
+                       return;
+               }
                Bucket data = extract(block);
                if(data == null) {
-                       Logger.error(this, "onSuccess(null, "+fromStore+", 
"+token+")", new Exception("error"));
-                       onFailure(new 
FetchException(FetchException.INTERNAL_ERROR, "onSuccess(null) in "+this));
-                       return; // failed
+                       // Already failed: if extract returns null it will call 
onFailure first.
+                       return;
                }
                if(logMINOR)
                        Logger.minor(this, "Block "+(block.isMetadata() ? "is 
metadata" : "is not metadata")+" on "+this);


Reply via email to