You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by fe...@apache.org on 2011/10/02 10:23:39 UTC
svn commit: r1178145 - in /directory/apacheds/trunk:
core-annotations/src/main/java/org/apache/directory/server/core/factory/
core-api/src/main/java/org/apache/directory/server/core/
core/src/main/java/org/apache/directory/server/core/ i18n/src/main/ja...
Author: felixk
Date: Sun Oct 2 08:23:37 2011
New Revision: 1178145
URL: http://svn.apache.org/viewvc?rev=1178145&view=rev
Log:
Throw IOException if method returns false (DIRSERVER-1664)
Modified:
directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DefaultDirectoryServiceFactory.java
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/AbstractLayout.java
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/DirectoryService.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties
directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/MojoHelperUtils.java
directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/archive/ArchiveInstallerCommand.java
directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/bin/BinInstallerCommand.java
directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/deb/DebInstallerCommand.java
directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/macosxpkg/MacOsXPkgInstallerCommand.java
directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/nsis/NsisInstallerCommand.java
directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/rpm/RpmInstallerCommand.java
directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java
directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/LdifConfigExtractor.java
directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/log/impl/DefaultLogFileManager.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/log/impl/LogFileManager.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/log/impl/LogManager.java
Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DefaultDirectoryServiceFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DefaultDirectoryServiceFactory.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DefaultDirectoryServiceFactory.java (original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DefaultDirectoryServiceFactory.java Sun Oct 2 08:23:37 2011
@@ -117,7 +117,7 @@ public class DefaultDirectoryServiceFact
/**
* Build the working directory
*/
- private void buildInstanceDirectory( String name )
+ private void buildInstanceDirectory( String name ) throws IOException
{
String instanceDirectory = System.getProperty( "workingDirectory" );
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/AbstractLayout.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/AbstractLayout.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/AbstractLayout.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/AbstractLayout.java Sun Oct 2 08:23:37 2011
@@ -21,7 +21,9 @@ package org.apache.directory.server.core
import java.io.File;
+import java.io.IOException;
+import org.apache.directory.server.i18n.I18n;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -110,13 +112,16 @@ public abstract class AbstractLayout
/**
* Creates the required directories (if they don't already exist).
*/
- public void mkdirs()
+ public void mkdirs() throws IOException
{
for ( File requiredDirectory : requiredDirectories )
{
if ( !requiredDirectory.exists() )
{
- requiredDirectory.mkdirs();
+ if ( !requiredDirectory.mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, requiredDirectory ) );
+ }
}
}
}
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/DirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/DirectoryService.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/DirectoryService.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/DirectoryService.java Sun Oct 2 08:23:37 2011
@@ -20,6 +20,7 @@
package org.apache.directory.server.core;
+import java.io.IOException;
import java.util.List;
import java.util.Set;
@@ -360,8 +361,9 @@ public interface DirectoryService extend
/**
* Sets the InstanceLayout used by the DirectoryService to store the files
* @param instanceLayout The InstanceLayout to set
+ * @throws IOException If the layout could not be created
*/
- void setInstanceLayout( InstanceLayout instanceLayout );
+ void setInstanceLayout( InstanceLayout instanceLayout ) throws IOException;
/**
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Sun Oct 2 08:23:37 2011
@@ -509,34 +509,49 @@ public class DefaultDirectoryService imp
/**
* {@inheritDoc}
*/
- public void setInstanceLayout( InstanceLayout instanceLayout )
+ public void setInstanceLayout( InstanceLayout instanceLayout ) throws IOException
{
this.instanceLayout = instanceLayout;
// Create the directories if they are missing
if ( !instanceLayout.getInstanceDirectory().exists() )
{
- instanceLayout.getInstanceDirectory().mkdirs();
+ if ( !instanceLayout.getInstanceDirectory().mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, instanceLayout.getInstanceDirectory() ) );
+ }
}
if ( !instanceLayout.getLogDirectory().exists() )
{
- instanceLayout.getLogDirectory().mkdirs();
+ if ( !instanceLayout.getLogDirectory().mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, instanceLayout.getLogDirectory() ) );
+ }
}
if ( !instanceLayout.getRunDirectory().exists() )
{
- instanceLayout.getRunDirectory().mkdirs();
+ if ( !instanceLayout.getRunDirectory().mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, instanceLayout.getRunDirectory() ) );
+ }
}
if ( !instanceLayout.getPartitionsDirectory().exists() )
{
- instanceLayout.getPartitionsDirectory().mkdirs();
+ if ( !instanceLayout.getPartitionsDirectory().mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, instanceLayout.getPartitionsDirectory() ) );
+ }
}
if ( !instanceLayout.getConfDirectory().exists() )
{
- instanceLayout.getConfDirectory().mkdirs();
+ if ( !instanceLayout.getConfDirectory().mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, instanceLayout.getConfDirectory() ) );
+ }
}
}
Modified: directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java (original)
+++ directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java Sun Oct 2 08:23:37 2011
@@ -145,8 +145,8 @@ public enum I18n
// ERR_109( "ERR_109" ),
// ERR_110( "ERR_110" ),
// ERR_111( "ERR_111" ),
- // ERR_112( "ERR_112" ),
- // ERR_113( "ERR_113" ),
+ ERR_112_COULD_NOT_CREATE_DIRECORY("ERR_112_COULD_NOT_CREATE_DIRECORY"),
+ ERR_113_COULD_NOT_DELETE_FILE_OR_DIRECTORY("ERR_113_COULD_NOT_DELETE_FILE_OR_DIRECTORY"),
ERR_114("ERR_114"),
ERR_115("ERR_115"),
ERR_116("ERR_116"),
Modified: directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties (original)
+++ directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties Sun Oct 2 08:23:37 2011
@@ -133,8 +133,8 @@ ERR_91=Attempt to destroy wrapped partit
# ERR_109=
# ERR_110=
# ERR_111=
-# ERR_112=
-# ERR_113=
+ERR_112_COULD_NOT_CREATE_DIRECORY=Could not create directory {0}
+ERR_113_COULD_NOT_DELETE_FILE_OR_DIRECTORY=Could not delete file or directory {0}
ERR_114=Unable to create a DirectoryService instance for unknow reason
ERR_115=Failed to delete the working directory.
ERR_116=Failed to delete\:
Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/MojoHelperUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/MojoHelperUtils.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/MojoHelperUtils.java (original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/MojoHelperUtils.java Sun Oct 2 08:23:37 2011
@@ -36,6 +36,7 @@ import java.util.Properties;
import java.util.Set;
import org.apache.directory.server.InstallationLayout;
+import org.apache.directory.server.i18n.I18n;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.tools.ant.taskdefs.Execute;
@@ -224,7 +225,10 @@ public class MojoHelperUtils
{
File[] files = src.listFiles();
- dest.mkdirs();
+ if ( !dest.mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, dest ) );
+ }
for ( File file : files )
{
Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/archive/ArchiveInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/archive/ArchiveInstallerCommand.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/archive/ArchiveInstallerCommand.java (original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/archive/ArchiveInstallerCommand.java Sun Oct 2 08:23:37 2011
@@ -21,7 +21,9 @@ package org.apache.directory.server.inst
import java.io.File;
+import java.io.IOException;
+import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.installers.AbstractMojoCommand;
import org.apache.directory.server.installers.GenerateMojo;
import org.apache.directory.server.installers.MojoHelperUtils;
@@ -78,7 +80,12 @@ public class ArchiveInstallerCommand ext
log.info( " Creating " + archiveType + " archive..." );
// Creating the target directory
- getTargetDirectory().mkdirs();
+ if ( !getTargetDirectory().mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, getTargetDirectory() ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
log.info( " Copying archive files" );
@@ -100,7 +107,11 @@ public class ArchiveInstallerCommand ext
// Removing unnecessary directories and files
FileUtils.deleteDirectory( getInstallationLayout().getConfDirectory() );
- new File( getInstanceLayout().getConfDirectory(), "wrapper.conf" ).delete();
+ File wrapperConf = new File( getInstanceLayout().getConfDirectory(), "wrapper.conf" );
+ if ( !wrapperConf.delete() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_113_COULD_NOT_DELETE_FILE_OR_DIRECTORY, wrapperConf ) );
+ }
FileUtils.deleteDirectory( getInstanceLayout().getRunDirectory() );
}
catch ( Exception e )
@@ -162,7 +173,12 @@ public class ArchiveInstallerCommand ext
gzipTask.setSrc( tarFile );
gzipTask.execute();
- tarFile.delete();
+ if ( !tarFile.delete() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_113_COULD_NOT_DELETE_FILE_OR_DIRECTORY, tarFile ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
}
// TAR.BZ2 Archive
else if ( archiveType.equalsIgnoreCase( "tar.bz2" ) )
@@ -182,7 +198,12 @@ public class ArchiveInstallerCommand ext
bzip2Task.setSrc( tarFile );
bzip2Task.execute();
- tarFile.delete();
+ if ( !tarFile.delete() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_113_COULD_NOT_DELETE_FILE_OR_DIRECTORY, tarFile ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
}
log.info( "=> Archive Installer (" + archiveType + ") archive generated at "
Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/bin/BinInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/bin/BinInstallerCommand.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/bin/BinInstallerCommand.java (original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/bin/BinInstallerCommand.java Sun Oct 2 08:23:37 2011
@@ -23,6 +23,7 @@ package org.apache.directory.server.inst
import java.io.File;
import java.io.IOException;
+import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.installers.AbstractMojoCommand;
import org.apache.directory.server.installers.GenerateMojo;
import org.apache.directory.server.installers.MojoHelperUtils;
@@ -80,7 +81,12 @@ public class BinInstallerCommand extends
log.info( " Creating Bin installer..." );
// Creating the target directory
- getTargetDirectory().mkdirs();
+ if ( !getTargetDirectory().mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, getTargetDirectory() ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
log.info( " Copying Bin installer files" );
@@ -91,7 +97,12 @@ public class BinInstallerCommand extends
// Creating the instance directory
File instanceDirectory = getInstanceDirectory();
- instanceDirectory.mkdirs();
+ if ( !instanceDirectory.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, instanceDirectory ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
// Copying configuration files to the instance directory
MojoHelperUtils.copyAsciiFile( mojo, filterProperties,
@@ -111,7 +122,12 @@ public class BinInstallerCommand extends
// Creating the sh directory for the shell scripts
File binShDirectory = new File( getBinInstallerDirectory(), "sh" );
- binShDirectory.mkdirs();
+ if ( !binShDirectory.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, binShDirectory ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
// Copying shell script utilities for the installer
MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream( "bootstrap.sh" ),
Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/deb/DebInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/deb/DebInstallerCommand.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/deb/DebInstallerCommand.java (original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/deb/DebInstallerCommand.java Sun Oct 2 08:23:37 2011
@@ -23,6 +23,7 @@ package org.apache.directory.server.inst
import java.io.File;
import java.io.IOException;
+import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.installers.AbstractMojoCommand;
import org.apache.directory.server.installers.GenerateMojo;
import org.apache.directory.server.installers.MojoHelperUtils;
@@ -72,7 +73,12 @@ public class DebInstallerCommand extends
log.info( " Creating Deb installer..." );
// Creating the target directory
- getTargetDirectory().mkdirs();
+ if ( !getTargetDirectory().mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, getTargetDirectory() ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
log.info( " Copying Deb installer files" );
@@ -83,7 +89,12 @@ public class DebInstallerCommand extends
// Copying the init script in /etc/init.d/
File debEtcInitdDirectory = new File( getDebDirectory(), "etc/init.d" );
- debEtcInitdDirectory.mkdirs();
+ if ( !debEtcInitdDirectory.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, debEtcInitdDirectory ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
MojoHelperUtils.copyAsciiFile( mojo, filterProperties,
getClass().getResourceAsStream( "/org/apache/directory/server/installers/etc-initd-script" ),
new File( debEtcInitdDirectory, "apacheds-" + mojo.getProject().getVersion() + "-default" ), true );
@@ -96,7 +107,12 @@ public class DebInstallerCommand extends
// Create DEBIAN directory
File debDebianDirectory = new File( getDebDirectory(), "DEBIAN" );
- debDebianDirectory.mkdirs();
+ if ( !debDebianDirectory.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, debDebianDirectory ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
// Copying the 'control' file
try
Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/macosxpkg/MacOsXPkgInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/macosxpkg/MacOsXPkgInstallerCommand.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/macosxpkg/MacOsXPkgInstallerCommand.java (original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/macosxpkg/MacOsXPkgInstallerCommand.java Sun Oct 2 08:23:37 2011
@@ -23,6 +23,7 @@ package org.apache.directory.server.inst
import java.io.File;
import java.io.IOException;
+import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.installers.AbstractMojoCommand;
import org.apache.directory.server.installers.GenerateMojo;
import org.apache.directory.server.installers.MojoHelperUtils;
@@ -78,29 +79,87 @@ public class MacOsXPkgInstallerCommand e
// Creating the target directory
File targetDirectory = getTargetDirectory();
- targetDirectory.mkdirs();
+ if ( !targetDirectory.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, targetDirectory ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
log.info( " Copying PKG installer files" );
// Creating the root directories hierarchy
File pkgRootDirectory = new File( targetDirectory, "root" );
- pkgRootDirectory.mkdirs();
+ if ( !pkgRootDirectory.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, pkgRootDirectory ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
File pkgRootUsrBinDirectory = new File( pkgRootDirectory, "usr/bin" );
- pkgRootUsrBinDirectory.mkdirs();
+ if ( !pkgRootUsrBinDirectory.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, pkgRootUsrBinDirectory ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
File pkgRootUsrLocalApachedsDirectory = new File( pkgRootDirectory, "usr/local/apacheds-"
+ mojo.getProject().getVersion() );
- pkgRootUsrLocalApachedsDirectory.mkdirs();
+ if ( !pkgRootUsrLocalApachedsDirectory.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, pkgRootUsrLocalApachedsDirectory ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
File pkgRootInstancesDirectory = new File( pkgRootUsrLocalApachedsDirectory, "instances" );
- pkgRootInstancesDirectory.mkdirs();
+ if ( !pkgRootInstancesDirectory.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, pkgRootInstancesDirectory ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
File pkgRootInstancesDefaultDirectory = new File( pkgRootInstancesDirectory, "default" );
- pkgRootInstancesDefaultDirectory.mkdirs();
+ if ( !pkgRootInstancesDefaultDirectory.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, pkgRootInstancesDefaultDirectory ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
File pkgRootInstancesDefaultConfDirectory = new File( pkgRootInstancesDefaultDirectory, "conf" );
- pkgRootInstancesDefaultConfDirectory.mkdirs();
- new File( pkgRootInstancesDefaultDirectory, "log" ).mkdirs();
- new File( pkgRootInstancesDefaultDirectory, "partitions" ).mkdirs();
- new File( pkgRootInstancesDefaultDirectory, "run" ).mkdirs();
+ if ( !pkgRootInstancesDefaultConfDirectory.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, pkgRootInstancesDefaultConfDirectory ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
+ File pkgRootInstancesDefaultDirectoryLog = new File( pkgRootInstancesDefaultDirectory, "log" );
+ if ( !pkgRootInstancesDefaultDirectoryLog.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, pkgRootInstancesDefaultDirectoryLog ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
+ File pkgRootInstancesDefaultDirectoryPartitions = new File( pkgRootInstancesDefaultDirectory, "partitions" );
+ if ( !pkgRootInstancesDefaultDirectoryPartitions.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, pkgRootInstancesDefaultDirectoryPartitions ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
+ File pkgRootInstancesDefaultDirectoryRun = new File( pkgRootInstancesDefaultDirectory, "run" );
+ if ( !pkgRootInstancesDefaultDirectoryRun.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, pkgRootInstancesDefaultDirectoryRun ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
File pkgRootLibraryLaunchDaemons = new File( pkgRootDirectory, "Library/LaunchDaemons" );
- pkgRootLibraryLaunchDaemons.mkdirs();
+ if ( !pkgRootLibraryLaunchDaemons.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, pkgRootLibraryLaunchDaemons ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
// Copying the apacheds files in the root directory
try
@@ -121,9 +180,19 @@ public class MacOsXPkgInstallerCommand e
// Copying the resources files and Info.plist file needed for the
// generation of the PKG
File pkgResourcesEnglishDirectory = new File( targetDirectory, "Resources/en.lproj" );
- pkgResourcesEnglishDirectory.mkdirs();
+ if ( !pkgResourcesEnglishDirectory.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, pkgResourcesEnglishDirectory ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
File pkgScriptsDirectory = new File( targetDirectory, "scripts" );
- pkgScriptsDirectory.mkdirs();
+ if ( !pkgScriptsDirectory.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, pkgScriptsDirectory ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "pkg-background.tiff" ), new File(
pkgResourcesEnglishDirectory, "background.tiff" ) );
@@ -167,13 +236,23 @@ public class MacOsXPkgInstallerCommand e
// Creating the disc image directory
File dmgDirectory = new File( mojo.getOutputDirectory(), target.getId() + "-dmg" );
- dmgDirectory.mkdirs();
+ if ( !dmgDirectory.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, dmgDirectory ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
log.info( " Copying DMG files" );
// Create dmg directory and its sub-directory
File dmgDmgBackgroundDirectory = new File( dmgDirectory, "dmg/.background" );
- dmgDmgBackgroundDirectory.mkdirs();
+ if ( !dmgDmgBackgroundDirectory.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, dmgDmgBackgroundDirectory ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
// Copying the files
try
Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/nsis/NsisInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/nsis/NsisInstallerCommand.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/nsis/NsisInstallerCommand.java (original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/nsis/NsisInstallerCommand.java Sun Oct 2 08:23:37 2011
@@ -23,6 +23,7 @@ package org.apache.directory.server.inst
import java.io.File;
import java.io.IOException;
+import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.installers.AbstractMojoCommand;
import org.apache.directory.server.installers.GenerateMojo;
import org.apache.directory.server.installers.MojoHelperUtils;
@@ -76,7 +77,12 @@ public class NsisInstallerCommand extend
// Creating the target directory
File targetDirectory = getTargetDirectory();
- targetDirectory.mkdirs();
+ if ( !targetDirectory.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, targetDirectory ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
log.info( " Copying NSIS installer files" );
Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/rpm/RpmInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/rpm/RpmInstallerCommand.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/rpm/RpmInstallerCommand.java (original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/rpm/RpmInstallerCommand.java Sun Oct 2 08:23:37 2011
@@ -24,6 +24,7 @@ import java.io.File;
import java.io.IOException;
import java.util.Properties;
+import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.installers.AbstractMojoCommand;
import org.apache.directory.server.installers.GenerateMojo;
import org.apache.directory.server.installers.MojoHelperUtils;
@@ -77,18 +78,53 @@ public class RpmInstallerCommand extends
log.info( " Creating Rpm installer..." );
// Creating the target directory
- getTargetDirectory().mkdirs();
+ if ( !getTargetDirectory().mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, getTargetDirectory() ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
log.info( " Copying Rpm installer files" );
try
{
// Create Rpm directories (BUILD, RPMS, SOURCES, SPECS & SRPMS)
- new File( getTargetDirectory(), "BUILD" ).mkdirs();
- new File( getTargetDirectory(), "RPMS" ).mkdirs();
- new File( getTargetDirectory(), "SOURCES" ).mkdirs();
- new File( getTargetDirectory(), "SPECS" ).mkdirs();
- new File( getTargetDirectory(), "SRPMS" ).mkdirs();
+ File rpmBuild = new File( getTargetDirectory(), "BUILD" );
+ if ( !rpmBuild.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, rpmBuild ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
+ File rpmRpms = new File( getTargetDirectory(), "RPMS" );
+ if ( !rpmRpms.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, rpmRpms ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
+ File rpmSources = new File( getTargetDirectory(), "SOURCES" );
+ if ( !rpmSources.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, rpmSources ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
+ File rpmSpecs = new File( getTargetDirectory(), "SPECS" );
+ if ( !rpmSpecs.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, rpmSpecs ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
+ File rpmSrpms = new File( getTargetDirectory(), "SRPMS" );
+ if ( !rpmSrpms.mkdirs() )
+ {
+ Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, rpmSrpms ) );
+ log.error( e.getLocalizedMessage() );
+ throw new MojoFailureException( e.getMessage() );
+ }
// Creating the installation and instance layouts
createLayouts();
Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java Sun Oct 2 08:23:37 2011
@@ -22,6 +22,7 @@ package org.apache.directory.server.core
import java.io.File;
import java.io.FilenameFilter;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -119,7 +120,10 @@ public class JdbmPartition extends Abstr
// Create the underlying directories (only if needed)
File partitionDir = new File( getPartitionPath() );
- partitionDir.mkdirs();
+ if ( !partitionDir.exists() && !partitionDir.mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, partitionDir ));
+ }
// Initialize the indexes
super.doInit();
Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java Sun Oct 2 08:23:37 2011
@@ -140,7 +140,6 @@ public class JdbmStoreTest
wkdir = File.createTempFile( getClass().getSimpleName(), "db" );
wkdir.delete();
wkdir = new File( wkdir.getParentFile(), getClass().getSimpleName() );
- wkdir.mkdirs();
// initialize the store
store = new JdbmPartition( schemaManager );
@@ -199,7 +198,6 @@ public class JdbmStoreTest
File wkdir2 = File.createTempFile( getClass().getSimpleName(), "db2" );
wkdir2.delete();
wkdir2 = new File( wkdir2.getParentFile(), getClass().getSimpleName() );
- wkdir2.mkdirs();
// initialize the 2nd store
JdbmPartition store2 = new JdbmPartition( schemaManager );
Modified: directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java (original)
+++ directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java Sun Oct 2 08:23:37 2011
@@ -506,7 +506,10 @@ public class LdifPartition extends Abstr
if ( !dir.exists() && create )
{
// We have to create the entry if it does not have a parent
- dir.mkdir();
+ if ( !dir.mkdir() )
+ {
+ throw new LdapException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, dir ) );
+ }
}
File ldifFile = new File( parentDir + rdnFileName );
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java Sun Oct 2 08:23:37 2011
@@ -23,6 +23,7 @@ package org.apache.directory.server.ldap
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -38,6 +39,7 @@ import org.apache.directory.ldap.client.
import org.apache.directory.server.core.CoreSession;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.filtering.EntryFilteringCursor;
+import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.ldap.replication.ReplicationConsumerConfig;
import org.apache.directory.server.ldap.replication.SyncreplConfiguration;
import org.apache.directory.shared.ldap.codec.controls.manageDsaIT.ManageDsaITDecorator;
@@ -175,7 +177,10 @@ public class ReplicationConsumerImpl imp
if ( config.isStoreCookieInFile() )
{
File cookieDir = new File( directoryservice.getInstanceLayout().getRunDirectory(), "cookies" );
- cookieDir.mkdir();
+ if ( !cookieDir.mkdir() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, cookieDir ) );
+ }
cookieFile = new File( cookieDir, String.valueOf( config.getReplicaId() ) );
}
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java Sun Oct 2 08:23:37 2011
@@ -26,6 +26,7 @@ import static org.apache.directory.serve
import static org.apache.directory.server.ldap.LdapServer.NO_TIME_LIMIT;
import java.io.File;
+import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.HashMap;
import java.util.List;
@@ -161,7 +162,10 @@ public class SyncReplRequestHandler impl
if ( !syncReplData.exists() )
{
- syncReplData.mkdirs();
+ if ( !syncReplData.mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, syncReplData ) );
+ }
}
replicaUtil = new ReplConsumerManager( dirService );
Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/LdifConfigExtractor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/LdifConfigExtractor.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/LdifConfigExtractor.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/LdifConfigExtractor.java Sun Oct 2 08:23:37 2011
@@ -35,6 +35,8 @@ import java.util.Map.Entry;
import java.util.Stack;
import java.util.regex.Pattern;
+import javax.management.RuntimeErrorException;
+
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.shared.ldap.schemaextractor.impl.DefaultSchemaLdifExtractor;
import org.apache.directory.shared.ldap.schemaextractor.impl.ResourceMap;
@@ -76,7 +78,10 @@ public class LdifConfigExtractor
if ( !outputDirectory.exists() )
{
LOG.debug( "creating non existing output directory {}", outputDirectory.getAbsolutePath() );
- outputDirectory.mkdir();
+ if ( !outputDirectory.mkdir() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, outputDirectory ) );
+ }
}
File configDirectory = new File( outputDirectory, CONFIG_SUBDIR );
@@ -84,7 +89,10 @@ public class LdifConfigExtractor
if ( !configDirectory.exists() )
{
LOG.debug( "creating non existing config directory {}", configDirectory.getAbsolutePath() );
- configDirectory.mkdir();
+ if ( !configDirectory.mkdir() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, configDirectory ) );
+ }
}
else if ( !overwrite )
{
@@ -124,7 +132,10 @@ public class LdifConfigExtractor
if ( !destination.getParentFile().exists() )
{
- destination.getParentFile().mkdirs();
+ if ( !destination.getParentFile().mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, destination.getParentFile() ) );
+ }
}
if ( !source.getParentFile().exists() )
@@ -172,7 +183,10 @@ public class LdifConfigExtractor
if ( !destination.getParentFile().exists() )
{
- destination.getParentFile().mkdirs();
+ if ( !destination.getParentFile().mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, destination.getParentFile() ) );
+ }
}
FileOutputStream out = new FileOutputStream( destination );
@@ -274,7 +288,11 @@ public class LdifConfigExtractor
if ( !configDir.exists() )
{
LOG.debug( "creating non existing config directory {}", configDir.getAbsolutePath() );
- configDir.mkdir();
+ if ( !configDir.mkdir() )
+ {
+ throw new RuntimeException(
+ new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, configDir ) ) );
+ }
}
else
{
Modified: directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java (original)
+++ directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java Sun Oct 2 08:23:37 2011
@@ -21,6 +21,7 @@ package org.apache.directory.server;
import java.io.File;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -151,7 +152,10 @@ public class ApacheDsService
if ( !partitionsDir.exists() )
{
LOG.info( "partition directory doesn't exist, creating {}", partitionsDir.getAbsolutePath() );
- partitionsDir.mkdirs();
+ if ( !partitionsDir.mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, partitionsDir ) );
+ }
}
LOG.info( "using partition dir {}", partitionsDir.getAbsolutePath() );
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/log/impl/DefaultLogFileManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/log/impl/DefaultLogFileManager.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/log/impl/DefaultLogFileManager.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/log/impl/DefaultLogFileManager.java Sun Oct 2 08:23:37 2011
@@ -112,11 +112,14 @@ class DefaultLogFileManager implements L
/**
* {@inheritDoc}
*/
- public void deleteLogFile( long logFileNumber )
+ public void deleteLogFile( long logFileNumber ) throws IOException
{
File logFile = this.makeLogFileName( logFileNumber );
- logFile.delete();
+ if ( !logFile.delete() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_113_COULD_NOT_DELETE_FILE_OR_DIRECTORY, logFile ));
+ }
}
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/log/impl/LogFileManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/log/impl/LogFileManager.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/log/impl/LogFileManager.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/log/impl/LogFileManager.java Sun Oct 2 08:23:37 2011
@@ -89,8 +89,9 @@ interface LogFileManager
* Deletes the underlying log file.
*
* @param logFileNumber identifier of the log file
+ * @throws IOException If the log file could not be deleted
*/
- public void deleteLogFile( long logFileNumber );
+ public void deleteLogFile( long logFileNumber ) throws IOException;
/**
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/log/impl/LogManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/log/impl/LogManager.java?rev=1178145&r1=1178144&r2=1178145&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/log/impl/LogManager.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/log/impl/LogManager.java Sun Oct 2 08:23:37 2011
@@ -490,8 +490,15 @@ class LogManager
for ( long logFileNumber = startingLogFileNumber; logFileNumber < endingLogFileNumber;
logFileNumber++ )
{
+ try
+ {
// Do a best effort delete
logFileManager.deleteLogFile( logFileNumber );
+ }
+ catch( IOException e )
+ {
+ // Do a best effort ...
+ }
}
}