maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ltheu...@apache.org
Subject svn commit: r394842 - in /maven/maven-1/core/trunk/src/java/org/apache/maven: MavenUtils.java cli/App.java
Date Tue, 18 Apr 2006 05:20:15 GMT
Author: ltheussl
Date: Mon Apr 17 22:20:13 2006
New Revision: 394842

URL: http://svn.apache.org/viewcvs?rev=394842&view=rev
Log:
PR: MAVEN-1707
Malformed project.xml caueses unexpected error.
Only display "Unknown error ..." message if the error is really unknown.

Modified:
    maven/maven-1/core/trunk/src/java/org/apache/maven/MavenUtils.java
    maven/maven-1/core/trunk/src/java/org/apache/maven/cli/App.java

Modified: maven/maven-1/core/trunk/src/java/org/apache/maven/MavenUtils.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/core/trunk/src/java/org/apache/maven/MavenUtils.java?rev=394842&r1=394841&r2=394842&view=diff
==============================================================================
--- maven/maven-1/core/trunk/src/java/org/apache/maven/MavenUtils.java (original)
+++ maven/maven-1/core/trunk/src/java/org/apache/maven/MavenUtils.java Mon Apr 17 22:20:13
2006
@@ -73,6 +73,9 @@
     /** Map of loaded POMs. */
     private static HashMap parentPoms = new HashMap();
 
+    /** Maven unknown error message. */
+    public static final String MAVEN_UNKNOWN_ERROR = "Unknown error reading project";
+
     /**
      * Create a Project object given a file descriptor.
      *
@@ -140,10 +143,14 @@
         {
             throw new MavenException("Error parsing XML", e);
         }
+        catch (MavenException e)
+        {
+            throw new MavenException(e.getMessage(), e);
+        }
         catch (Exception e)
         {
             // FIXME
-            throw new MavenException("Unknown error reading project", e);
+            throw new MavenException(MAVEN_UNKNOWN_ERROR, e);
         }
 
         return project;

Modified: maven/maven-1/core/trunk/src/java/org/apache/maven/cli/App.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/core/trunk/src/java/org/apache/maven/cli/App.java?rev=394842&r1=394841&r2=394842&view=diff
==============================================================================
--- maven/maven-1/core/trunk/src/java/org/apache/maven/cli/App.java (original)
+++ maven/maven-1/core/trunk/src/java/org/apache/maven/cli/App.java Mon Apr 17 22:20:13 2006
@@ -613,6 +613,25 @@
             }
             displayBugReportHelp();
         }
+        catch ( MavenException e )
+        {
+            returnCode = RC_OTHER_FAILURE;
+            failed = true;
+            System.err.println( MavenUtils.getMessage( "build.failed" ) );
+            System.err.println( e.getMessage() );
+            if ( getCli().hasOption( DISPLAY_STACKTRACE ) )
+            {
+                e.printStackTrace();
+            }
+            else
+            {
+                System.err.println( MavenUtils.getMessage( "displayBugReportHelp.line4" )
);
+            }
+            if ( e.getMessage().equals( MavenUtils.MAVEN_UNKNOWN_ERROR ) )
+            {
+                displayBugReportHelp();
+            }
+        }
         catch ( Throwable t )
         {
             returnCode = RC_OTHER_FAILURE;



Mime
View raw message