tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject [tomcat] 02/02: Fix SpotBugs warning
Date Fri, 03 May 2019 17:43:53 GMT
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 <markt@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


Mime
View raw message