o Polished API

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@797477 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-07-24 14:23:00 +00:00
parent f48d77ce5e
commit 4286488981
7 changed files with 72 additions and 16 deletions

View File

@ -126,7 +126,7 @@ public ModelSource resolveModel( String groupId, String artifactId, String versi
catch ( ArtifactResolutionException e )
{
throw new UnresolvableModelException( "Failed to resolve POM for " + groupId + ":" + artifactId + ":"
+ version + " due to " + e.getMessage(), e );
+ version + " due to " + e.getMessage(), groupId, artifactId, version, e );
}
return new FileModelSource( artifactParent.getFile() );

View File

@ -30,9 +30,9 @@ class DefaultModelBuildingEvent
implements ModelBuildingEvent
{
private Model model;
private final Model model;
private ModelBuildingRequest request;
private final ModelBuildingRequest request;
public DefaultModelBuildingEvent( Model model, ModelBuildingRequest request )
{

View File

@ -35,7 +35,7 @@ public class ModelBuildingException
extends Exception
{
private List<ModelProblem> problems;
private final List<ModelProblem> problems;
/**
* Creates a new exception with the specified problems.

View File

@ -41,13 +41,13 @@ public enum Severity
}
private String source;
private final String source;
private String message;
private final String message;
private Exception exception;
private final Exception exception;
private Severity severity;
private final Severity severity;
/**
* Creates a new problem with the specified message.
@ -58,9 +58,7 @@ public enum Severity
*/
public ModelProblem( String message, Severity severity, String source )
{
this.message = message;
this.severity = ( severity != null ) ? severity : Severity.ERROR;
this.source = ( source != null ) ? source : "";
this( message, severity, source, null );
}
/**

View File

@ -33,12 +33,12 @@ public class ModelParseException
/**
* The one-based index of the line containing the error.
*/
private int lineNumber;
private final int lineNumber;
/**
* The one-based index of the column containing the error.
*/
private int columnNumber;
private final int columnNumber;
/**
* Creates a new parser exception with the specified details.

View File

@ -33,7 +33,7 @@ public class ProfileActivationException
/**
* The profile which raised this error, can be {@code null}.
*/
private Profile profile;
private final Profile profile;
/**
* Creates a new exception with specified detail message and cause for the given profile.

View File

@ -28,25 +28,83 @@ public class UnresolvableModelException
extends Exception
{
/**
* The group id of the unresolvable model.
*/
private final String groupId;
/**
* The artifact id of the unresolvable model.
*/
private final String artifactId;
/**
* The version of the unresolvable model.
*/
private final String version;
/**
* Creates a new exception with specified detail message and cause.
*
* @param message The detail message, may be {@code null}.
* @param groupId The group id of the unresolvable model, may be {@code null}.
* @param artifactId The artifact id of the unresolvable model, may be {@code null}.
* @param version The version of the unresolvable model, may be {@code null}.
* @param cause The cause, may be {@code null}.
*/
public UnresolvableModelException( String message, Throwable cause )
public UnresolvableModelException( String message, String groupId, String artifactId, String version,
Throwable cause )
{
super( message, cause );
this.groupId = ( groupId != null ) ? groupId : "";
this.artifactId = ( artifactId != null ) ? artifactId : "";
this.version = ( version != null ) ? version : "";
}
/**
* Creates a new exception with specified detail message.
*
* @param message The detail message, may be {@code null}.
* @param groupId The group id of the unresolvable model, may be {@code null}.
* @param artifactId The artifact id of the unresolvable model, may be {@code null}.
* @param version The version of the unresolvable model, may be {@code null}.
*/
public UnresolvableModelException( String message )
public UnresolvableModelException( String message, String groupId, String artifactId, String version )
{
super( message );
this.groupId = ( groupId != null ) ? groupId : "";
this.artifactId = ( artifactId != null ) ? artifactId : "";
this.version = ( version != null ) ? version : "";
}
/**
* Gets the group id of the unresolvable model.
*
* @return The group id of the unresolvable model, can be empty but never {@code null}.
*/
public String getGroupId()
{
return groupId;
}
/**
* Gets the artifact id of the unresolvable model.
*
* @return The artifact id of the unresolvable model, can be empty but never {@code null}.
*/
public String getArtifactId()
{
return artifactId;
}
/**
* Gets the version of the unresolvable model.
*
* @return The version of the unresolvable model, can be empty but never {@code null}.
*/
public String getVersion()
{
return version;
}
}