You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jv...@apache.org on 2009/04/29 03:19:20 UTC
svn commit: r769609 - in
/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception:
./ DefaultExceptionHandler.java ExceptionHandler.java ExceptionSummary.java
Author: jvanzyl
Date: Wed Apr 29 01:19:19 2009
New Revision: 769609
URL: http://svn.apache.org/viewvc?rev=769609&view=rev
Log:
o adding exception handling code
Added:
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java (with props)
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/ExceptionHandler.java (with props)
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/ExceptionSummary.java (with props)
Added: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java?rev=769609&view=auto
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java (added)
+++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java Wed Apr 29 01:19:19 2009
@@ -0,0 +1,73 @@
+package org.apache.maven.exception;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.codehaus.plexus.component.annotations.Component;
+
+/*
+
+All Possible Errors
+- bad command line parameter
+- malformed settings
+- malformed POM
+- local repository not writable
+- remote repositories not available
+- artifact metadata missing
+- extension metadata missing
+- extension artifact missing
+- artifact metadata retrieval problem
+- version range violation
+- circular dependency
+- artifact missing
+- artifact retrieval exception
+- plugin metadata missing
+- plugin metadata retrieval problem
+- plugin artifact missing
+- plugin artifact retrieval problem
+- plugin dependency metadata missing
+- plugin dependency metadata retrieval problem
+- plugin configuration problem
+- plugin execution failure due to something that is know to possibly go wrong (like compilation failure)
+- plugin execution error due to something that is not expected to go wrong (the compiler executable missing)
+- md5 checksum doesn't match for local artifact, need to redownload this
+
+brett:
+- transitive dependency problems - tracking down
+- invalid lifecycle phase (maybe same as bad CLI param, though you were talking about embedder too)
+- <module> specified is not found
+- POM doesn't exist for a goal that requires one
+- goal not found in a plugin (probably could list the ones that are)
+- parent POM missing (in both the repository + relative path)
+brian:
+- component not found
+- missing goal in plugin
+- removing the scripting options from the core
+
+ */
+
+@Component(role=ExceptionHandler.class)
+public class DefaultExceptionHandler
+ implements ExceptionHandler
+{
+ public ExceptionSummary handleException( Exception exception )
+ {
+ String message;
+
+ String reference = "http://";
+
+ if ( exception instanceof MojoFailureException )
+ {
+ message = ((MojoFailureException)exception).getLongMessage();
+ }
+ else if ( exception instanceof MojoExecutionException )
+ {
+ message = ((MojoExecutionException)exception).getLongMessage();
+ }
+ else
+ {
+ message = exception.getMessage();
+ }
+
+ return new ExceptionSummary( exception, message, reference );
+ }
+}
Propchange: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/ExceptionHandler.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/ExceptionHandler.java?rev=769609&view=auto
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/ExceptionHandler.java (added)
+++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/ExceptionHandler.java Wed Apr 29 01:19:19 2009
@@ -0,0 +1,6 @@
+package org.apache.maven.exception;
+
+public interface ExceptionHandler
+{
+ ExceptionSummary handleException( Exception e );
+}
Propchange: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/ExceptionHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/ExceptionHandler.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/ExceptionSummary.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/ExceptionSummary.java?rev=769609&view=auto
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/ExceptionSummary.java (added)
+++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/ExceptionSummary.java Wed Apr 29 01:19:19 2009
@@ -0,0 +1,39 @@
+package org.apache.maven.exception;
+
+// provide a
+// - the exception
+// - useful message
+// - useful reference to a solution, or set of solutions
+// - the configuration gleaned for examination
+// - plugin repositories
+
+public class ExceptionSummary
+{
+ private Exception exception;
+
+ private String message;
+
+ private String reference;
+
+ public ExceptionSummary( Exception exception, String message, String reference )
+ {
+ this.exception = exception;
+ this.message = message;
+ this.reference = reference;
+ }
+
+ public Exception getException()
+ {
+ return exception;
+ }
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public String getReference()
+ {
+ return reference;
+ }
+}
Propchange: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/ExceptionSummary.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/exception/ExceptionSummary.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision