commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1697209 - /commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/JavaClass.java
Date Sun, 23 Aug 2015 16:09:31 GMT
Author: sebb
Date: Sun Aug 23 16:09:31 2015
New Revision: 1697209

URL: http://svn.apache.org/r1697209
Log:
FindBUgs: Check return of mkdirs()

Modified:
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/JavaClass.java

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/JavaClass.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/JavaClass.java?rev=1697209&r1=1697208&r2=1697209&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/JavaClass.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/JavaClass.java
Sun Aug 23 16:09:31 2015
@@ -233,7 +233,11 @@ public class JavaClass extends AccessFla
         String parent = file.getParent();
         if (parent != null) {
             File dir = new File(parent);
-            dir.mkdirs();
+            if (!dir.mkdirs()) { // either was not created or already existed
+                if (!dir.isDirectory()) {
+                    throw new IOException("Could not create the directory " + dir);
+                }
+            }
         }
         DataOutputStream dos = null;
         try {



Mime
View raw message