You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2005/10/13 20:49:52 UTC

svn commit: r320869 - in /maven/components/trunk: maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/ maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/ maven-artifact/src/main/java/org/apache/maven/artifact/r...

Author: brett
Date: Thu Oct 13 11:49:19 2005
New Revision: 320869

URL: http://svn.apache.org/viewcvs?rev=320869&view=rev
Log:
more error diagnostics improvements

Added:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java   (with props)
Modified:
    maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
    maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/DefaultArtifactTransformationManager.java
    maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/LatestArtifactTransformation.java
    maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/ReleaseArtifactTransformation.java
    maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java
    maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactNotFoundException.java
    maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/transform/ArtifactTransformation.java
    maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/transform/ArtifactTransformationManager.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactResolverDiagnoser.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/InvalidArtifactDiagnoser.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoExecutionExceptionDiagnoser.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProfileActivationDiagnoser.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/SystemWarnings.java
    maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml
    maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnostics.java
    maven/components/trunk/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java
    maven/components/trunk/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java

Modified: maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java (original)
+++ maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java Thu Oct 13 11:49:19 2005
@@ -133,7 +133,7 @@
         }
         catch ( UnsupportedProtocolException e )
         {
-            throw new TransferFailedException( "Unsupported Protocol: ", e );
+            throw new TransferFailedException( "Unsupported Protocol: '" + protocol + "': " + e.getMessage(), e );
         }
         
         if ( downloadMonitor != null )
@@ -156,7 +156,7 @@
         }
         catch ( NoSuchAlgorithmException e )
         {
-            throw new TransferFailedException( "Unable to add checksum methods", e );
+            throw new TransferFailedException( "Unable to add checksum methods: " + e.getMessage(), e );
         }
 
         try
@@ -204,23 +204,23 @@
         }
         catch ( ConnectionException e )
         {
-            throw new TransferFailedException( "Connection failed: ", e );
+            throw new TransferFailedException( "Connection failed: " + e.getMessage(), e );
         }
         catch ( AuthenticationException e )
         {
-            throw new TransferFailedException( "Authentication failed: ", e );
+            throw new TransferFailedException( "Authentication failed: " + e.getMessage(), e );
         }
         catch ( AuthorizationException e )
         {
-            throw new TransferFailedException( "Authorization failed: ", e );
+            throw new TransferFailedException( "Authorization failed: " + e.getMessage(), e );
         }
         catch ( ResourceDoesNotExistException e )
         {
-            throw new TransferFailedException( "Resource to deploy not found: ", e );
+            throw new TransferFailedException( "Resource to deploy not found: " + e.getMessage(), e );
         }
         catch ( IOException e )
         {
-            throw new TransferFailedException( "Error creating temporary file for deployment: ", e );
+            throw new TransferFailedException( "Error creating temporary file for deployment: " + e.getMessage(), e );
         }
         finally
         {
@@ -320,7 +320,7 @@
         }
         catch ( UnsupportedProtocolException e )
         {
-            throw new TransferFailedException( "Unsupported Protocol: ", e );
+            throw new TransferFailedException( "Unsupported Protocol: '" + protocol + "': " + e.getMessage(), e );
         }
 
         if ( downloadMonitor != null )
@@ -341,7 +341,7 @@
         }
         catch ( NoSuchAlgorithmException e )
         {
-            throw new TransferFailedException( "Unable to add checksum methods", e );
+            throw new TransferFailedException( "Unable to add checksum methods: " + e.getMessage(), e );
         }
 
         File temp = new File( destination + ".tmp" );
@@ -436,15 +436,15 @@
         }
         catch ( ConnectionException e )
         {
-            throw new TransferFailedException( "Connection failed: ", e );
+            throw new TransferFailedException( "Connection failed: " + e.getMessage(), e );
         }
         catch ( AuthenticationException e )
         {
-            throw new TransferFailedException( "Authentication failed: ", e );
+            throw new TransferFailedException( "Authentication failed: " + e.getMessage(), e );
         }
         catch ( AuthorizationException e )
         {
-            throw new TransferFailedException( "Authorization failed: ", e );
+            throw new TransferFailedException( "Authorization failed: " + e.getMessage(), e );
         }
         finally
         {
@@ -474,7 +474,8 @@
             }
             catch ( IOException e )
             {
-                throw new TransferFailedException( "Error copying temporary file to the final destination: ", e );
+                throw new TransferFailedException(
+                    "Error copying temporary file to the final destination: " + e.getMessage(), e );
             }
         }
     }

Modified: maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/DefaultArtifactTransformationManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/DefaultArtifactTransformationManager.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/DefaultArtifactTransformationManager.java (original)
+++ maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/DefaultArtifactTransformationManager.java Thu Oct 13 11:49:19 2005
@@ -20,6 +20,7 @@
 import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
 import org.apache.maven.artifact.installer.ArtifactInstallationException;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 
 import java.util.Iterator;
@@ -31,7 +32,7 @@
     private List artifactTransformations;
 
     public void transformForResolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
