Author: toad
Date: 2007-03-29 19:54:59 +0000 (Thu, 29 Mar 2007)
New Revision: 12423

Modified:
   trunk/freenet/src/freenet/node/fcp/ClientGetMessage.java
Log:
Creating the file on the ClientGet is only to check whether we can

Modified: trunk/freenet/src/freenet/node/fcp/ClientGetMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientGetMessage.java    2007-03-29 
19:24:30 UTC (rev 12422)
+++ trunk/freenet/src/freenet/node/fcp/ClientGetMessage.java    2007-03-29 
19:54:59 UTC (rev 12423)
@@ -108,11 +108,14 @@
                        tempFile = new File(tempFilename);
                        
if(!diskFile.getAbsoluteFile().getParentFile().equals(tempFile.getAbsoluteFile().getParentFile()))
                                throw new 
MessageInvalidException(ProtocolErrorMessage.FILENAME_AND_TEMP_FILENAME_MUST_BE_IN_SAME_DIR,
 null, identifier, global);
+                       if(tempFile.exists())
+                               throw new 
MessageInvalidException(ProtocolErrorMessage.DISK_TARGET_EXISTS, "Temp file 
exists", identifier, global);
                        if(diskFile.exists())
                                throw new 
MessageInvalidException(ProtocolErrorMessage.DISK_TARGET_EXISTS, null, 
identifier, global);
                        try {
                                if(!(tempFile.createNewFile() || 
(tempFile.exists() && tempFile.canRead() && tempFile.canWrite())))
                                        throw new 
MessageInvalidException(ProtocolErrorMessage.COULD_NOT_CREATE_FILE, "Could not 
create temp file "+tempFile, identifier, global);
+                               tempFile.delete();
                        } catch (IOException e) {
                                throw new 
MessageInvalidException(ProtocolErrorMessage.COULD_NOT_CREATE_FILE, 
e.getMessage(), identifier, global);
                        }


Reply via email to