Author: markt
Date: Fri Sep 15 17:01:42 2017
New Revision: 1808469

URL: http://svn.apache.org/viewvc?rev=1808469&view=rev
Log:
More low-hanging fruit from FindBugs

Modified:
    tomcat/trunk/test/org/apache/juli/TestFileHandler.java

Modified: tomcat/trunk/test/org/apache/juli/TestFileHandler.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/juli/TestFileHandler.java?rev=1808469&r1=1808468&r2=1808469&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/juli/TestFileHandler.java (original)
+++ tomcat/trunk/test/org/apache/juli/TestFileHandler.java Fri Sep 15 17:01:42 
2017
@@ -29,6 +29,7 @@ import static org.junit.Assert.assertTru
 import static org.junit.Assert.fail;
 
 import org.junit.After;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -59,8 +60,9 @@ public class TestFileHandler {
 
         String date = 
LocalDateTime.now().minusDays(3).toString().replaceAll(":", "-");
         File file = new File(logsDir, PREFIX_1 + date + SUFIX_1);
-        file.createNewFile();
-
+        if (!file.createNewFile()) {
+            Assert.fail("Unable to create " + file.getAbsolutePath());
+        }
     }
 
     @After
@@ -118,7 +120,9 @@ public class TestFileHandler {
         for (int i = 0; i < amount; i++) {
             String date = LocalDate.now().minusDays(i + 
1).toString().substring(0, 10);
             File file = new File(dir, prefix + date + sufix);
-            file.createNewFile();
+            if (!file.createNewFile()) {
+                Assert.fail("Unable to create " + file.getAbsolutePath());
+            }
         }
     }
 }



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

Reply via email to