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

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

commit d3ab7c671ccb8f24a6cc33a21c2930c19dda4ecc
Author: Felix Schumacher <[email protected]>
AuthorDate: Sat Aug 3 16:01:46 2019 +0200

    Check for result of mkdir
---
 .../src/main/java/org/apache/jorphan/util/JOrphanUtils.java       | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/src/jorphan/src/main/java/org/apache/jorphan/util/JOrphanUtils.java 
b/src/jorphan/src/main/java/org/apache/jorphan/util/JOrphanUtils.java
index 18d7190..e700bed 100644
--- a/src/jorphan/src/main/java/org/apache/jorphan/util/JOrphanUtils.java
+++ b/src/jorphan/src/main/java/org/apache/jorphan/util/JOrphanUtils.java
@@ -665,10 +665,12 @@ public final class JOrphanUtils {
                     if(deleteFolderIfExists) {
                         try {
                             FileUtils.deleteDirectory(folder);
-                            folder.mkdir();
                         } catch(IOException ex) {
-                            throw new IllegalArgumentException("Cannot write 
to '"
-                                    +folder.getAbsolutePath()+"' as folder is 
not empty and cleanup failed with error:"+ex.getMessage(), ex);
+                            throw new IllegalArgumentException("Cannot write 
to '" + folder.getAbsolutePath()
+                                    + "' as folder is not empty and cleanup 
failed with error:" + ex.getMessage(), ex);
+                        }
+                        if (!folder.mkdir()) {
+                            throw new IllegalArgumentException("Cannot create 
folder " + folder.getAbsolutePath());
                         }
                     } else {
                         throw new IllegalArgumentException("Cannot write to '"

Reply via email to