This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch wicket-8.x
in repository https://gitbox.apache.org/repos/asf/wicket.git


The following commit(s) were added to refs/heads/wicket-8.x by this push:
     new cd7b54e  WICKET-6630 Delete (temp) file before writing to it
cd7b54e is described below

commit cd7b54e7aad062a18fb9cd7723668e178f28e1cb
Author: Martin Tzvetanov Grigorov <[email protected]>
AuthorDate: Thu Jan 17 14:22:41 2019 +0200

    WICKET-6630 Delete (temp) file before writing to it
    
    Use wicket-util Files to remove the file. It checks whether it is an 
existing file and retries on error
---
 .../java/org/apache/wicket/markup/html/form/upload/FileUpload.java   | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java
index 9718e30..b097830 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java
@@ -231,10 +231,7 @@ public class FileUpload implements IClusterable
         */
        public void writeTo(final File file) throws Exception
        {
-               if (file.isFile() && file.exists())
-               {                       
-                       file.delete();
-               }
+               Files.remove(file);
                item.write(file);
        }
 

Reply via email to