You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/07/24 16:23:00 UTC

svn commit: r797477 - in /maven/components/trunk: maven-core/src/main/java/org/apache/maven/project/ maven-model-builder/src/main/java/org/apache/maven/model/building/ maven-model-builder/src/main/java/org/apache/maven/model/io/ maven-model-builder/src...

Author: bentmann
Date: Fri Jul 24 14:23:00 2009
New Revision: 797477

URL: http://svn.apache.org/viewvc?rev=797477&view=rev
Log:
o Polished API

Modified:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/RepositoryModelResolver.java
    maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuildingEvent.java
    maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingException.java
    maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblem.java
    maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/io/ModelParseException.java
    maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileActivationException.java
    maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/resolution/UnresolvableModelException.java

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/RepositoryModelResolver.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/RepositoryModelResolver.java?rev=797477&r1=797476&r2=797477&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/RepositoryModelResolver.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/RepositoryModelResolver.java Fri Jul 24 14:23:00 2009
@@ -126,7 +126,7 @@
         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() );

Modified: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuildingEvent.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuildingEvent.java?rev=797477&r1=797476&r2=797477&view=diff
==============================================================================
--- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuildingEvent.java (original)
+++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuildingEvent.java Fri Jul 24 14:23:00 2009
@@ -30,9 +30,9 @@
     implements ModelBuildingEvent
 {
 
-    private Model model;
+    private final Model model;
 
-    private ModelBuildingRequest request;
+    private final ModelBuildingRequest request;
 
     public DefaultModelBuildingEvent( Model model, ModelBuildingRequest request )
     {

Modified: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingException.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingException.java?rev=797477&r1=797476&r2=797477&view=diff
==============================================================================
--- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingException.java (original)
+++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingException.java Fri Jul 24 14:23:00 2009
@@ -35,7 +35,7 @@
     extends Exception
 {
 
-    private List<ModelProblem> problems;
+    private final List<ModelProblem> problems;
 
     /**
      * Creates a new exception with the specified problems.

Modified: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblem.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblem.java?rev=797477&r1=797476&r2=797477&view=diff
==============================================================================
--- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblem.java (original)
+++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblem.java Fri Jul 24 14:23:00 2009
@@ -41,13 +41,13 @@
 
     }
 
-    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 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 );
     }
 
     /**

Modified: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/io/ModelParseException.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/io/ModelParseException.java?rev=797477&r1=797476&r2=797477&view=diff
==============================================================================
--- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/io/ModelParseException.java (original)
+++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/io/ModelParseException.java Fri Jul 24 14:23:00 2009
@@ -33,12 +33,12 @@
     /**
      * 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.

Modified: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileActivationException.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileActivationException.java?rev=797477&r1=797476&r2=797477&view=diff
==============================================================================
--- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileActivationException.java (original)
+++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileActivationException.java Fri Jul 24 14:23:00 2009
@@ -33,7 +33,7 @@
     /**
      * 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.

Modified: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/resolution/UnresolvableModelException.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/resolution/UnresolvableModelException.java?rev=797477&r1=797476&r2=797477&view=diff
==============================================================================
--- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/resolution/UnresolvableModelException.java (original)
+++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/resolution/UnresolvableModelException.java Fri Jul 24 14:23:00 2009
@@ -29,24 +29,82 @@
 {
 
     /**
+     * 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;
     }
 
 }