directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r945062 - in /directory/shared/trunk: i18n/src/main/java/org/apache/directory/shared/i18n/ i18n/src/main/resources/org/apache/directory/shared/i18n/ ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/
Date Mon, 17 May 2010 10:19:50 GMT
Author: felixk
Date: Mon May 17 10:19:50 2010
New Revision: 945062

URL: http://svn.apache.org/viewvc?rev=945062&view=rev
Log:
Respect return value of mkdirs and throw specific exception

Modified:
    directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java
    directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
    directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/DefaultSchemaLdifExtractor.java

Modified: directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java?rev=945062&r1=945061&r2=945062&view=diff
==============================================================================
--- directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java (original)
+++ directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java Mon
May 17 10:19:50 2010
@@ -646,6 +646,9 @@ public class I18n
 	public static final String ERR_08005 = "ERR_08005";
 	public static final String ERR_08006 = "ERR_08006";
 	
+	// ldap-schema
+	public static final String ERR_09001_DIRECTORY_CREATION_FAILED = "ERR_09001_DIRECTORY_CREATION_FAILED";
+
 	// ldap-schema-loader
 	public static final String ERR_10001 = "ERR_10001";
 	public static final String ERR_10002 = "ERR_10002";

Modified: directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
URL: http://svn.apache.org/viewvc/directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties?rev=945062&r1=945061&r2=945062&view=diff
==============================================================================
--- directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
(original)
+++ directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
Mon May 17 10:19:50 2010
@@ -603,6 +603,9 @@ ERR_08004=Exception occurred while parsi
 ERR_08005=Should not be hitting root without schema/schema pattern.
 ERR_08006=parent cannot be null
 
+# ldap-schema
+ERR_09001_DIRECTORY_CREATION_FAILED=The directory {0} could not be created
+
 # ldap-schema-loader
 ERR_10001=The attribute must be binary
 ERR_10002=Failed to access attribute bytes.

Modified: directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/DefaultSchemaLdifExtractor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/DefaultSchemaLdifExtractor.java?rev=945062&r1=945061&r2=945062&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/DefaultSchemaLdifExtractor.java
(original)
+++ directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/DefaultSchemaLdifExtractor.java
Mon May 17 10:19:50 2010
@@ -127,14 +127,22 @@ public class DefaultSchemaLdifExtractor 
     {
         if ( !outputDirectory.exists() )
         {
-            outputDirectory.mkdir();
+            if ( !outputDirectory.mkdirs() )
+            {
+                throw new IOException( I18n.err( I18n.ERR_09001_DIRECTORY_CREATION_FAILED,
outputDirectory
+                    .getAbsolutePath() ) );
+            }
         }
 
         File schemaDirectory = new File( outputDirectory, SCHEMA_SUBDIR );
 
         if ( !schemaDirectory.exists() )
         {
-            schemaDirectory.mkdir();
+            if ( !schemaDirectory.mkdirs() )
+            {
+                throw new IOException( I18n.err( I18n.ERR_09001_DIRECTORY_CREATION_FAILED,
schemaDirectory
+                    .getAbsolutePath() ) );
+            }
         }
         else if ( !overwrite )
         {
@@ -186,7 +194,11 @@ public class DefaultSchemaLdifExtractor 
 
         if ( !destination.getParentFile().exists() )
         {
-            destination.getParentFile().mkdirs();
+            if ( !destination.getParentFile().mkdirs() )
+            {
+                throw new IOException( I18n.err( I18n.ERR_09001_DIRECTORY_CREATION_FAILED,
destination.getParentFile()
+                    .getAbsolutePath() ) );
+            }
         }
 
         if ( !source.getParentFile().exists() )
@@ -399,7 +411,11 @@ public class DefaultSchemaLdifExtractor 
 
             if ( !destination.getParentFile().exists() )
             {
-                destination.getParentFile().mkdirs();
+                if ( !destination.getParentFile().mkdirs() )
+                {
+                    throw new IOException( I18n.err( I18n.ERR_09001_DIRECTORY_CREATION_FAILED,
destination
+                        .getParentFile().getAbsolutePath() ) );
+                }
             }
 
             FileOutputStream out = new FileOutputStream( destination );



Mime
View raw message