mirror of https://github.com/apache/maven.git
o Polished exceptions
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@780636 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
26a35db0c7
commit
a28e69ee47
|
@ -30,14 +30,29 @@ public class InvalidModelException
|
|||
extends ModelBuildingException
|
||||
{
|
||||
|
||||
/**
|
||||
* The validation result, can be {@code null}.
|
||||
*/
|
||||
private ModelValidationResult validationResult;
|
||||
|
||||
/**
|
||||
* Creates a new exception with specified detail message and validation result.
|
||||
*
|
||||
* @param message The detail message, may be {@code null}.
|
||||
* @param validationResult The validation result, may be {@code null}.
|
||||
*/
|
||||
public InvalidModelException( String message, ModelValidationResult validationResult )
|
||||
{
|
||||
super( message );
|
||||
this.validationResult = validationResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new exception with specified detail message and cause.
|
||||
*
|
||||
* @param message The detail message, may be {@code null}.
|
||||
* @param cause The cause, may be {@code null}.
|
||||
*/
|
||||
public InvalidModelException( String message, Throwable cause )
|
||||
{
|
||||
super( message, cause );
|
||||
|
@ -45,6 +60,11 @@ public class InvalidModelException
|
|||
validationResult.addMessage( ( cause != null ) ? cause.getMessage() : message );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the validation result.
|
||||
*
|
||||
* @return The validation result or {@code null} if unknown.
|
||||
*/
|
||||
public ModelValidationResult getValidationResult()
|
||||
{
|
||||
return validationResult;
|
||||
|
|
|
@ -47,9 +47,9 @@ public class InvalidProfileException
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the profile that causes this error (if any).
|
||||
* Gets the profile that caused this error (if any).
|
||||
*
|
||||
* @return The profile that causes this error or {@code null} if not applicable.
|
||||
* @return The profile that caused this error or {@code null} if not applicable.
|
||||
*/
|
||||
public Profile getProfile()
|
||||
{
|
||||
|
|
|
@ -28,11 +28,22 @@ public class ModelBuildingException
|
|||
extends Exception
|
||||
{
|
||||
|
||||
/**
|
||||
* Creates a new exception with specified detail message.
|
||||
*
|
||||
* @param message The detail message, may be {@code null}.
|
||||
*/
|
||||
public ModelBuildingException( String message )
|
||||
{
|
||||
super( message );
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new exception with specified detail message and cause.
|
||||
*
|
||||
* @param message The detail message, may be {@code null}.
|
||||
* @param cause The cause, may be {@code null}.
|
||||
*/
|
||||
public ModelBuildingException( String message, Throwable cause )
|
||||
{
|
||||
super( message, cause );
|
||||
|
|
|
@ -28,11 +28,22 @@ public class UnresolvableParentException
|
|||
extends ModelBuildingException
|
||||
{
|
||||
|
||||
/**
|
||||
* Creates a new exception with specified detail message and cause.
|
||||
*
|
||||
* @param message The detail message, may be {@code null}.
|
||||
* @param cause The cause, may be {@code null}.
|
||||
*/
|
||||
public UnresolvableParentException( String message, Throwable cause )
|
||||
{
|
||||
super( message, cause );
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new exception with specified detail message.
|
||||
*
|
||||
* @param message The detail message, may be {@code null}.
|
||||
*/
|
||||
public UnresolvableParentException( String message )
|
||||
{
|
||||
super( message );
|
||||
|
|
|
@ -72,7 +72,7 @@ public class DefaultModelReader
|
|||
}
|
||||
catch ( XmlPullParserException e )
|
||||
{
|
||||
throw new ModelParseException( e.getMessage(), e, e.getLineNumber(), e.getColumnNumber() );
|
||||
throw new ModelParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -95,7 +95,7 @@ public class DefaultModelReader
|
|||
}
|
||||
catch ( XmlPullParserException e )
|
||||
{
|
||||
throw new ModelParseException( e.getMessage(), e, e.getLineNumber(), e.getColumnNumber() );
|
||||
throw new ModelParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -58,11 +58,11 @@ public class ModelParseException
|
|||
* Creates a new parser exception with the specified details.
|
||||
*
|
||||
* @param message The error message, may be {@code null}.
|
||||
* @param cause The nested cause of this error, may be {@code null}.
|
||||
* @param lineNumber The one-based index of the line containing the error or {@code -1} if unknown.
|
||||
* @param columnNumber The one-based index of the column containing the error or {@code -1} if unknown.
|
||||
* @param cause The nested cause of this error, may be {@code null}.
|
||||
*/
|
||||
public ModelParseException( String message, Throwable cause, int lineNumber, int columnNumber )
|
||||
public ModelParseException( String message, int lineNumber, int columnNumber, Throwable cause )
|
||||
{
|
||||
super( message );
|
||||
initCause( cause );
|
||||
|
|
|
@ -38,11 +38,11 @@ public class ProfileActivationException
|
|||
/**
|
||||
* Creates a new exception with specified detail message and cause for the given profile.
|
||||
*
|
||||
* @param profile The profile that caused the error, may be {@code null}.
|
||||
* @param message The detail message, may be {@code null}.
|
||||
* @param profile The profile that caused the error, may be {@code null}.
|
||||
* @param cause The cause, may be {@code null}.
|
||||
*/
|
||||
public ProfileActivationException( Profile profile, String message, Throwable cause )
|
||||
public ProfileActivationException( String message, Profile profile, Throwable cause )
|
||||
{
|
||||
super( message, cause );
|
||||
this.profile = profile;
|
||||
|
@ -51,18 +51,18 @@ public class ProfileActivationException
|
|||
/**
|
||||
* Creates a new exception with specified detail message for the given profile.
|
||||
*
|
||||
* @param profile The profile that caused the error, may be {@code null}.
|
||||
* @param message The detail message, may be {@code null}.
|
||||
* @param profile The profile that caused the error, may be {@code null}.
|
||||
*/
|
||||
public ProfileActivationException( Profile profile, String message )
|
||||
public ProfileActivationException( String message, Profile profile )
|
||||
{
|
||||
super( message );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the profile that causes this error (if any).
|
||||
* Gets the profile that caused this error (if any).
|
||||
*
|
||||
* @return The profile that causes this error or {@code null} if not applicable.
|
||||
* @return The profile that caused this error or {@code null} if not applicable.
|
||||
*/
|
||||
public Profile getProfile()
|
||||
{
|
||||
|
|
|
@ -68,9 +68,8 @@ public class FileProfileActivator
|
|||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
throw new ProfileActivationException( profile,
|
||||
"Failed to interpolate file location for profile "
|
||||
+ profile.getId() + ": " + existingPath );
|
||||
throw new ProfileActivationException( "Failed to interpolate file location for profile "
|
||||
+ profile.getId() + ": " + existingPath, profile );
|
||||
}
|
||||
active = new File( existingPath ).exists();
|
||||
}
|
||||
|
@ -82,9 +81,8 @@ public class FileProfileActivator
|
|||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
throw new ProfileActivationException( profile,
|
||||
"Failed to interpolate file location for profile "
|
||||
+ profile.getId() + ": " + existingPath );
|
||||
throw new ProfileActivationException( "Failed to interpolate file location for profile "
|
||||
+ profile.getId() + ": " + existingPath, profile );
|
||||
}
|
||||
active = !new File( missingPath ).exists();
|
||||
}
|
||||
|
|
|
@ -56,8 +56,8 @@ public class JdkVersionProfileActivator
|
|||
|
||||
if ( version.length() <= 0 )
|
||||
{
|
||||
throw new ProfileActivationException( profile, "Failed to determine Java version for profile "
|
||||
+ profile.getId() );
|
||||
throw new ProfileActivationException( "Failed to determine Java version for profile "
|
||||
+ profile.getId(), profile );
|
||||
}
|
||||
|
||||
if ( jdk.startsWith( "!" ) )
|
||||
|
|
|
@ -55,9 +55,8 @@ public class PropertyProfileActivator
|
|||
|
||||
if ( name == null )
|
||||
{
|
||||
throw new ProfileActivationException( profile,
|
||||
"The property name is required to activate the profile "
|
||||
+ profile.getId() );
|
||||
throw new ProfileActivationException( "The property name is required to activate the profile "
|
||||
+ profile.getId(), profile );
|
||||
}
|
||||
|
||||
if ( name.startsWith( "!" ) )
|
||||
|
|
|
@ -30,6 +30,9 @@ public class InvalidRepositoryException
|
|||
extends Exception
|
||||
{
|
||||
|
||||
/**
|
||||
* The repository that raised this error, can be {@code null}.
|
||||
*/
|
||||
private Repository repository;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue