Author: toad
Date: 2007-03-29 19:24:30 +0000 (Thu, 29 Mar 2007)
New Revision: 12422

Modified:
   trunk/freenet/src/freenet/node/fcp/ClientGet.java
Log:
can't happen, caller guarantees that data == returnBucket

Modified: trunk/freenet/src/freenet/node/fcp/ClientGet.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientGet.java   2007-03-29 00:59:06 UTC 
(rev 12421)
+++ trunk/freenet/src/freenet/node/fcp/ClientGet.java   2007-03-29 19:24:30 UTC 
(rev 12422)
@@ -335,25 +335,17 @@
                                // Write to temp file, then rename over filename
                                FileOutputStream fos = null;
                                boolean closed = false;
-                               try {
+                                       // Caller guarantees that data == 
returnBucket
                                        if(data != returnBucket) {
-                                               fos = new 
FileOutputStream(tempFile);
-                                               BucketTools.copyTo(data, fos, 
data.size());
-                                               if(fos != null) {
-                                                       fos.close(); // must be 
closed before rename
-                                                       closed = true;
-                                               }
+                                               Logger.error(this, "Data != 
returnBucket for "+this);
+                                               onFailure(new 
FetchException(FetchException.INTERNAL_ERROR, "Data != returnBucket"), null);
+                                               return;
                                        }
                                        if(!tempFile.renameTo(targetFile)) {
                                                postFetchProtocolErrorMessage = 
new ProtocolErrorMessage(ProtocolErrorMessage.COULD_NOT_RENAME_FILE, false, 
null, identifier, global);
                                                // Don't delete temp file, user 
might want it.
                                        }
                                        returnBucket = new 
FileBucket(targetFile, false, true, false, false, false);
-                               } catch (FileNotFoundException e) {
-                                       postFetchProtocolErrorMessage = new 
ProtocolErrorMessage(ProtocolErrorMessage.COULD_NOT_WRITE_FILE, false, null, 
identifier, global);
-                               } catch (IOException e) {
-                                       postFetchProtocolErrorMessage = new 
ProtocolErrorMessage(ProtocolErrorMessage.COULD_NOT_WRITE_FILE, false, null, 
identifier, global);
-                               }
                                try {
                                        if((fos != null) && !closed)
                                                fos.close();


Reply via email to