You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ca...@apache.org on 2006/09/18 19:44:50 UTC

svn commit: r447484 - /maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java

Author: carlos
Date: Mon Sep 18 10:44:49 2006
New Revision: 447484

URL: http://svn.apache.org/viewvc?view=rev&rev=447484
Log:
[CONTINUUM-923] NPE adding pom

Modified:
    maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java

Modified: maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java?view=diff&rev=447484&r1=447483&r2=447484
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java (original)
+++ maven/continuum/branches/continuum-acegi/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java Mon Sep 18 10:44:49 2006
@@ -340,32 +340,18 @@
         }
         catch ( ProjectBuildingException e )
         {
-            Throwable cause = e.getCause();
-
-            while ( ( cause.getCause() != null ) && ( cause instanceof ProjectBuildingException ) )
-            {
-                cause = cause.getCause();
-            }
+            StringBuffer messages = new StringBuffer();
 
-            if ( cause instanceof ArtifactNotFoundException )
+            Throwable cause = e.getCause();
+            
+            if( cause != null )
             {
-                result.addError( ContinuumProjectBuildingResult.ERROR_ARTIFACT_NOT_FOUND,
-                                 ( (ArtifactNotFoundException) cause ).toString() );
-                return null;
+                while ( ( cause.getCause() != null ) && ( cause instanceof ProjectBuildingException ) )
+                {
+                    cause = cause.getCause();
+                }
             }
 
-            result.addError( ContinuumProjectBuildingResult.ERROR_PROJECT_BUILDING, e.getMessage() );
-
-            String msg = "Cannot build maven project from " + file + " (" + e.getMessage() + ").";
-
-            getLogger().error( msg, e );
-
-            return null;
-        }
-        catch ( Exception e )
-        {
-            StringBuffer messages = new StringBuffer();
-
             if ( e instanceof InvalidProjectModelException )
             {
                 InvalidProjectModelException ex = (InvalidProjectModelException) e;
@@ -384,9 +370,31 @@
                 }
             }
 
+            if ( cause instanceof ArtifactNotFoundException )
+            {
+                result.addError( ContinuumProjectBuildingResult.ERROR_ARTIFACT_NOT_FOUND,
+                                 ( (ArtifactNotFoundException) cause ).toString() );
+                return null;
+            }
+
+            result.addError( ContinuumProjectBuildingResult.ERROR_PROJECT_BUILDING, e.getMessage() );
+
             String msg = "Cannot build maven project from " + file + " (" + e.getMessage() + ").\n" + messages;
+            
+            file.delete();
+
+            getLogger().error( msg );
+
+            return null;
+        }
+        // TODO catch all exceptions is bad
+        catch ( Exception e )
+        {
+            String msg = "Cannot build maven project from " + file + " (" + e.getMessage() + ").";
 
-            getLogger().error( msg, e );
+            file.delete();
+            
+            getLogger().error( msg );
             
             return null;
         }