directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r607623 - /directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCopyEclipseDependencyMojo.java
Date Mon, 31 Dec 2007 00:00:26 GMT
Author: felixk
Date: Sun Dec 30 16:00:19 2007
New Revision: 607623

URL: http://svn.apache.org/viewvc?rev=607623&view=rev
Log:
Throw error when destination directory can't be created

Modified:
    directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCopyEclipseDependencyMojo.java

Modified: directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCopyEclipseDependencyMojo.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCopyEclipseDependencyMojo.java?rev=607623&r1=607622&r2=607623&view=diff
==============================================================================
--- directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCopyEclipseDependencyMojo.java
(original)
+++ directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCopyEclipseDependencyMojo.java
Sun Dec 30 16:00:19 2007
@@ -21,6 +21,7 @@
 
 
 import java.io.File;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Iterator;
 
@@ -78,31 +79,27 @@
     public void execute() throws MojoExecutionException
     {
         final Maven2OsgiConverter maven2OsgiConverter = new DefaultMaven2OsgiConverter();
-
         completeArtifactItems( artifactItems );
 
+        if ( !destinationDirectory.exists() && !destinationDirectory.mkdirs() )
+        {
+            throw new MojoExecutionException( "Can't create directory " + destinationDirectory
);
+        }
+
         for ( Iterator<ArtifactItem> artifactItem = artifactItems.iterator(); artifactItem.hasNext();
)
         {
             ArtifactItem item = artifactItem.next();
+            final File destFile = new File( destinationDirectory.getAbsoluteFile() + File.separator
+                + maven2OsgiConverter.getBundleFileName( item.getArtifact() ) );
+            getLog().info(
+                "Copying artifact " + item.getArtifactId() + " to\n               " + destFile.getAbsolutePath()
);
             try
             {
-
-                final File destFile = new File( destinationDirectory.getAbsoluteFile() +
File.separator
-                    + maven2OsgiConverter.getBundleFileName( item.getArtifact() ) );
-
-                getLog().info(
-                    "Copying artifact " + item.getArtifactId() + " to\n               " +
destFile.getAbsolutePath() );
-
-                if ( !destinationDirectory.exists() )
-                {
-                    destinationDirectory.mkdirs();
-                }
                 FileUtils.copyFile( item.getArtifact().getFile(), destFile );
-
             }
-            catch ( Exception e )
+            catch ( IOException ioe )
             {
-                throw new MojoExecutionException( "", e );
+                throw new MojoExecutionException( "Can't copy file.", ioe );
             }
         }
     }



Mime
View raw message