-        throws ArtifactResolutionException
+        throws ArtifactResolutionException, ArtifactNotFoundException
     {
         for ( Iterator i = artifactTransformations.iterator(); i.hasNext(); )
         {

Modified: maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/LatestArtifactTransformation.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/LatestArtifactTransformation.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/LatestArtifactTransformation.java (original)
+++ maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/LatestArtifactTransformation.java Thu Oct 13 11:49:19 2005
@@ -20,6 +20,7 @@
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException;
 import org.apache.maven.artifact.repository.metadata.Versioning;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 
 import java.util.List;
@@ -28,7 +29,7 @@
     extends AbstractVersionTransformation
 {
     public void transformForResolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
-        throws ArtifactResolutionException
+        throws ArtifactResolutionException, ArtifactNotFoundException
     {
         if ( Artifact.LATEST_VERSION.equals( artifact.getVersion() ) )
         {
@@ -37,7 +38,7 @@
                 String version = resolveVersion( artifact, localRepository, remoteRepositories );
                 if ( Artifact.LATEST_VERSION.equals( version ) )
                 {
-                    throw new ArtifactResolutionException( "Unable to determine the latest version", artifact );
+                    throw new ArtifactNotFoundException( "Unable to determine the latest version", artifact );
                 }
 
                 artifact.setBaseVersion( version );

Modified: maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/ReleaseArtifactTransformation.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/ReleaseArtifactTransformation.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/ReleaseArtifactTransformation.java (original)
+++ maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/ReleaseArtifactTransformation.java Thu Oct 13 11:49:19 2005
@@ -22,6 +22,7 @@
 import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
 import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException;
 import org.apache.maven.artifact.repository.metadata.Versioning;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 
 import java.util.List;
@@ -36,7 +37,7 @@
     extends AbstractVersionTransformation
 {
     public void transformForResolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
-        throws ArtifactResolutionException
+        throws ArtifactResolutionException, ArtifactNotFoundException
     {
         if ( Artifact.RELEASE_VERSION.equals( artifact.getVersion() ) )
         {
@@ -46,7 +47,7 @@
 
                 if ( Artifact.RELEASE_VERSION.equals( version ) )
                 {
-                    throw new ArtifactResolutionException( "Unable to determine the release version", artifact );
+                    throw new ArtifactNotFoundException( "Unable to determine the release version", artifact );
                 }
 
                 artifact.setBaseVersion( version );

Modified: maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java (original)
+++ maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java Thu Oct 13 11:49:19 2005
@@ -19,6 +19,7 @@
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 
@@ -161,7 +162,7 @@
             sb.append( "from the specified remote repositories:" );
             sb.append( LS + "  " );
 
-            for ( Iterator i = remoteRepositories.iterator(); i.hasNext(); )
+            for ( Iterator i = new HashSet( remoteRepositories ).iterator(); i.hasNext(); )
             {
                 ArtifactRepository remoteRepository = (ArtifactRepository) i.next();
 

Modified: maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactNotFoundException.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactNotFoundException.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactNotFoundException.java (original)
+++ maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactNotFoundException.java Thu Oct 13 11:49:19 2005
@@ -29,7 +29,7 @@
 {
     private String downloadUrl;
 
-    protected ArtifactNotFoundException( String message, Artifact artifact )
+    public ArtifactNotFoundException( String message, Artifact artifact )
     {
         this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), null,
               null );

Modified: maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/transform/ArtifactTransformation.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/transform/ArtifactTransformation.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/transform/ArtifactTransformation.java (original)
+++ maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/transform/ArtifactTransformation.java Thu Oct 13 11:49:19 2005
@@ -20,6 +20,7 @@
 import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
 import org.apache.maven.artifact.installer.ArtifactInstallationException;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 
 import java.util.List;
@@ -42,7 +43,7 @@
      * @param localRepository the local repository
      */
     void transformForResolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
-        throws ArtifactResolutionException;
+        throws ArtifactResolutionException, ArtifactNotFoundException;
 
     /**
      * Take in a artifact and return the transformed artifact for locating in the local repository. If no

Modified: maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/transform/ArtifactTransformationManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/transform/ArtifactTransformationManager.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/transform/ArtifactTransformationManager.java (original)
+++ maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/transform/ArtifactTransformationManager.java Thu Oct 13 11:49:19 2005
@@ -20,6 +20,7 @@
 import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
 import org.apache.maven.artifact.installer.ArtifactInstallationException;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 
 import java.util.List;
@@ -40,7 +41,7 @@
      * @param localRepository the local repository
      */
     void transformForResolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
-        throws ArtifactResolutionException;
+        throws ArtifactResolutionException, ArtifactNotFoundException;
 
     /**
      * Take in a artifact and return the transformed artifact for locating in the local repository. If no

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java Thu Oct 13 11:49:19 2005
@@ -17,7 +17,6 @@
  */
 
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
-import org.apache.maven.usability.diagnostics.DiagnosisUtils;
 import org.apache.maven.usability.plugin.Expression;
 import org.apache.maven.usability.plugin.ExpressionDocumentationException;
 import org.apache.maven.usability.plugin.ExpressionDocumenter;
@@ -273,11 +272,7 @@
             addParameterUsageInfo( value, message );
         }
 
-        message.append( "Reason: " ).append( cce.getMessage() ).append( "\n" );
-
-        Throwable root = DiagnosisUtils.getRootCause( cce );
-
-        message.append( "Root Cause: " ).append( root.getMessage() ).append( "\n\n" );
+        message.append( "\n\nCause: " ).append( cce.getMessage() );
 
         return message.toString();
     }

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java Thu Oct 13 11:49:19 2005
@@ -215,8 +215,7 @@
         // if we still haven't found a version, then fail early before we get into the update goop.
         if ( StringUtils.isEmpty( version ) )
         {
-            throw new PluginVersionNotFoundException( groupId, artifactId,
-                                                      "Failed to resolve a valid version for this plugin" );
+            throw new PluginVersionNotFoundException( groupId, artifactId );
         }
 
         // if the plugin registry is inactive, then the rest of this goop is useless...

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java Thu Oct 13 11:49:19 2005
@@ -23,9 +23,9 @@
 
     private final String artifactId;
 
-    public PluginVersionNotFoundException( String groupId, String artifactId, String baseMessage )
+    public PluginVersionNotFoundException( String groupId, String artifactId )
     {
-        super( "Error resolving version for \'" + groupId + ":" + artifactId + "\': " + baseMessage );
+        super( "The plugin \'" + groupId + ":" + artifactId + "\' does not exist or no valid version could be found" );
 
         this.groupId = groupId;
         this.artifactId = artifactId;

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java Thu Oct 13 11:49:19 2005
@@ -34,8 +34,8 @@
 
     public String diagnose( Throwable error )
     {
-        ArtifactNotFoundException exception = (ArtifactNotFoundException) DiagnosisUtils.getFromCausality( error,
-                                                                                                           ArtifactNotFoundException.class );
+        ArtifactNotFoundException exception =
+            (ArtifactNotFoundException) DiagnosisUtils.getFromCausality( error, ArtifactNotFoundException.class );
 
         StringBuffer message = new StringBuffer();
 
@@ -49,13 +49,6 @@
         if ( !wagonManager.isOnline() )
         {
             message.append( "\n" ).append( SystemWarnings.getOfflineWarning() );
-        }
-
-        Throwable root = DiagnosisUtils.getRootCause( exception );
-
-        if ( root != null )
-        {
-            message.append( "\nRoot Cause: " ).append( root.getMessage() );
         }
 
         message.append( "\n" );

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactResolverDiagnoser.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactResolverDiagnoser.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactResolverDiagnoser.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactResolverDiagnoser.java Thu Oct 13 11:49:19 2005
@@ -34,8 +34,8 @@
 
     public String diagnose( Throwable error )
     {
-        ArtifactResolutionException exception = (ArtifactResolutionException) DiagnosisUtils.getFromCausality( error,
-                                                                                                               ArtifactResolutionException.class );
+        ArtifactResolutionException exception =
+            (ArtifactResolutionException) DiagnosisUtils.getFromCausality( error, ArtifactResolutionException.class );
 
         StringBuffer message = new StringBuffer();
 
@@ -46,13 +46,6 @@
         if ( !wagonManager.isOnline() )
         {
             message.append( "\n" ).append( SystemWarnings.getOfflineWarning() );
-        }
-
-        Throwable root = DiagnosisUtils.getRootCause( exception );
-
-        if ( root != null )
-        {
-            message.append( "\nRoot Cause: " ).append( root.getMessage() );
         }
 
         message.append( "\n" );

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/InvalidArtifactDiagnoser.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/InvalidArtifactDiagnoser.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/InvalidArtifactDiagnoser.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/InvalidArtifactDiagnoser.java Thu Oct 13 11:49:19 2005
@@ -1,8 +1,5 @@
 package org.apache.maven.usability;
 
-import org.apache.maven.artifact.InvalidArtifactRTException;
-import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
-
 /*
  * Copyright 2001-2005 The Apache Software Foundation.
  *
@@ -19,6 +16,9 @@
  * limitations under the License.
  */
 
+import org.apache.maven.artifact.InvalidArtifactRTException;
+import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
+
 public class InvalidArtifactDiagnoser
     implements ErrorDiagnoser
 {
@@ -31,25 +31,25 @@
     public String diagnose( Throwable error )
     {
         StringBuffer diagnosis = new StringBuffer();
-        
+
         InvalidArtifactRTException e = (InvalidArtifactRTException) error;
-        
+
         diagnosis.append( "An invalid artifact was detected.\n\n" )
-                 .append( "This artifact might be in your project's POM, ")
-                 .append( "or it might have been included transitively during the resolution process. ")
-                 .append( "Here is the information we do have for this artifact:\n")
-                 .append( "\n    o GroupID:     ").append( maybeFlag( e.getGroupId() ) )
-                 .append( "\n    o ArtifactID:  ").append( maybeFlag( e.getArtifactId() ) )
-                 .append( "\n    o Version:     ").append( maybeFlag( e.getVersion() ) )
-                 .append( "\n    o Type:        ").append( maybeFlag( e.getType() ) )
-                 .append( "\n" );
-        
+            .append( "This artifact might be in your project's POM, " )
+            .append( "or it might have been included transitively during the resolution process. " )
+            .append( "Here is the information we do have for this artifact:\n" )
+            .append( "\n    o GroupID:     " ).append( maybeFlag( e.getGroupId() ) )
+            .append( "\n    o ArtifactID:  " ).append( maybeFlag( e.getArtifactId() ) )
+            .append( "\n    o Version:     " ).append( maybeFlag( e.getVersion() ) )
+            .append( "\n    o Type:        " ).append( maybeFlag( e.getType() ) )
+            .append( "\n" );
+
         return diagnosis.toString();
     }
 
     private String maybeFlag( String value )
     {
-        if( value == null || value.trim().length() < 1 )
+        if ( value == null || value.trim().length() < 1 )
         {
             return "<<< MISSING >>>";
         }

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoExecutionExceptionDiagnoser.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoExecutionExceptionDiagnoser.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoExecutionExceptionDiagnoser.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoExecutionExceptionDiagnoser.java Thu Oct 13 11:49:19 2005
@@ -1,5 +1,21 @@
 package org.apache.maven.usability;
 
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.usability.diagnostics.DiagnosisUtils;
 import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
@@ -15,12 +31,13 @@
 
     public String diagnose( Throwable error )
     {
-        MojoExecutionException mee = (MojoExecutionException) DiagnosisUtils.getFromCausality( error, MojoExecutionException.class );
-        
+        MojoExecutionException mee =
+            (MojoExecutionException) DiagnosisUtils.getFromCausality( error, MojoExecutionException.class );
+
         StringBuffer message = new StringBuffer();
-        
+
         message.append( "Error executing mojo" );
-        
+
         Object source = mee.getSource();
         if ( source != null )
         {
@@ -30,24 +47,15 @@
         {
             message.append( ".\n" );
         }
-        
-        message.append( "\nMessage: " ).append( mee.getMessage() );
-        
+
+        message.append( "\n" ).append( mee.getMessage() );
+
         String longMessage = mee.getLongMessage();
         if ( longMessage != null )
         {
             message.append( "\n\n" ).append( longMessage );
         }
-        
-        Throwable root = DiagnosisUtils.getRootCause( mee );
-        
-        if ( root != null && root != mee )
-        {
-            message.append( "\n\nRoot Cause: " ).append( root.getMessage() );
-        }
-        
-        message.append( "\n\n" );
-        
+
         return message.toString();
     }
 

Added: maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java?rev=320869&view=auto
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java (added)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java Thu Oct 13 11:49:19 2005
@@ -0,0 +1,60 @@
+package org.apache.maven.usability;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.usability.diagnostics.DiagnosisUtils;
+import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
+
+public class MojoFailureExceptionDiagnoser
+    implements ErrorDiagnoser
+{
+
+    public boolean canDiagnose( Throwable error )
+    {
+        return DiagnosisUtils.containsInCausality( error, MojoFailureExceptionDiagnoser.class );
+    }
+
+    public String diagnose( Throwable error )
+    {
+        MojoFailureException mfe =
+            (MojoFailureException) DiagnosisUtils.getFromCausality( error, MojoFailureException.class );
+
+        StringBuffer message = new StringBuffer();
+
+        Object source = mfe.getSource();
+        if ( source != null )
+        {
+            message.append( ": " ).append( mfe.getSource() ).append( "\n" );
+        }
+        else
+        {
+            message.append( ".\n" );
+        }
+
+        message.append( "\n" ).append( mfe.getMessage() );
+
+        String longMessage = mfe.getLongMessage();
+        if ( longMessage != null )
+        {
+            message.append( "\n\n" ).append( longMessage );
+        }
+
+        return message.toString();
+    }
+
+}

Propchange: maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProfileActivationDiagnoser.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProfileActivationDiagnoser.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProfileActivationDiagnoser.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProfileActivationDiagnoser.java Thu Oct 13 11:49:19 2005
@@ -1,5 +1,21 @@
 package org.apache.maven.usability;
 
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 import org.apache.maven.profiles.activation.ProfileActivationException;
 import org.apache.maven.usability.diagnostics.DiagnosisUtils;
 import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
@@ -16,30 +32,25 @@
 
     public String diagnose( Throwable error )
     {
-        ProfileActivationException activationException = (ProfileActivationException) DiagnosisUtils.getFromCausality( error, ProfileActivationException.class );
-        
+        ProfileActivationException activationException =
+            (ProfileActivationException) DiagnosisUtils.getFromCausality( error, ProfileActivationException.class );
+
         StringBuffer messageBuffer = new StringBuffer();
-        
+
         messageBuffer.append( "Error activating profiles." );
         messageBuffer.append( "\n\nReason: " ).append( activationException.getMessage() );
-        
+
         if ( DiagnosisUtils.containsInCausality( activationException, ComponentLookupException.class ) )
         {
-            ComponentLookupException cle = (ComponentLookupException) DiagnosisUtils.getFromCausality( activationException, ComponentLookupException.class );
-            
+            ComponentLookupException cle = (ComponentLookupException) DiagnosisUtils.getFromCausality(
+                activationException, ComponentLookupException.class );
+
             messageBuffer.append( "\n\nThere was a problem retrieving one or more profile activators." );
             messageBuffer.append( "\n" ).append( cle.getMessage() );
         }
-        
-        Throwable root = DiagnosisUtils.getRootCause( error );
-        
-        if ( root != null && root != error )
-        {
-            messageBuffer.append( "\n\nRoot Cause: " ).append( root.getMessage() );
-        }
-        
+
         messageBuffer.append( "\n" );
-        
+
         return messageBuffer.toString();
     }
 

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java Thu Oct 13 11:49:19 2005
@@ -1,5 +1,21 @@
 package org.apache.maven.usability;
 
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 import org.apache.maven.project.InvalidProjectModelException;
 import org.apache.maven.project.ProjectBuildingException;
 import org.apache.maven.project.validation.ModelValidationResult;
@@ -17,39 +33,33 @@
 
     public String diagnose( Throwable error )
     {
-        ProjectBuildingException pbe = (ProjectBuildingException) DiagnosisUtils.getFromCausality( error, ProjectBuildingException.class );
-        
+        ProjectBuildingException pbe =
+            (ProjectBuildingException) DiagnosisUtils.getFromCausality( error, ProjectBuildingException.class );
+
         StringBuffer message = new StringBuffer();
-        
+
         message.append( "Error building POM (may not be this project's POM)." ).append( "\n\n" );
-        
+
         message.append( "\nProject ID: " ).append( pbe.getProjectId() );
-        
+
         if ( pbe instanceof InvalidProjectModelException )
         {
             InvalidProjectModelException ipme = (InvalidProjectModelException) pbe;
-            
+
             message.append( "\nPOM Location: " ).append( ipme.getPomLocation() );
-            
+
             ModelValidationResult result = ipme.getValidationResult();
-            
+
             if ( result != null )
             {
                 message.append( "\nValidation Messages:\n\n" ).append( ipme.getValidationResult().render( "    " ) );
             }
         }
-        
+
         message.append( "\n\n" ).append( "Reason: " ).append( pbe.getMessage() );
-        
-        Throwable t = DiagnosisUtils.getRootCause( error );
-        
-        if ( t != null && t != pbe )
-        {
-            message.append( "\n" ).append( "Root Cause: " ).append( t.getMessage() );
-        }
-        
+
         message.append( "\n\n" );
-        
+
         return message.toString();
     }
 

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/SystemWarnings.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/SystemWarnings.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/SystemWarnings.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/SystemWarnings.java Thu Oct 13 11:49:19 2005
@@ -1,4 +1,18 @@
-package org.apache.maven.usability;
+package org.apache.maven.usability;/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 public class SystemWarnings
 {
@@ -6,7 +20,7 @@
     public static String getOfflineWarning()
     {
         return "\nNOTE: Maven is executing in offline mode. Any artifacts not already in your local\n" +
-                "repository will be inaccessible.\n";
+            "repository will be inaccessible.\n";
     }
-    
+
 }

Modified: maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml (original)
+++ maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml Thu Oct 13 11:49:19 2005
@@ -102,6 +102,16 @@
     </component>
     <!--
     |
+    |MojoFailureExceptionDiagnoser
+    |
+    -->
+    <component>
+      <role>org.apache.maven.usability.diagnostics.ErrorDiagnoser</role>
+      <role-hint>MojoFailureExceptionDiagnoser</role-hint>
+      <implementation>org.apache.maven.usability.MojoFailureExceptionDiagnoser</implementation>
+    </component>
+    <!--
+    |
     |ProjectBuildDiagnoser
     |
     -->

Modified: maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnostics.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnostics.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnostics.java (original)
+++ maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnostics.java Thu Oct 13 11:49:19 2005
@@ -33,31 +33,31 @@
     implements Contextualizable
 {
     public static final String ROLE = ErrorDiagnostics.class.getName();
-    
+
     private PlexusContainer container;
 
     private List errorDiagnosers;
-    
+
     public void setErrorDiagnosers( List errorDiagnosers )
     {
         this.errorDiagnosers = errorDiagnosers;
     }
-    
+
     public String diagnose( Throwable error )
     {
         List diags = errorDiagnosers;
-        
+
         boolean releaseDiags = false;
         boolean errorProcessed = false;
-        
+
         String message = null;
-        
+
         try
         {
             if ( diags == null )
             {
                 releaseDiags = true;
-                
+
                 try
                 {
                     diags = container.lookupList( ErrorDiagnoser.ROLE );
@@ -67,7 +67,7 @@
                     getLogger().error( "Failed to lookup the list of error diagnosers.", e );
                 }
             }
-            
+
             if ( diags != null )
             {
                 for ( Iterator it = diags.iterator(); it.hasNext(); )
@@ -98,23 +98,24 @@
                     getLogger().debug( "Failed to release error diagnoser list.", e );
                 }
             }
-            
+
             if ( !errorProcessed )
             {
                 message = new PuntErrorDiagnoser().diagnose( error );
             }
         }
-        
+
         return message;
     }
-    
+
     public void contextualize( Context context )
         throws ContextException
     {
         this.container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
     }
-    
-    private static class PuntErrorDiagnoser implements ErrorDiagnoser
+
+    private static class PuntErrorDiagnoser
+        implements ErrorDiagnoser
     {
 
         public boolean canDiagnose( Throwable error )
@@ -125,21 +126,11 @@
         public String diagnose( Throwable error )
         {
             StringBuffer message = new StringBuffer();
-            
-            message.append( "Error: " ).append( error.getClass().getName() );
-            message.append( "\nMessage: " ).append( error.getMessage() );
-            
-            Throwable root = DiagnosisUtils.getRootCause( error );
-            
-            if ( root != null && root != error )
-            {
-                message.append( "\n\nRoot Cause\n\n" );
-                message.append( "Error: " ).append( root.getClass().getName() );
-                message.append( "\nMessage: " ).append( root.getMessage() );
-            }
-            
+
+            message.append( error.getMessage() );
+
             return message.toString();
         }
-        
+
     }
 }

Modified: maven/components/trunk/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java Thu Oct 13 11:49:19 2005
@@ -156,8 +156,7 @@
         }
         catch ( ArtifactDeploymentException e )
         {
-            throw new MojoExecutionException(
-                "Error deploying artifact '" + artifact.getDependencyConflictId() + "': " + e.getMessage(), e );
+            throw new MojoExecutionException( e.getMessage(), e );
         }
     }
 }

Modified: maven/components/trunk/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java Thu Oct 13 11:49:19 2005
@@ -125,8 +125,7 @@
         }
         catch ( ArtifactInstallationException e )
         {
-            throw new MojoExecutionException(
-                "Error installing artifact '" + artifact.getDependencyConflictId() + "': " + e.getMessage(), e );
+            throw new MojoExecutionException( e.getMessage(), e );
         }
     }
 }

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=320869&r1=320868&r2=320869&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java Thu Oct 13 11:49:19 2005
@@ -472,7 +472,7 @@
 
     private Model createStubModel( Artifact projectArtifact )
     {
-        getLogger().warn( "\n  ***** Using defaults for missing POM " + projectArtifact + " *****\n" );
+        getLogger().debug( "Using defaults for missing POM " + projectArtifact );
 
         Model model = new Model();
         model.setModelVersion( "4.0.0" );



Re: exception handling

Posted by John Casey <jd...@commonjava.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I only have 2 real problems here:

1. MojoExecutionException, which is meant to be a wrapper for some
unknown exception. This could be anything, and we REALLY cannot
guarantee that it's root cause is expressed in the top-level exception's
message, unless we're digging to root cause inside that exception (not
easy, given the restrictions on where you can call super(..)).

2. Unknown exceptions, which haven't been vetted as thoroughly as all
that. This could be from API changes to upstream components like SCM,
wagon, or plexus; or, it could be from new exceptions added to the maven
~ API without as thorough an examination as you apparently did.

In the first case, we simply need to push as far down as we can into the
exception stack and pull out the bottom exception. It would also
probably be worth pulling out the next-level (1 down from the top)
message and displaying that, just in case someone threw in useful
information at that level. Printing the error message thrown by the mojo
developer seems like we're putting too much faith in plugin developers
to produce accurate, thoughtful error messages. I'd say, pull
first-level and root-level error messages/types for these.

In the second case, we have an API expansion problem that hasn't had the
attention given to our current API. I agree that this isn't an ideal
situation, but if error diagnosis were in an ideal state, this diagnoser
could output "HELP" and it wouldn't matter; it'd never be seen. This is
the last line of defense for interpreting an unknown error...it should
print out the most useful information in any initial debugging effort:

a. top-level exception class
b. top-level exception message
c. root-level exception class
d. root-level exception message

Obviously, either of these cases will mean that determinedly dense
developers can cut the exception chain and throw a completely new
exception, swallowing the original exception and stack trace. However,
in these cases, we're left guessing at what the real problem is. Users
will be, too, and -X will be the first step in debugging. Why not simply
add a new layer, that attempts to help? If it doesn't help, we're right
back to -X, with no harm done.

Based on your reply, and my reply to that above, I'm putting these
changes back into those two diagnoser classes. If this is still a
problem, we can discuss it more in the morning (.au time).

- -j

Brett Porter wrote:
| I'd planned to summarise what I did here tomorrow as its late...
|
| I very carefully audited every exception in the codebase and ensured
| that the message of each exception always captured any appropriate
| message from the cause. There are no more "shoulder shrugs".
|
| The root simply duplicated all of these (which looked silly), and is
| easily obtained by the trace as you mention (with -e, not -X).
|
| If you want to restore and:
| a) you guarantee it doesn't duplicate the original message (which it did
| even before I did the above audit)
| b) that it actually gets the root cause (f.e., the root cause of
| ArtifactResolutionException was coming back as "Could not get artifact
| from any repositories" instead of the error of ResourceNotFoundException).
|
| I'd appreciate testing on the error reporting. I think what we have now
| is pretty good - can you find a specific example where it is not the case?
|
| - Brett
|
| John Casey wrote:
|
|
|>Why on earth would you remove the root causes from all of these
|>diagnosers?? Particularly the PuntDiagnoser?
|>
|>Often, the root cause is the only thing that makes any sense...the rest
|>is just heaps of string-literal shoulder-shrugs that are too digested to
|>be of any help. If we can't get at the root cause, especially when its
|>hiding behind something like MojoExecutionException, or some otherwise
|>undiagnosed exception (PuntDiagnoser), many problems will be a complete
|>mystery. Not to mention the MNG issues this will reopen...
|>
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
| For additional commands, e-mail: dev-help@maven.apache.org
|
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFDTrVcK3h2CZwO/4URAqM+AKCdmaXzaeo//VvCZ8rnCW9ysVrHzQCdFH/P
kpZZLfQWaF9Bma1Ccc8Pv7E=
=pmwK
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: exception handling

Posted by John Casey <jd...@commonjava.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

What about component config errors in the plugin handling? I'll put it
back for artifact resolution too. I've done the MojoExecutionException
and the default diagnoser, and I'm checking that the main error message
doesn't include the root's message.

- -j

Brett Porter wrote:
| ... of course, I only did m2, not wagon.
|
| I'd suggest restoring the root cause for the
| ArtifactResolutionException, but make sure it grabs the IOException (I
| saw the 503 on the clean checkout), and don't display it if the main
| message contains that message.
|
| - Brett
|
| Brett Porter wrote:
|
|
|>I'd planned to summarise what I did here tomorrow as its late...
|>
|>I very carefully audited every exception in the codebase and ensured
|>that the message of each exception always captured any appropriate
|>message from the cause. There are no more "shoulder shrugs".
|>
|>The root simply duplicated all of these (which looked silly), and is
|>easily obtained by the trace as you mention (with -e, not -X).
|>
|>If you want to restore and:
|>a) you guarantee it doesn't duplicate the original message (which it did
|>even before I did the above audit)
|>b) that it actually gets the root cause (f.e., the root cause of
|>ArtifactResolutionException was coming back as "Could not get artifact
|
|>from any repositories" instead of the error of ResourceNotFoundException).
|
|>I'd appreciate testing on the error reporting. I think what we have now
|>is pretty good - can you find a specific example where it is not the case?
|>
|>- Brett
|>
|>John Casey wrote:
|>
|>
|>
|>
|>>Why on earth would you remove the root causes from all of these
|>>diagnosers?? Particularly the PuntDiagnoser?
|>>
|>>Often, the root cause is the only thing that makes any sense...the rest
|>>is just heaps of string-literal shoulder-shrugs that are too digested to
|>>be of any help. If we can't get at the root cause, especially when its
|>>hiding behind something like MojoExecutionException, or some otherwise
|>>undiagnosed exception (PuntDiagnoser), many problems will be a complete
|>>mystery. Not to mention the MNG issues this will reopen...
|>>
|>>
|>>
|>
|>---------------------------------------------------------------------
|>To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
|>For additional commands, e-mail: dev-help@maven.apache.org
|>
|>
|>
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
| For additional commands, e-mail: dev-help@maven.apache.org
|
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFDTsTCK3h2CZwO/4URAhH+AJ4gJ1odYr9C14/cVIHbr5Pqy08U1QCfWWgT
Yh8CpyzVbulhqHqQCMhRLxc=
=rI1X
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: exception handling

Posted by Brett Porter <br...@apache.org>.
... of course, I only did m2, not wagon.

I'd suggest restoring the root cause for the
ArtifactResolutionException, but make sure it grabs the IOException (I
saw the 503 on the clean checkout), and don't display it if the main
message contains that message.

- Brett

Brett Porter wrote:

>I'd planned to summarise what I did here tomorrow as its late...
>
>I very carefully audited every exception in the codebase and ensured
>that the message of each exception always captured any appropriate
>message from the cause. There are no more "shoulder shrugs".
>
>The root simply duplicated all of these (which looked silly), and is
>easily obtained by the trace as you mention (with -e, not -X).
>
>If you want to restore and:
>a) you guarantee it doesn't duplicate the original message (which it did
>even before I did the above audit)
>b) that it actually gets the root cause (f.e., the root cause of
>ArtifactResolutionException was coming back as "Could not get artifact
>from any repositories" instead of the error of ResourceNotFoundException).
>
>I'd appreciate testing on the error reporting. I think what we have now
>is pretty good - can you find a specific example where it is not the case?
>
>- Brett
>
>John Casey wrote:
>
>  
>
>>Why on earth would you remove the root causes from all of these
>>diagnosers?? Particularly the PuntDiagnoser?
>>
>>Often, the root cause is the only thing that makes any sense...the rest
>>is just heaps of string-literal shoulder-shrugs that are too digested to
>>be of any help. If we can't get at the root cause, especially when its
>>hiding behind something like MojoExecutionException, or some otherwise
>>undiagnosed exception (PuntDiagnoser), many problems will be a complete
>>mystery. Not to mention the MNG issues this will reopen...
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>For additional commands, e-mail: dev-help@maven.apache.org
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: exception handling

Posted by Brett Porter <br...@apache.org>.
I'd planned to summarise what I did here tomorrow as its late...

I very carefully audited every exception in the codebase and ensured
that the message of each exception always captured any appropriate
message from the cause. There are no more "shoulder shrugs".

The root simply duplicated all of these (which looked silly), and is
easily obtained by the trace as you mention (with -e, not -X).

If you want to restore and:
a) you guarantee it doesn't duplicate the original message (which it did
even before I did the above audit)
b) that it actually gets the root cause (f.e., the root cause of
ArtifactResolutionException was coming back as "Could not get artifact
from any repositories" instead of the error of ResourceNotFoundException).

I'd appreciate testing on the error reporting. I think what we have now
is pretty good - can you find a specific example where it is not the case?

- Brett

John Casey wrote:

> Why on earth would you remove the root causes from all of these
> diagnosers?? Particularly the PuntDiagnoser?
>
> Often, the root cause is the only thing that makes any sense...the rest
> is just heaps of string-literal shoulder-shrugs that are too digested to
> be of any help. If we can't get at the root cause, especially when its
> hiding behind something like MojoExecutionException, or some otherwise
> undiagnosed exception (PuntDiagnoser), many problems will be a complete
> mystery. Not to mention the MNG issues this will reopen...
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r320869 - in /maven/components/trunk: maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/ maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/ maven-artifact/src/main/java/org/apache/maven/artifact/r...

Posted by John Casey <jd...@commonjava.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Why on earth would you remove the root causes from all of these
diagnosers?? Particularly the PuntDiagnoser?

Often, the root cause is the only thing that makes any sense...the rest
is just heaps of string-literal shoulder-shrugs that are too digested to
be of any help. If we can't get at the root cause, especially when its
hiding behind something like MojoExecutionException, or some otherwise
undiagnosed exception (PuntDiagnoser), many problems will be a complete
mystery. Not to mention the MNG issues this will reopen...

- -john

brett@apache.org wrote:
| Author: brett
| Date: Thu Oct 13 11:49:19 2005
| New Revision: 320869
|
| URL: http://svn.apache.org/viewcvs?rev=320869&view=rev
| Log:
| more error diagnostics improvements
|
| Added:
|
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java
   (with props)
| Modified:
|
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
|
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/DefaultArtifactTransformationManager.java
|
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/LatestArtifactTransformation.java
|
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/ReleaseArtifactTransformation.java
|
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java
|
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactNotFoundException.java
|
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/transform/ArtifactTransformation.java
|
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/transform/ArtifactTransformationManager.java
|
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java
|
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
|
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java
|
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java
|
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactResolverDiagnoser.java
|
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/InvalidArtifactDiagnoser.java
|
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoExecutionExceptionDiagnoser.java
|
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProfileActivationDiagnoser.java
|
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java
|
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/SystemWarnings.java
|
maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml
|
maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnostics.java
|
maven/components/trunk/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java
|
maven/components/trunk/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
|
maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
|
| Modified:
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
(original)
| +++
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
Thu Oct 13 11:49:19 2005
| @@ -133,7 +133,7 @@
|          }
|          catch ( UnsupportedProtocolException e )
|          {
| -            throw new TransferFailedException( "Unsupported Protocol:
", e );
| +            throw new TransferFailedException( "Unsupported Protocol:
'" + protocol + "': " + e.getMessage(), e );
|          }
|
|          if ( downloadMonitor != null )
| @@ -156,7 +156,7 @@
|          }
|          catch ( NoSuchAlgorithmException e )
|          {
| -            throw new TransferFailedException( "Unable to add
checksum methods", e );
| +            throw new TransferFailedException( "Unable to add
checksum methods: " + e.getMessage(), e );
|          }
|
|          try
| @@ -204,23 +204,23 @@
|          }
|          catch ( ConnectionException e )
|          {
| -            throw new TransferFailedException( "Connection failed: ",
e );
| +            throw new TransferFailedException( "Connection failed: "
+ e.getMessage(), e );
|          }
|          catch ( AuthenticationException e )
|          {
| -            throw new TransferFailedException( "Authentication
failed: ", e );
| +            throw new TransferFailedException( "Authentication
failed: " + e.getMessage(), e );
|          }
|          catch ( AuthorizationException e )
|          {
| -            throw new TransferFailedException( "Authorization failed:
", e );
| +            throw new TransferFailedException( "Authorization failed:
" + e.getMessage(), e );
|          }
|          catch ( ResourceDoesNotExistException e )
|          {
| -            throw new TransferFailedException( "Resource to deploy
not found: ", e );
| +            throw new TransferFailedException( "Resource to deploy
not found: " + e.getMessage(), e );
|          }
|          catch ( IOException e )
|          {
| -            throw new TransferFailedException( "Error creating
temporary file for deployment: ", e );
| +            throw new TransferFailedException( "Error creating
temporary file for deployment: " + e.getMessage(), e );
|          }
|          finally
|          {
| @@ -320,7 +320,7 @@
|          }
|          catch ( UnsupportedProtocolException e )
|          {
| -            throw new TransferFailedException( "Unsupported Protocol:
", e );
| +            throw new TransferFailedException( "Unsupported Protocol:
'" + protocol + "': " + e.getMessage(), e );
|          }
|
|          if ( downloadMonitor != null )
| @@ -341,7 +341,7 @@
|          }
|          catch ( NoSuchAlgorithmException e )
|          {
| -            throw new TransferFailedException( "Unable to add
checksum methods", e );
| +            throw new TransferFailedException( "Unable to add
checksum methods: " + e.getMessage(), e );
|          }
|
|          File temp = new File( destination + ".tmp" );
| @@ -436,15 +436,15 @@
|          }
|          catch ( ConnectionException e )
|          {
| -            throw new TransferFailedException( "Connection failed: ",
e );
| +            throw new TransferFailedException( "Connection failed: "
+ e.getMessage(), e );
|          }
|          catch ( AuthenticationException e )
|          {
| -            throw new TransferFailedException( "Authentication
failed: ", e );
| +            throw new TransferFailedException( "Authentication
failed: " + e.getMessage(), e );
|          }
|          catch ( AuthorizationException e )
|          {
| -            throw new TransferFailedException( "Authorization failed:
", e );
| +            throw new TransferFailedException( "Authorization failed:
" + e.getMessage(), e );
|          }
|          finally
|          {
| @@ -474,7 +474,8 @@
|              }
|              catch ( IOException e )
|              {
| -                throw new TransferFailedException( "Error copying
temporary file to the final destination: ", e );
| +                throw new TransferFailedException(
| +                    "Error copying temporary file to the final
destination: " + e.getMessage(), e );
|              }
|          }
|      }
|
| Modified:
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/DefaultArtifactTransformationManager.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/DefaultArtifactTransformationManager.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/DefaultArtifactTransformationManager.java
(original)
| +++
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/DefaultArtifactTransformationManager.java
Thu Oct 13 11:49:19 2005
| @@ -20,6 +20,7 @@
|  import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
|  import org.apache.maven.artifact.installer.ArtifactInstallationException;
|  import org.apache.maven.artifact.repository.ArtifactRepository;
| +import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|  import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
|  import java.util.Iterator;
| @@ -31,7 +32,7 @@
|      private List artifactTransformations;
|
|      public void transformForResolve( Artifact artifact, List
remoteRepositories, ArtifactRepository localRepository )
| -        throws ArtifactResolutionException
| +        throws ArtifactResolutionException, ArtifactNotFoundException
|      {
|          for ( Iterator i = artifactTransformations.iterator();
i.hasNext(); )
|          {
|
| Modified:
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/LatestArtifactTransformation.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/LatestArtifactTransformation.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/LatestArtifactTransformation.java
(original)
| +++
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/LatestArtifactTransformation.java
Thu Oct 13 11:49:19 2005
| @@ -20,6 +20,7 @@
|  import org.apache.maven.artifact.repository.ArtifactRepository;
|  import
org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException;
|  import org.apache.maven.artifact.repository.metadata.Versioning;
| +import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|  import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
|  import java.util.List;
| @@ -28,7 +29,7 @@
|      extends AbstractVersionTransformation
|  {
|      public void transformForResolve( Artifact artifact, List
remoteRepositories, ArtifactRepository localRepository )
| -        throws ArtifactResolutionException
| +        throws ArtifactResolutionException, ArtifactNotFoundException
|      {
|          if ( Artifact.LATEST_VERSION.equals( artifact.getVersion() ) )
|          {
| @@ -37,7 +38,7 @@
|                  String version = resolveVersion( artifact,
localRepository, remoteRepositories );
|                  if ( Artifact.LATEST_VERSION.equals( version ) )
|                  {
| -                    throw new ArtifactResolutionException( "Unable to
determine the latest version", artifact );
| +                    throw new ArtifactNotFoundException( "Unable to
determine the latest version", artifact );
|                  }
|
|                  artifact.setBaseVersion( version );
|
| Modified:
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/ReleaseArtifactTransformation.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/ReleaseArtifactTransformation.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/ReleaseArtifactTransformation.java
(original)
| +++
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/ReleaseArtifactTransformation.java
Thu Oct 13 11:49:19 2005
| @@ -22,6 +22,7 @@
|  import
org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
|  import
org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException;
|  import org.apache.maven.artifact.repository.metadata.Versioning;
| +import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|  import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
|  import java.util.List;
| @@ -36,7 +37,7 @@
|      extends AbstractVersionTransformation
|  {
|      public void transformForResolve( Artifact artifact, List
remoteRepositories, ArtifactRepository localRepository )
| -        throws ArtifactResolutionException
| +        throws ArtifactResolutionException, ArtifactNotFoundException
|      {
|          if ( Artifact.RELEASE_VERSION.equals( artifact.getVersion() ) )
|          {
| @@ -46,7 +47,7 @@
|
|                  if ( Artifact.RELEASE_VERSION.equals( version ) )
|                  {
| -                    throw new ArtifactResolutionException( "Unable to
determine the release version", artifact );
| +                    throw new ArtifactNotFoundException( "Unable to
determine the release version", artifact );
|                  }
|
|                  artifact.setBaseVersion( version );
|
| Modified:
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java
(original)
| +++
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java
Thu Oct 13 11:49:19 2005
| @@ -19,6 +19,7 @@
|  import org.apache.maven.artifact.Artifact;
|  import org.apache.maven.artifact.repository.ArtifactRepository;
|
| +import java.util.HashSet;
|  import java.util.Iterator;
|  import java.util.List;
|
| @@ -161,7 +162,7 @@
|              sb.append( "from the specified remote repositories:" );
|              sb.append( LS + "  " );
|
| -            for ( Iterator i = remoteRepositories.iterator();
i.hasNext(); )
| +            for ( Iterator i = new HashSet( remoteRepositories
).iterator(); i.hasNext(); )
|              {
|                  ArtifactRepository remoteRepository =
(ArtifactRepository) i.next();
|
|
| Modified:
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactNotFoundException.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactNotFoundException.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactNotFoundException.java
(original)
| +++
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactNotFoundException.java
Thu Oct 13 11:49:19 2005
| @@ -29,7 +29,7 @@
|  {
|      private String downloadUrl;
|
| -    protected ArtifactNotFoundException( String message, Artifact
artifact )
| +    public ArtifactNotFoundException( String message, Artifact artifact )
|      {
|          this( message, artifact.getGroupId(),
artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), null,
|                null );
|
| Modified:
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/transform/ArtifactTransformation.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/transform/ArtifactTransformation.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/transform/ArtifactTransformation.java
(original)
| +++
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/transform/ArtifactTransformation.java
Thu Oct 13 11:49:19 2005
| @@ -20,6 +20,7 @@
|  import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
|  import org.apache.maven.artifact.installer.ArtifactInstallationException;
|  import org.apache.maven.artifact.repository.ArtifactRepository;
| +import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|  import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
|  import java.util.List;
| @@ -42,7 +43,7 @@
|       * @param localRepository the local repository
|       */
|      void transformForResolve( Artifact artifact, List
remoteRepositories, ArtifactRepository localRepository )
| -        throws ArtifactResolutionException;
| +        throws ArtifactResolutionException, ArtifactNotFoundException;
|
|      /**
|       * Take in a artifact and return the transformed artifact for
locating in the local repository. If no
|
| Modified:
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/transform/ArtifactTransformationManager.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/transform/ArtifactTransformationManager.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/transform/ArtifactTransformationManager.java
(original)
| +++
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/transform/ArtifactTransformationManager.java
Thu Oct 13 11:49:19 2005
| @@ -20,6 +20,7 @@
|  import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
|  import org.apache.maven.artifact.installer.ArtifactInstallationException;
|  import org.apache.maven.artifact.repository.ArtifactRepository;
| +import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|  import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
|  import java.util.List;
| @@ -40,7 +41,7 @@
|       * @param localRepository the local repository
|       */
|      void transformForResolve( Artifact artifact, List
remoteRepositories, ArtifactRepository localRepository )
| -        throws ArtifactResolutionException;
| +        throws ArtifactResolutionException, ArtifactNotFoundException;
|
|      /**
|       * Take in a artifact and return the transformed artifact for
locating in the local repository. If no
|
| Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java
(original)
| +++
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java
Thu Oct 13 11:49:19 2005
| @@ -17,7 +17,6 @@
|   */
|
|  import org.apache.maven.plugin.descriptor.PluginDescriptor;
| -import org.apache.maven.usability.diagnostics.DiagnosisUtils;
|  import org.apache.maven.usability.plugin.Expression;
|  import
org.apache.maven.usability.plugin.ExpressionDocumentationException;
|  import org.apache.maven.usability.plugin.ExpressionDocumenter;
| @@ -273,11 +272,7 @@
|              addParameterUsageInfo( value, message );
|          }
|
| -        message.append( "Reason: " ).append( cce.getMessage()
).append( "\n" );
| -
| -        Throwable root = DiagnosisUtils.getRootCause( cce );
| -
| -        message.append( "Root Cause: " ).append( root.getMessage()
).append( "\n\n" );
| +        message.append( "\n\nCause: " ).append( cce.getMessage() );
|
|          return message.toString();
|      }
|
| Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
(original)
| +++
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
Thu Oct 13 11:49:19 2005
| @@ -215,8 +215,7 @@
|          // if we still haven't found a version, then fail early
before we get into the update goop.
|          if ( StringUtils.isEmpty( version ) )
|          {
| -            throw new PluginVersionNotFoundException( groupId,
artifactId,
| -                                                      "Failed to
resolve a valid version for this plugin" );
| +            throw new PluginVersionNotFoundException( groupId,
artifactId );
|          }
|
|          // if the plugin registry is inactive, then the rest of this
goop is useless...
|
| Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java
(original)
| +++
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java
Thu Oct 13 11:49:19 2005
| @@ -23,9 +23,9 @@
|
|      private final String artifactId;
|
| -    public PluginVersionNotFoundException( String groupId, String
artifactId, String baseMessage )
| +    public PluginVersionNotFoundException( String groupId, String
artifactId )
|      {
| -        super( "Error resolving version for \'" + groupId + ":" +
artifactId + "\': " + baseMessage );
| +        super( "The plugin \'" + groupId + ":" + artifactId + "\'
does not exist or no valid version could be found" );
|
|          this.groupId = groupId;
|          this.artifactId = artifactId;
|
| Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java
(original)
| +++
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java
Thu Oct 13 11:49:19 2005
| @@ -34,8 +34,8 @@
|
|      public String diagnose( Throwable error )
|      {
| -        ArtifactNotFoundException exception =
(ArtifactNotFoundException) DiagnosisUtils.getFromCausality( error,
| -
                                       ArtifactNotFoundException.class );
| +        ArtifactNotFoundException exception =
| +            (ArtifactNotFoundException)
DiagnosisUtils.getFromCausality( error, ArtifactNotFoundException.class );
|
|          StringBuffer message = new StringBuffer();
|
| @@ -49,13 +49,6 @@
|          if ( !wagonManager.isOnline() )
|          {
|              message.append( "\n" ).append(
SystemWarnings.getOfflineWarning() );
| -        }
| -
| -        Throwable root = DiagnosisUtils.getRootCause( exception );
| -
| -        if ( root != null )
| -        {
| -            message.append( "\nRoot Cause: " ).append(
root.getMessage() );
|          }
|
|          message.append( "\n" );
|
| Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactResolverDiagnoser.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactResolverDiagnoser.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactResolverDiagnoser.java
(original)
| +++
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactResolverDiagnoser.java
Thu Oct 13 11:49:19 2005
| @@ -34,8 +34,8 @@
|
|      public String diagnose( Throwable error )
|      {
| -        ArtifactResolutionException exception =
(ArtifactResolutionException) DiagnosisUtils.getFromCausality( error,
| -

ArtifactResolutionException.class );
| +        ArtifactResolutionException exception =
| +            (ArtifactResolutionException)
DiagnosisUtils.getFromCausality( error, ArtifactResolutionException.class );
|
|          StringBuffer message = new StringBuffer();
|
| @@ -46,13 +46,6 @@
|          if ( !wagonManager.isOnline() )
|          {
|              message.append( "\n" ).append(
SystemWarnings.getOfflineWarning() );
| -        }
| -
| -        Throwable root = DiagnosisUtils.getRootCause( exception );
| -
| -        if ( root != null )
| -        {
| -            message.append( "\nRoot Cause: " ).append(
root.getMessage() );
|          }
|
|          message.append( "\n" );
|
| Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/InvalidArtifactDiagnoser.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/InvalidArtifactDiagnoser.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/InvalidArtifactDiagnoser.java
(original)
| +++
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/InvalidArtifactDiagnoser.java
Thu Oct 13 11:49:19 2005
| @@ -1,8 +1,5 @@
|  package org.apache.maven.usability;
|
| -import org.apache.maven.artifact.InvalidArtifactRTException;
| -import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
| -
|  /*
|   * Copyright 2001-2005 The Apache Software Foundation.
|   *
| @@ -19,6 +16,9 @@
|   * limitations under the License.
|   */
|
| +import org.apache.maven.artifact.InvalidArtifactRTException;
| +import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
| +
|  public class InvalidArtifactDiagnoser
|      implements ErrorDiagnoser
|  {
| @@ -31,25 +31,25 @@
|      public String diagnose( Throwable error )
|      {
|          StringBuffer diagnosis = new StringBuffer();
| -
| +
|          InvalidArtifactRTException e = (InvalidArtifactRTException)
error;
| -
| +
|          diagnosis.append( "An invalid artifact was detected.\n\n" )
| -                 .append( "This artifact might be in your project's
POM, ")
| -                 .append( "or it might have been included
transitively during the resolution process. ")
| -                 .append( "Here is the information we do have for
this artifact:\n")
| -                 .append( "\n    o GroupID:     ").append( maybeFlag(
e.getGroupId() ) )
| -                 .append( "\n    o ArtifactID:  ").append( maybeFlag(
e.getArtifactId() ) )
| -                 .append( "\n    o Version:     ").append( maybeFlag(
e.getVersion() ) )
| -                 .append( "\n    o Type:        ").append( maybeFlag(
e.getType() ) )
| -                 .append( "\n" );
| -
| +            .append( "This artifact might be in your project's POM, " )
| +            .append( "or it might have been included transitively
during the resolution process. " )
| +            .append( "Here is the information we do have for this
artifact:\n" )
| +            .append( "\n    o GroupID:     " ).append( maybeFlag(
e.getGroupId() ) )
| +            .append( "\n    o ArtifactID:  " ).append( maybeFlag(
e.getArtifactId() ) )
| +            .append( "\n    o Version:     " ).append( maybeFlag(
e.getVersion() ) )
| +            .append( "\n    o Type:        " ).append( maybeFlag(
e.getType() ) )
| +            .append( "\n" );
| +
|          return diagnosis.toString();
|      }
|
|      private String maybeFlag( String value )
|      {
| -        if( value == null || value.trim().length() < 1 )
| +        if ( value == null || value.trim().length() < 1 )
|          {
|              return "<<< MISSING >>>";
|          }
|
| Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoExecutionExceptionDiagnoser.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoExecutionExceptionDiagnoser.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoExecutionExceptionDiagnoser.java
(original)
| +++
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoExecutionExceptionDiagnoser.java
Thu Oct 13 11:49:19 2005
| @@ -1,5 +1,21 @@
|  package org.apache.maven.usability;
|
| +/*
| + * Copyright 2001-2005 The Apache Software Foundation.
| + *
| + * Licensed under the Apache License, Version 2.0 (the "License");
| + * you may not use this file except in compliance with the License.
| + * You may obtain a copy of the License at
| + *
| + *      http://www.apache.org/licenses/LICENSE-2.0
| + *
| + * Unless required by applicable law or agreed to in writing, software
| + * distributed under the License is distributed on an "AS IS" BASIS,
| + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
| + * See the License for the specific language governing permissions and
| + * limitations under the License.
| + */
| +
|  import org.apache.maven.plugin.MojoExecutionException;
|  import org.apache.maven.usability.diagnostics.DiagnosisUtils;
|  import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
| @@ -15,12 +31,13 @@
|
|      public String diagnose( Throwable error )
|      {
| -        MojoExecutionException mee = (MojoExecutionException)
DiagnosisUtils.getFromCausality( error, MojoExecutionException.class );
| -
| +        MojoExecutionException mee =
| +            (MojoExecutionException) DiagnosisUtils.getFromCausality(
error, MojoExecutionException.class );
| +
|          StringBuffer message = new StringBuffer();
| -
| +
|          message.append( "Error executing mojo" );
| -
| +
|          Object source = mee.getSource();
|          if ( source != null )
|          {
| @@ -30,24 +47,15 @@
|          {
|              message.append( ".\n" );
|          }
| -
| -        message.append( "\nMessage: " ).append( mee.getMessage() );
| -
| +
| +        message.append( "\n" ).append( mee.getMessage() );
| +
|          String longMessage = mee.getLongMessage();
|          if ( longMessage != null )
|          {
|              message.append( "\n\n" ).append( longMessage );
|          }
| -
| -        Throwable root = DiagnosisUtils.getRootCause( mee );
| -
| -        if ( root != null && root != mee )
| -        {
| -            message.append( "\n\nRoot Cause: " ).append(
root.getMessage() );
| -        }
| -
| -        message.append( "\n\n" );
| -
| +
|          return message.toString();
|      }
|
|
| Added:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java?rev=320869&view=auto
|
==============================================================================
| ---
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java
(added)
| +++
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java
Thu Oct 13 11:49:19 2005
| @@ -0,0 +1,60 @@
| +package org.apache.maven.usability;
| +
| +/*
| + * Copyright 2001-2005 The Apache Software Foundation.
| + *
| + * Licensed under the Apache License, Version 2.0 (the "License");
| + * you may not use this file except in compliance with the License.
| + * You may obtain a copy of the License at
| + *
| + *      http://www.apache.org/licenses/LICENSE-2.0
| + *
| + * Unless required by applicable law or agreed to in writing, software
| + * distributed under the License is distributed on an "AS IS" BASIS,
| + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
| + * See the License for the specific language governing permissions and
| + * limitations under the License.
| + */
| +
| +import org.apache.maven.plugin.MojoFailureException;
| +import org.apache.maven.usability.diagnostics.DiagnosisUtils;
| +import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
| +
| +public class MojoFailureExceptionDiagnoser
| +    implements ErrorDiagnoser
| +{
| +
| +    public boolean canDiagnose( Throwable error )
| +    {
| +        return DiagnosisUtils.containsInCausality( error,
MojoFailureExceptionDiagnoser.class );
| +    }
| +
| +    public String diagnose( Throwable error )
| +    {
| +        MojoFailureException mfe =
| +            (MojoFailureException) DiagnosisUtils.getFromCausality(
error, MojoFailureException.class );
| +
| +        StringBuffer message = new StringBuffer();
| +
| +        Object source = mfe.getSource();
| +        if ( source != null )
| +        {
| +            message.append( ": " ).append( mfe.getSource() ).append(
"\n" );
| +        }
| +        else
| +        {
| +            message.append( ".\n" );
| +        }
| +
| +        message.append( "\n" ).append( mfe.getMessage() );
| +
| +        String longMessage = mfe.getLongMessage();
| +        if ( longMessage != null )
| +        {
| +            message.append( "\n\n" ).append( longMessage );
| +        }
| +
| +        return message.toString();
| +    }
| +
| +}
|
| Propchange:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java
|
- 
------------------------------------------------------------------------------
|     svn:eol-style = native
|
| Propchange:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java
|
- 
------------------------------------------------------------------------------
|     svn:keywords = Author Date Id Revision
|
| Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProfileActivationDiagnoser.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProfileActivationDiagnoser.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProfileActivationDiagnoser.java
(original)
| +++
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProfileActivationDiagnoser.java
Thu Oct 13 11:49:19 2005
| @@ -1,5 +1,21 @@
|  package org.apache.maven.usability;
|
| +/*
| + * Copyright 2001-2005 The Apache Software Foundation.
| + *
| + * Licensed under the Apache License, Version 2.0 (the "License");
| + * you may not use this file except in compliance with the License.
| + * You may obtain a copy of the License at
| + *
| + *      http://www.apache.org/licenses/LICENSE-2.0
| + *
| + * Unless required by applicable law or agreed to in writing, software
| + * distributed under the License is distributed on an "AS IS" BASIS,
| + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
| + * See the License for the specific language governing permissions and
| + * limitations under the License.
| + */
| +
|  import org.apache.maven.profiles.activation.ProfileActivationException;
|  import org.apache.maven.usability.diagnostics.DiagnosisUtils;
|  import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
| @@ -16,30 +32,25 @@
|
|      public String diagnose( Throwable error )
|      {
| -        ProfileActivationException activationException =
(ProfileActivationException) DiagnosisUtils.getFromCausality( error,
ProfileActivationException.class );
| -
| +        ProfileActivationException activationException =
| +            (ProfileActivationException)
DiagnosisUtils.getFromCausality( error, ProfileActivationException.class );
| +
|          StringBuffer messageBuffer = new StringBuffer();
| -
| +
|          messageBuffer.append( "Error activating profiles." );
|          messageBuffer.append( "\n\nReason: " ).append(
activationException.getMessage() );
| -
| +
|          if ( DiagnosisUtils.containsInCausality( activationException,
ComponentLookupException.class ) )
|          {
| -            ComponentLookupException cle = (ComponentLookupException)
DiagnosisUtils.getFromCausality( activationException,
ComponentLookupException.class );
| -
| +            ComponentLookupException cle = (ComponentLookupException)
DiagnosisUtils.getFromCausality(
| +                activationException, ComponentLookupException.class );
| +
|              messageBuffer.append( "\n\nThere was a problem retrieving
one or more profile activators." );
|              messageBuffer.append( "\n" ).append( cle.getMessage() );
|          }
| -
| -        Throwable root = DiagnosisUtils.getRootCause( error );
| -
| -        if ( root != null && root != error )
| -        {
| -            messageBuffer.append( "\n\nRoot Cause: " ).append(
root.getMessage() );
| -        }
| -
| +
|          messageBuffer.append( "\n" );
| -
| +
|          return messageBuffer.toString();
|      }
|
|
| Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java
(original)
| +++
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java
Thu Oct 13 11:49:19 2005
| @@ -1,5 +1,21 @@
|  package org.apache.maven.usability;
|
| +/*
| + * Copyright 2001-2005 The Apache Software Foundation.
| + *
| + * Licensed under the Apache License, Version 2.0 (the "License");
| + * you may not use this file except in compliance with the License.
| + * You may obtain a copy of the License at
| + *
| + *      http://www.apache.org/licenses/LICENSE-2.0
| + *
| + * Unless required by applicable law or agreed to in writing, software
| + * distributed under the License is distributed on an "AS IS" BASIS,
| + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
| + * See the License for the specific language governing permissions and
| + * limitations under the License.
| + */
| +
|  import org.apache.maven.project.InvalidProjectModelException;
|  import org.apache.maven.project.ProjectBuildingException;
|  import org.apache.maven.project.validation.ModelValidationResult;
| @@ -17,39 +33,33 @@
|
|      public String diagnose( Throwable error )
|      {
| -        ProjectBuildingException pbe = (ProjectBuildingException)
DiagnosisUtils.getFromCausality( error, ProjectBuildingException.class );
| -
| +        ProjectBuildingException pbe =
| +            (ProjectBuildingException)
DiagnosisUtils.getFromCausality( error, ProjectBuildingException.class );
| +
|          StringBuffer message = new StringBuffer();
| -
| +
|          message.append( "Error building POM (may not be this
project's POM)." ).append( "\n\n" );
| -
| +
|          message.append( "\nProject ID: " ).append( pbe.getProjectId() );
| -
| +
|          if ( pbe instanceof InvalidProjectModelException )
|          {
|              InvalidProjectModelException ipme =
(InvalidProjectModelException) pbe;
| -
| +
|              message.append( "\nPOM Location: " ).append(
ipme.getPomLocation() );
| -
| +
|              ModelValidationResult result = ipme.getValidationResult();
| -
| +
|              if ( result != null )
|              {
|                  message.append( "\nValidation Messages:\n\n"
).append( ipme.getValidationResult().render( "    " ) );
|              }
|          }
| -
| +
|          message.append( "\n\n" ).append( "Reason: " ).append(
pbe.getMessage() );
| -
| -        Throwable t = DiagnosisUtils.getRootCause( error );
| -
| -        if ( t != null && t != pbe )
| -        {
| -            message.append( "\n" ).append( "Root Cause: " ).append(
t.getMessage() );
| -        }
| -
| +
|          message.append( "\n\n" );
| -
| +
|          return message.toString();
|      }
|
|
| Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/SystemWarnings.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/SystemWarnings.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/SystemWarnings.java
(original)
| +++
maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/SystemWarnings.java
Thu Oct 13 11:49:19 2005
| @@ -1,4 +1,18 @@
| -package org.apache.maven.usability;
| +package org.apache.maven.usability;/*
| + * Copyright 2001-2005 The Apache Software Foundation.
| + *
| + * Licensed under the Apache License, Version 2.0 (the "License");
| + * you may not use this file except in compliance with the License.
| + * You may obtain a copy of the License at
| + *
| + *      http://www.apache.org/licenses/LICENSE-2.0
| + *
| + * Unless required by applicable law or agreed to in writing, software
| + * distributed under the License is distributed on an "AS IS" BASIS,
| + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
| + * See the License for the specific language governing permissions and
| + * limitations under the License.
| + */
|
|  public class SystemWarnings
|  {
| @@ -6,7 +20,7 @@
|      public static String getOfflineWarning()
|      {
|          return "\nNOTE: Maven is executing in offline mode. Any
artifacts not already in your local\n" +
| -                "repository will be inaccessible.\n";
| +            "repository will be inaccessible.\n";
|      }
| -
| +
|  }
|
| Modified:
maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml
(original)
| +++
maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml
Thu Oct 13 11:49:19 2005
| @@ -102,6 +102,16 @@
|      </component>
|      <!--
|      |
| +    |MojoFailureExceptionDiagnoser
| +    |
| +    -->
| +    <component>
| +      <role>org.apache.maven.usability.diagnostics.ErrorDiagnoser</role>
| +      <role-hint>MojoFailureExceptionDiagnoser</role-hint>
| +
<implementation>org.apache.maven.usability.MojoFailureExceptionDiagnoser</implementation>
| +    </component>
| +    <!--
| +    |
|      |ProjectBuildDiagnoser
|      |
|      -->
|
| Modified:
maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnostics.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnostics.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnostics.java
(original)
| +++
maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnostics.java
Thu Oct 13 11:49:19 2005
| @@ -33,31 +33,31 @@
|      implements Contextualizable
|  {
|      public static final String ROLE = ErrorDiagnostics.class.getName();
| -
| +
|      private PlexusContainer container;
|
|      private List errorDiagnosers;
| -
| +
|      public void setErrorDiagnosers( List errorDiagnosers )
|      {
|          this.errorDiagnosers = errorDiagnosers;
|      }
| -
| +
|      public String diagnose( Throwable error )
|      {
|          List diags = errorDiagnosers;
| -
| +
|          boolean releaseDiags = false;
|          boolean errorProcessed = false;
| -
| +
|          String message = null;
| -
| +
|          try
|          {
|              if ( diags == null )
|              {
|                  releaseDiags = true;
| -
| +
|                  try
|                  {
|                      diags = container.lookupList( ErrorDiagnoser.ROLE );
| @@ -67,7 +67,7 @@
|                      getLogger().error( "Failed to lookup the list of
error diagnosers.", e );
|                  }
|              }
| -
| +
|              if ( diags != null )
|              {
|                  for ( Iterator it = diags.iterator(); it.hasNext(); )
| @@ -98,23 +98,24 @@
|                      getLogger().debug( "Failed to release error
diagnoser list.", e );
|                  }
|              }
| -
| +
|              if ( !errorProcessed )
|              {
|                  message = new PuntErrorDiagnoser().diagnose( error );
|              }
|          }
| -
| +
|          return message;
|      }
| -
| +
|      public void contextualize( Context context )
|          throws ContextException
|      {
|          this.container = (PlexusContainer) context.get(
PlexusConstants.PLEXUS_KEY );
|      }
| -
| -    private static class PuntErrorDiagnoser implements ErrorDiagnoser
| +
| +    private static class PuntErrorDiagnoser
| +        implements ErrorDiagnoser
|      {
|
|          public boolean canDiagnose( Throwable error )
| @@ -125,21 +126,11 @@
|          public String diagnose( Throwable error )
|          {
|              StringBuffer message = new StringBuffer();
| -
| -            message.append( "Error: " ).append(
error.getClass().getName() );
| -            message.append( "\nMessage: " ).append( error.getMessage() );
| -
| -            Throwable root = DiagnosisUtils.getRootCause( error );
| -
| -            if ( root != null && root != error )
| -            {
| -                message.append( "\n\nRoot Cause\n\n" );
| -                message.append( "Error: " ).append(
root.getClass().getName() );
| -                message.append( "\nMessage: " ).append(
root.getMessage() );
| -            }
| -
| +
| +            message.append( error.getMessage() );
| +
|              return message.toString();
|          }
| -
| +
|      }
|  }
|
| Modified:
maven/components/trunk/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java
(original)
| +++
maven/components/trunk/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java
Thu Oct 13 11:49:19 2005
| @@ -156,8 +156,7 @@
|          }
|          catch ( ArtifactDeploymentException e )
|          {
| -            throw new MojoExecutionException(
| -                "Error deploying artifact '" +
artifact.getDependencyConflictId() + "': " + e.getMessage(), e );
| +            throw new MojoExecutionException( e.getMessage(), e );
|          }
|      }
|  }
|
| Modified:
maven/components/trunk/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
(original)
| +++
maven/components/trunk/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
Thu Oct 13 11:49:19 2005
| @@ -125,8 +125,7 @@
|          }
|          catch ( ArtifactInstallationException e )
|          {
| -            throw new MojoExecutionException(
| -                "Error installing artifact '" +
artifact.getDependencyConflictId() + "': " + e.getMessage(), e );
| +            throw new MojoExecutionException( e.getMessage(), e );
|          }
|      }
|  }
|
| Modified:
maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
| URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=320869&r1=320868&r2=320869&view=diff
|
==============================================================================
| ---
maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
(original)
| +++
maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
Thu Oct 13 11:49:19 2005
| @@ -472,7 +472,7 @@
|
|      private Model createStubModel( Artifact projectArtifact )
|      {
| -        getLogger().warn( "\n  ***** Using defaults for missing POM "
+ projectArtifact + " *****\n" );
| +        getLogger().debug( "Using defaults for missing POM " +
projectArtifact );
|
|          Model model = new Model();
|          model.setModelVersion( "4.0.0" );
|
|
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD4DBQFDTq3nK3h2CZwO/4URAnRkAJ4lBVEUNsti9aFJs9hMQHQgF2rWnQCYhotR
Mhl43z8odUJOUvz1YyLCFQ==
=zfDI
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org