You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/05/03 17:43:53 UTC

[tomcat] 02/02: Fix SpotBugs warning

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

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 151b4472f3b2ea7a7ea820dee6d4c617d3864a2a
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri May 3 18:41:30 2019 +0100

    Fix SpotBugs warning
---
 java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java b/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java
index 38c783e..3992162 100644
--- a/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java
+++ b/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java
@@ -392,7 +392,10 @@ public class DiskFileItem
                  * desired file.
                  */
                 if (file.exists()) {
-                    file.delete();
+                    if (!file.delete()) {
+                        throw new FileUploadException(
+                                "Cannot write uploaded file to disk!");
+                    }
                 }
                 if (!outputFile.renameTo(file)) {
                     BufferedInputStream in = null;


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org