more error diagnostics improvements

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@320869 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-10-13 18:49:19 +00:00
parent 937d0d933f
commit 1c7c34f027
24 changed files with 239 additions and 150 deletions

View File

@ -133,7 +133,7 @@ private void putRemoteFile( ArtifactRepository repository, File source, String r
}
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 @@ private void putRemoteFile( ArtifactRepository repository, File source, String r
}
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 @@ private void putRemoteFile( ArtifactRepository repository, File source, String r
}
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 @@ private void getRemoteFile( ArtifactRepository repository, File destination, Str
}
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 @@ private void getRemoteFile( ArtifactRepository repository, File destination, Str
}
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 @@ private void getRemoteFile( ArtifactRepository repository, File destination, Str
}
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 @@ private void getRemoteFile( ArtifactRepository repository, File destination, Str
}
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 );
}
}
}

View File

@ -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 @@ public class DefaultArtifactTransformationManager
private List artifactTransformations;
public void transformForResolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
throws ArtifactResolutionException
throws ArtifactResolutionException, ArtifactNotFoundException
{
for ( Iterator i = artifactTransformations.iterator(); i.hasNext(); )
{

View File

@ -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 @@ public class LatestArtifactTransformation
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 @@ public void transformForResolve( Artifact artifact, List remoteRepositories, Art
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 );

View File

@ -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 @@ public class ReleaseArtifactTransformation
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 @@ public void transformForResolve( Artifact artifact, List remoteRepositories, Art
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 );

View File

@ -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 @@ private static String constructMessageBase( String message, String groupId, Stri
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();

View File

@ -29,7 +29,7 @@ public class ArtifactNotFoundException
{
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 );

View File

@ -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 @@ public interface ArtifactTransformation
* @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

View File

@ -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 @@ public interface ArtifactTransformationManager
* @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

View File

@ -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 @@ public String buildConfigurationDiagnosticMessage( ComponentConfigurationExcepti
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();
}

View File

@ -215,8 +215,7 @@ private String resolvePluginVersion( String groupId, String artifactId, MavenPro
// 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...

View File

@ -23,9 +23,9 @@ public class PluginVersionNotFoundException
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;

View File

@ -34,8 +34,8 @@ public boolean canDiagnose( Throwable error )
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();
@ -51,13 +51,6 @@ public String diagnose( Throwable error )
message.append( "\n" ).append( SystemWarnings.getOfflineWarning() );
}
Throwable root = DiagnosisUtils.getRootCause( exception );
if ( root != null )
{
message.append( "\nRoot Cause: " ).append( root.getMessage() );
}
message.append( "\n" );
return message.toString();

View File

@ -34,8 +34,8 @@ public boolean canDiagnose( Throwable error )
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();
@ -48,13 +48,6 @@ public String diagnose( Throwable error )
message.append( "\n" ).append( SystemWarnings.getOfflineWarning() );
}
Throwable root = DiagnosisUtils.getRootCause( exception );
if ( root != null )
{
message.append( "\nRoot Cause: " ).append( root.getMessage() );
}
message.append( "\n" );
return message.toString();

View File

@ -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 boolean canDiagnose( Throwable error )
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 >>>";
}

View File

@ -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 boolean canDiagnose( Throwable error )
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 @@ public String diagnose( Throwable error )
{
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();
}

View File

@ -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();
}
}

View File

@ -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 boolean canDiagnose( Throwable error )
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();
}

View File

@ -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 boolean canDiagnose( Throwable error )
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();
}

View File

@ -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 class SystemWarnings
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";
}
}

View File

@ -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
|
-->

View File

@ -33,31 +33,31 @@ public class ErrorDiagnostics
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 @@ public String diagnose( Throwable error )
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 @@ public String diagnose( Throwable error )
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 boolean canDiagnose( Throwable error )
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();
}
}
}

View File

@ -156,8 +156,7 @@ public void execute()
}
catch ( ArtifactDeploymentException e )
{
throw new MojoExecutionException(
"Error deploying artifact '" + artifact.getDependencyConflictId() + "': " + e.getMessage(), e );
throw new MojoExecutionException( e.getMessage(), e );
}
}
}

View File

@ -125,8 +125,7 @@ public void execute()
}
catch ( ArtifactInstallationException e )
{
throw new MojoExecutionException(
"Error installing artifact '" + artifact.getDependencyConflictId() + "': " + e.getMessage(), e );
throw new MojoExecutionException( e.getMessage(), e );
}
}
}

View File

@ -472,7 +472,7 @@ private void checkStatusAndUpdate( Artifact projectArtifact, ArtifactStatus stat
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" );