diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/InvalidModelException.java b/maven-model-builder/src/main/java/org/apache/maven/model/InvalidModelException.java index 97bf22c4cb..93462c653d 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/InvalidModelException.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/InvalidModelException.java @@ -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; diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/InvalidProfileException.java b/maven-model-builder/src/main/java/org/apache/maven/model/InvalidProfileException.java index bcbdc821bf..c43c601f4a 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/InvalidProfileException.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/InvalidProfileException.java @@ -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() { diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/ModelBuildingException.java b/maven-model-builder/src/main/java/org/apache/maven/model/ModelBuildingException.java index 91661a8df5..82d0fb4695 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/ModelBuildingException.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/ModelBuildingException.java @@ -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 ); diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/UnresolvableParentException.java b/maven-model-builder/src/main/java/org/apache/maven/model/UnresolvableParentException.java index 68f2ffd3b0..86e554953b 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/UnresolvableParentException.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/UnresolvableParentException.java @@ -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 ); diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java b/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java index 1879db90ba..5fe3db3070 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java @@ -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 { diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/io/ModelParseException.java b/maven-model-builder/src/main/java/org/apache/maven/model/io/ModelParseException.java index 1b73bd7d78..d16d1f1ef3 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/io/ModelParseException.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/io/ModelParseException.java @@ -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 ); diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileActivationException.java b/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileActivationException.java index 3972fc5e4b..492383eb0e 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileActivationException.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileActivationException.java @@ -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() { diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/profile/activator/FileProfileActivator.java b/maven-model-builder/src/main/java/org/apache/maven/model/profile/activator/FileProfileActivator.java index fcd53cc3d4..3ec06b366a 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/profile/activator/FileProfileActivator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/profile/activator/FileProfileActivator.java @@ -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(); } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/profile/activator/JdkVersionProfileActivator.java b/maven-model-builder/src/main/java/org/apache/maven/model/profile/activator/JdkVersionProfileActivator.java index 8824a73799..320397b2a8 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/profile/activator/JdkVersionProfileActivator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/profile/activator/JdkVersionProfileActivator.java @@ -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( "!" ) ) diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/profile/activator/PropertyProfileActivator.java b/maven-model-builder/src/main/java/org/apache/maven/model/profile/activator/PropertyProfileActivator.java index ce6449815d..80b97c1cdf 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/profile/activator/PropertyProfileActivator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/profile/activator/PropertyProfileActivator.java @@ -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( "!" ) ) diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/resolver/InvalidRepositoryException.java b/maven-model-builder/src/main/java/org/apache/maven/model/resolver/InvalidRepositoryException.java index c4bf71fd14..4caf33db21 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/resolver/InvalidRepositoryException.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/resolver/InvalidRepositoryException.java @@ -30,6 +30,9 @@ public class InvalidRepositoryException extends Exception { + /** + * The repository that raised this error, can be {@code null}. + */ private Repository repository; /**