fixed errors reported by Checkstyle
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-2/branches/maven-2.2.x@813524 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java b/maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java
index bb60ca1..e0c7a3e 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java
@@ -38,9 +38,9 @@
public static boolean isSnapshot( String version )
{
- return version != null &&
- ( version.toUpperCase().endsWith( Artifact.SNAPSHOT_VERSION ) || Artifact.VERSION_FILE_PATTERN.matcher( version )
- .matches() );
+ return version != null
+ && ( version.toUpperCase().endsWith( Artifact.SNAPSHOT_VERSION )
+ || Artifact.VERSION_FILE_PATTERN.matcher( version ).matches() );
}
public static String toSnapshotVersion( String version )
@@ -82,8 +82,8 @@
public static String artifactId( String groupId, String artifactId, String type, String classifier,
String baseVersion )
{
- return groupId + ":" + artifactId + ":" + type + ( classifier != null ? ":" + classifier : "" ) + ":" +
- baseVersion;
+ return groupId + ":" + artifactId + ":" + type + ( classifier != null ? ":" + classifier : "" ) + ":"
+ + baseVersion;
}
public static Map artifactMapByVersionlessId( Collection artifacts )
@@ -140,21 +140,21 @@
return clone;
}
-
+
private static List copyList( List original )
{
List copy = null;
-
+
if ( original != null )
{
copy = new ArrayList();
-
+
if ( !original.isEmpty() )
{
copy.addAll( original );
}
}
-
+
return copy;
}
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/metadata/AbstractArtifactMetadata.java b/maven-artifact/src/main/java/org/apache/maven/artifact/metadata/AbstractArtifactMetadata.java
index 558296c..bfc0827 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/metadata/AbstractArtifactMetadata.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/metadata/AbstractArtifactMetadata.java
@@ -51,16 +51,16 @@
{
return artifact.getArtifactId();
}
-
+
public String extendedToString()
{
StringBuffer buffer = new StringBuffer();
-
+
buffer.append( "\nArtifact Metadata\n--------------------------" );
buffer.append( "\nGroupId: " ).append( getGroupId() );
buffer.append( "\nArtifactId: " ).append( getArtifactId() );
- buffer.append( "\nMetadata Type: " ).append(getClass().getName() );
-
+ buffer.append( "\nMetadata Type: " ).append( getClass().getName() );
+
return buffer.toString();
}
}
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java b/maven-artifact/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java
index 3d8dd3d..2482308 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java
@@ -21,7 +21,6 @@
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.versioning.ArtifactVersion;
import java.util.List;
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataReadException.java b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataReadException.java
index 41b3044..1e5379c 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataReadException.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataReadException.java
@@ -1,4 +1,6 @@
-package org.apache.maven.artifact.repository.metadata;/*
+package org.apache.maven.artifact.repository.metadata;
+
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java
index abf1c48..49ca901 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java
@@ -90,7 +90,7 @@
Throwable t )
{
this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(),
- artifact.getClassifier(),remoteRepositories, artifact.getDependencyTrail(), t );
+ artifact.getClassifier(), remoteRepositories, artifact.getDependencyTrail(), t );
this.artifact = artifact;
}
@@ -246,7 +246,7 @@
sb.append( version );
//insert classifier only if it was used in the artifact
- if (classifier !=null && !classifier.equals( "" ))
+ if ( classifier != null && !classifier.equals( "" ) )
{
sb.append( " -Dclassifier=" );
sb.append( classifier );
@@ -271,7 +271,7 @@
sb.append( version );
//insert classifier only if it was used in the artifact
- if (classifier !=null && !classifier.equals( "" ))
+ if ( classifier != null && !classifier.equals( "" ) )
{
sb.append( " -Dclassifier=" );
sb.append( classifier );
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactNotFoundException.java b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactNotFoundException.java
index 0d521c2..c92c36f 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactNotFoundException.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactNotFoundException.java
@@ -31,12 +31,12 @@
extends AbstractArtifactResolutionException
{
private String downloadUrl;
-
+
protected ArtifactNotFoundException( String message, Artifact artifact, List remoteRepositories )
{
super( message, artifact, remoteRepositories );
}
-
+
public ArtifactNotFoundException( String message, Artifact artifact )
{
this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(),
@@ -52,7 +52,7 @@
public ArtifactNotFoundException( String message, String groupId, String artifactId, String version, String type, String classifier,
List remoteRepositories, String downloadUrl, List path, Throwable t )
{
- super( constructMissingArtifactMessage( message, "", groupId, artifactId, version, type, classifier,downloadUrl, path ), groupId, artifactId,
+ super( constructMissingArtifactMessage( message, "", groupId, artifactId, version, type, classifier, downloadUrl, path ), groupId, artifactId,
version, type, classifier, remoteRepositories, null, t );
this.downloadUrl = downloadUrl;
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionException.java b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionException.java
index 7bc298d..93af9d2 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionException.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionException.java
@@ -39,7 +39,7 @@
public ArtifactResolutionException( String message, String groupId, String artifactId, String version, String type,
String classifier, Throwable t )
{
- super( message, groupId, artifactId, version, type, classifier,null, null, t );
+ super( message, groupId, artifactId, version, type, classifier, null, null, t );
}
public ArtifactResolutionException( String message, Artifact artifact )
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java
index b82f0ee..100c4a5 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java
@@ -33,7 +33,7 @@
// calculated.
private Set artifacts;
-
+
public ArtifactResolutionResult()
{
}
@@ -43,17 +43,17 @@
if ( artifacts == null )
{
artifacts = new LinkedHashSet();
-
+
for ( Iterator it = resolutionNodes.iterator(); it.hasNext(); )
{
ResolutionNode node = (ResolutionNode) it.next();
artifacts.add( node.getArtifact() );
}
}
-
+
return artifacts;
}
-
+
public Set getArtifactResolutionNodes()
{
return resolutionNodes;
@@ -62,13 +62,13 @@
public void setArtifactResolutionNodes( Set resolutionNodes )
{
this.resolutionNodes = resolutionNodes;
-
+
// clear the cache
this.artifacts = null;
}
-
+
public String toString()
{
- return "Artifacts: "+this.artifacts+" Nodes: "+ this.resolutionNodes;
+ return "Artifacts: " + this.artifacts + " Nodes: " + this.resolutionNodes;
}
}
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java
index 24f42e5..c9e507f 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java
@@ -151,7 +151,7 @@
// TODO: Does this check need to happen here? Had to add the same call
// below when we iterate on child nodes -- will that suffice?
- if ( managedVersions.containsKey( key ))
+ if ( managedVersions.containsKey( key ) )
{
manageArtifact( node, managedVersions, listeners );
}
@@ -211,23 +211,24 @@
catch ( ArtifactMetadataRetrievalException e )
{
resetArtifact.setDependencyTrail( node.getDependencyTrail() );
- throw new ArtifactResolutionException(
- "Unable to get dependency information: " +
- e.getMessage(), resetArtifact,
- remoteRepositories, e );
+ throw new ArtifactResolutionException( "Unable to get dependency information: "
+ + e.getMessage(), resetArtifact, remoteRepositories, e );
}
}
//end hack
//MNG-2861: match version can return null
- ArtifactVersion selectedVersion = resetArtifact.getVersionRange().matchVersion( resetArtifact.getAvailableVersions() );
- if (selectedVersion != null)
+ ArtifactVersion selectedVersion =
+ resetArtifact.getVersionRange().matchVersion( resetArtifact.getAvailableVersions() );
+ if ( selectedVersion != null )
{
- resetArtifact.selectVersion( selectedVersion.toString() );
+ resetArtifact.selectVersion( selectedVersion.toString() );
}
else
{
- throw new OverConstrainedVersionException(" Unable to find a version in "+ resetArtifact.getAvailableVersions()+" to match the range "+ resetArtifact.getVersionRange(), resetArtifact);
+ throw new OverConstrainedVersionException( " Unable to find a version in "
+ + resetArtifact.getAvailableVersions() + " to match the range "
+ + resetArtifact.getVersionRange(), resetArtifact );
}
fireEvent( ResolutionListener.SELECT_VERSION_FROM_RANGE, listeners, resetNodes[j] );
@@ -286,7 +287,7 @@
fireEvent( ResolutionListener.PROCESS_CHILDREN, listeners, node );
Artifact parentArtifact = node.getArtifact();
-
+
for ( Iterator i = node.getChildrenIterator(); i.hasNext(); )
{
ResolutionNode child = (ResolutionNode) i.next();
@@ -296,7 +297,7 @@
{
Artifact artifact = child.getArtifact();
artifact.setDependencyTrail( node.getDependencyTrail() );
-
+
List childRemoteRepositories = child.getRemoteRepositories();
try
{
@@ -367,12 +368,12 @@
if ( versions.isEmpty() )
{
throw new OverConstrainedVersionException(
- "No versions are present in the repository for the artifact with a range " +
- versionRange, artifact, childRemoteRepositories );
+ "No versions are present in the repository for the artifact with a range "
+ + versionRange, artifact, childRemoteRepositories );
}
- throw new OverConstrainedVersionException( "Couldn't find a version in " +
- versions + " to match range " + versionRange, artifact,
+ throw new OverConstrainedVersionException( "Couldn't find a version in "
+ + versions + " to match range " + versionRange, artifact,
childRemoteRepositories );
}
}
@@ -392,11 +393,12 @@
child.setArtifact( artifact );
}
}
- while( !childKey.equals( child.getKey() ) );
-
- if ( parentArtifact != null && parentArtifact.getDependencyFilter() != null && !parentArtifact.getDependencyFilter().include( artifact ) )
+ while ( !childKey.equals( child.getKey() ) );
+
+ if ( parentArtifact != null && parentArtifact.getDependencyFilter() != null
+ && !parentArtifact.getDependencyFilter().include( artifact ) )
{
- // MNG-3769: the [probably relocated] artifact is excluded.
+ // MNG-3769: the [probably relocated] artifact is excluded.
// We could process exclusions on relocated artifact details in the
// MavenMetadataSource.createArtifacts(..) step, BUT that would
// require resolving the POM from the repository very early on in
@@ -482,16 +484,15 @@
Artifact nearestArtifact = nearest.getArtifact();
/* farthest is runtime and nearest has lower priority, change to runtime */
- if ( Artifact.SCOPE_RUNTIME.equals( farthestArtifact.getScope() ) && (
- Artifact.SCOPE_TEST.equals( nearestArtifact.getScope() ) ||
- Artifact.SCOPE_PROVIDED.equals( nearestArtifact.getScope() ) ) )
+ if ( Artifact.SCOPE_RUNTIME.equals( farthestArtifact.getScope() )
+ && ( Artifact.SCOPE_TEST.equals( nearestArtifact.getScope() ) || Artifact.SCOPE_PROVIDED.equals( nearestArtifact.getScope() ) ) )
{
updateScope = true;
}
/* farthest is compile and nearest is not (has lower priority), change to compile */
- if ( Artifact.SCOPE_COMPILE.equals( farthestArtifact.getScope() ) &&
- !Artifact.SCOPE_COMPILE.equals( nearestArtifact.getScope() ) )
+ if ( Artifact.SCOPE_COMPILE.equals( farthestArtifact.getScope() )
+ && !Artifact.SCOPE_COMPILE.equals( nearestArtifact.getScope() ) )
{
updateScope = true;
}
@@ -561,18 +562,24 @@
listener.updateScopeCurrentPom( node.getArtifact(), replacement.getScope() );
break;
case ResolutionListener.MANAGE_ARTIFACT_VERSION:
- if (listener instanceof ResolutionListenerForDepMgmt) {
+ if ( listener instanceof ResolutionListenerForDepMgmt )
+ {
ResolutionListenerForDepMgmt asImpl = (ResolutionListenerForDepMgmt) listener;
asImpl.manageArtifactVersion( node.getArtifact(), replacement );
- } else {
+ }
+ else
+ {
listener.manageArtifact( node.getArtifact(), replacement );
}
break;
case ResolutionListener.MANAGE_ARTIFACT_SCOPE:
- if (listener instanceof ResolutionListenerForDepMgmt) {
+ if ( listener instanceof ResolutionListenerForDepMgmt )
+ {
ResolutionListenerForDepMgmt asImpl = (ResolutionListenerForDepMgmt) listener;
asImpl.manageArtifactScope( node.getArtifact(), replacement );
- } else {
+ }
+ else
+ {
listener.manageArtifact( node.getArtifact(), replacement );
}
break;
@@ -580,8 +587,8 @@
listener.selectVersionFromRange( node.getArtifact() );
break;
case ResolutionListener.RESTRICT_RANGE:
- if ( node.getArtifact().getVersionRange().hasRestrictions() ||
- replacement.getVersionRange().hasRestrictions() )
+ if ( node.getArtifact().getVersionRange().hasRestrictions()
+ || replacement.getVersionRange().hasRestrictions() )
{
listener.restrictRange( node.getArtifact(), replacement, newRange );
}
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java
index 701990d..8645b69 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java
@@ -146,13 +146,14 @@
ArtifactVersion selected = artifact.getSelectedVersion();
//MNG-2123: null is a valid response to getSelectedVersion, don't
//assume it won't ever be.
- if (selected != null)
+ if ( selected != null )
{
artifact.selectVersion( selected.toString() );
}
else
{
- throw new OverConstrainedVersionException("Unable to get a selected Version for "+ artifact.getArtifactId(),artifact);
+ throw new OverConstrainedVersionException( "Unable to get a selected Version for "
+ + artifact.getArtifactId(), artifact );
}
}
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/conflict/ConflictResolver.java b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/conflict/ConflictResolver.java
index 18a0029..824bb81 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/conflict/ConflictResolver.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/conflict/ConflictResolver.java
@@ -25,5 +25,5 @@
*/
public interface ConflictResolver
{
- static String ROLE = ConflictResolver.class.getName();
+ String ROLE = ConflictResolver.class.getName();
}
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/DefaultArtifactVersion.java b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/DefaultArtifactVersion.java
index 53ac988..8445ca2 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/DefaultArtifactVersion.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/DefaultArtifactVersion.java
@@ -246,7 +246,7 @@
return true;
}
- if ( false == ( other instanceof ArtifactVersion ) )
+ if ( !( other instanceof ArtifactVersion ) )
{
return false;
}
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ManagedVersionMap.java b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ManagedVersionMap.java
index eb782e7..abba1d9 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ManagedVersionMap.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ManagedVersionMap.java
@@ -25,26 +25,26 @@
public class ManagedVersionMap extends HashMap
{
- public ManagedVersionMap(Map map)
+ public ManagedVersionMap( Map map )
{
super();
- if (map != null)
+ if ( map != null )
{
- putAll(map);
+ putAll( map );
}
}
public String toString()
{
- StringBuffer buffer = new StringBuffer("ManagedVersionMap\n");
+ StringBuffer buffer = new StringBuffer( "ManagedVersionMap\n" );
Iterator iter = this.keySet().iterator();
- while (iter.hasNext())
+ while ( iter.hasNext() )
{
- String key = (String)iter.next();
- buffer.append(key).append("=").append(get(key));
- if (iter.hasNext())
+ String key = (String) iter.next();
+ buffer.append( key ).append( "=" ).append( get( key ) );
+ if ( iter.hasNext() )
{
- buffer.append("\n");
+ buffer.append( "\n" );
}
}
return buffer.toString();
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/Restriction.java b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/Restriction.java
index 157503f..e3cafd6 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/Restriction.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/Restriction.java
@@ -1,6 +1,5 @@
package org.apache.maven.artifact.versioning;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -133,7 +132,7 @@
return true;
}
- if ( !(other instanceof Restriction ) )
+ if ( !( other instanceof Restriction ) )
{
return false;
}
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/VersionRange.java b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/VersionRange.java
index a29bdaf..0803667 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/VersionRange.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/VersionRange.java
@@ -53,27 +53,27 @@
{
return restrictions;
}
-
+
public VersionRange cloneOf()
{
List copiedRestrictions = null;
-
+
if ( restrictions != null )
{
copiedRestrictions = new ArrayList();
-
+
if ( !restrictions.isEmpty() )
{
copiedRestrictions.addAll( restrictions );
}
}
-
+
return new VersionRange( recommendedVersion, copiedRestrictions );
}
/**
* Create a version range from a string representation
- *
+ *
* Some spec examples are
* <ul>
* <li><code>1.0</code> Version 1.0</li>
@@ -82,7 +82,7 @@
* <li><code>[1.5,)</code> Versions 1.5 and higher</li>
* <li><code>(,1.0],[1.2,)</code> Versions up to 1.0 (included) and 1.2 or higher</li>
* </ul>
- *
+ *
* @param spec string representation of a version or version range
* @return a new {@link VersionRange} object that represents the spec
* @throws InvalidVersionSpecificationException
@@ -220,30 +220,30 @@
}
/**
- * Creates and returns a new <code>VersionRange</code> that is a restriction of this
+ * Creates and returns a new <code>VersionRange</code> that is a restriction of this
* version range and the specified version range.
* <p>
- * Note: Precedence is given to the recommended version from this version range over the
+ * Note: Precedence is given to the recommended version from this version range over the
* recommended version from the specified version range.
* </p>
* @param restriction the <code>VersionRange</code> that will be used to restrict this version
* range.
- * @return the <code>VersionRange</code> that is a restriction of this version range and the
+ * @return the <code>VersionRange</code> that is a restriction of this version range and the
* specified version range.
* <p>
* The restrictions of the returned version range will be an intersection of the restrictions
- * of this version range and the specified version range if both version ranges have
+ * of this version range and the specified version range if both version ranges have
* restrictions. Otherwise, the restrictions on the returned range will be empty.
* </p>
* <p>
* The recommended version of the returned version range will be the recommended version of
- * this version range, provided that ranges falls within the intersected restrictions. If
+ * this version range, provided that ranges falls within the intersected restrictions. If
* the restrictions are empty, this version range's recommended version is used if it is not
* <code>null</code>. If it is <code>null</code>, the specified version range's recommended
- * version is used (provided it is non-<code>null</code>). If no recommended version can be
+ * version is used (provided it is non-<code>null</code>). If no recommended version can be
* obtained, the returned version range's recommended version is set to <code>null</code>.
* </p>
- * @throws NullPointerException if the specified <code>VersionRange</code> is
+ * @throws NullPointerException if the specified <code>VersionRange</code> is
* <code>null</code>.
*/
public VersionRange restrict( VersionRange restriction )
@@ -274,8 +274,8 @@
version = recommendedVersion;
found = true;
}
- else if ( version == null && restriction.getRecommendedVersion() != null &&
- r.containsVersion( restriction.getRecommendedVersion() ) )
+ else if ( version == null && restriction.getRecommendedVersion() != null
+ && r.containsVersion( restriction.getRecommendedVersion() ) )
{
// use this if we can, but prefer the original if possible
version = restriction.getRecommendedVersion();
@@ -288,7 +288,7 @@
// Use the original recommended version since it exists
version = recommendedVersion;
}
- else if (restriction.recommendedVersion != null)
+ else if ( restriction.recommendedVersion != null )
{
// Use the recommended version from the specified VersionRange since there is no
// original recommended version
@@ -315,11 +315,11 @@
boolean done = false;
while ( !done )
{
- if ( res1.getLowerBound() == null || res2.getUpperBound() == null ||
- res1.getLowerBound().compareTo( res2.getUpperBound() ) <= 0 )
+ if ( res1.getLowerBound() == null || res2.getUpperBound() == null
+ || res1.getLowerBound().compareTo( res2.getUpperBound() ) <= 0 )
{
- if ( res1.getUpperBound() == null || res2.getLowerBound() == null ||
- res1.getUpperBound().compareTo( res2.getLowerBound() ) >= 0 )
+ if ( res1.getUpperBound() == null || res2.getLowerBound() == null
+ || res1.getUpperBound().compareTo( res2.getLowerBound() ) >= 0 )
{
ArtifactVersion lower;
ArtifactVersion upper;
@@ -555,21 +555,22 @@
public boolean equals( Object obj )
{
- if (this == obj){
+ if ( this == obj )
+ {
return true;
}
- if (!(obj instanceof VersionRange ))
+ if ( !( obj instanceof VersionRange ) )
{
return false;
}
VersionRange other = (VersionRange) obj;
-
+
boolean equals =
- recommendedVersion == other.recommendedVersion ||
- ( ( recommendedVersion != null ) && recommendedVersion.equals( other.recommendedVersion ) );
+ recommendedVersion == other.recommendedVersion
+ || ( ( recommendedVersion != null ) && recommendedVersion.equals( other.recommendedVersion ) );
equals &=
- restrictions == other.restrictions ||
- ( ( restrictions != null ) && restrictions.equals( other.restrictions ) );
+ restrictions == other.restrictions
+ || ( ( restrictions != null ) && restrictions.equals( other.restrictions ) );
return equals;
}
diff --git a/maven-artifact/src/test/java/org/apache/maven/artifact/factory/DefaultArtifactFactoryTest.java b/maven-artifact/src/test/java/org/apache/maven/artifact/factory/DefaultArtifactFactoryTest.java
index 5eefaa9..41757f2 100644
--- a/maven-artifact/src/test/java/org/apache/maven/artifact/factory/DefaultArtifactFactoryTest.java
+++ b/maven-artifact/src/test/java/org/apache/maven/artifact/factory/DefaultArtifactFactoryTest.java
@@ -26,19 +26,19 @@
public class DefaultArtifactFactoryTest
extends PlexusTestCase
{
-
+
public void testPropagationOfSystemScopeRegardlessOfInheritedScope() throws Exception
{
ArtifactFactory factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
-
- Artifact artifact = factory.createDependencyArtifact( "test-grp", "test-artifact", VersionRange.createFromVersion("1.0"), "type", null, "system", "provided" );
- Artifact artifact2 = factory.createDependencyArtifact( "test-grp", "test-artifact-2", VersionRange.createFromVersion("1.0"), "type", null, "system", "test" );
- Artifact artifact3 = factory.createDependencyArtifact( "test-grp", "test-artifact-3", VersionRange.createFromVersion("1.0"), "type", null, "system", "runtime" );
- Artifact artifact4 = factory.createDependencyArtifact( "test-grp", "test-artifact-4", VersionRange.createFromVersion("1.0"), "type", null, "system", "compile" );
-
+
+ Artifact artifact = factory.createDependencyArtifact( "test-grp", "test-artifact", VersionRange.createFromVersion( "1.0" ), "type", null, "system", "provided" );
+ Artifact artifact2 = factory.createDependencyArtifact( "test-grp", "test-artifact-2", VersionRange.createFromVersion( "1.0" ), "type", null, "system", "test" );
+ Artifact artifact3 = factory.createDependencyArtifact( "test-grp", "test-artifact-3", VersionRange.createFromVersion( "1.0" ), "type", null, "system", "runtime" );
+ Artifact artifact4 = factory.createDependencyArtifact( "test-grp", "test-artifact-4", VersionRange.createFromVersion( "1.0" ), "type", null, "system", "compile" );
+
// this one should never happen in practice...
- Artifact artifact5 = factory.createDependencyArtifact( "test-grp", "test-artifact-5", VersionRange.createFromVersion("1.0"), "type", null, "system", "system" );
-
+ Artifact artifact5 = factory.createDependencyArtifact( "test-grp", "test-artifact-5", VersionRange.createFromVersion( "1.0" ), "type", null, "system", "system" );
+
assertEquals( "system", artifact.getScope() );
assertEquals( "system", artifact2.getScope() );
assertEquals( "system", artifact3.getScope() );
diff --git a/maven-artifact/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolutionExceptionTest.java b/maven-artifact/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolutionExceptionTest.java
index 454928c..43a90f6 100644
--- a/maven-artifact/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolutionExceptionTest.java
+++ b/maven-artifact/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolutionExceptionTest.java
@@ -44,26 +44,29 @@
String type = "jar";
String classifier = "aClassifier";
String downloadUrl = "http://somewhere.com/download";
- List path = Arrays.asList(new String[]{"dependency1", "dependency2"});
- String expected = "Missing artifact" + LS +
- LS +
- " Try downloading the file manually from: " + LS +
- " http://somewhere.com/download" + LS +
- LS +
- " Then, install it using the command: " + LS +
- " mvn install:install-file -DgroupId=aGroupId -DartifactId=anArtifactId -Dversion=aVersion "+
- "-Dclassifier=aClassifier -Dpackaging=jar -Dfile=/path/to/file" + LS +
- LS +
- " Alternatively, if you host your own repository you can deploy the file there: " + LS +
- " mvn deploy:deploy-file -DgroupId=aGroupId -DartifactId=anArtifactId"+
- " -Dversion=aVersion -Dclassifier=aClassifier -Dpackaging=jar -Dfile=/path/to/file"+
- " -Durl=[url] -DrepositoryId=[id]" + LS +
- LS +
- " Path to dependency: " + LS +
- " \t1) dependency1" + LS +
- " \t2) dependency2" + LS +
- LS;
- String actual = AbstractArtifactResolutionException.constructMissingArtifactMessage(message, indentation, groupId, artifactId, version, type, classifier, downloadUrl, path);
- assertEquals(expected, actual);
+ List path = Arrays.asList( new String[] { "dependency1", "dependency2" } );
+ String expected = "Missing artifact" + LS
+ + LS
+ + " Try downloading the file manually from: " + LS
+ + " http://somewhere.com/download" + LS
+ + LS
+ + " Then, install it using the command: " + LS
+ + " mvn install:install-file -DgroupId=aGroupId -DartifactId=anArtifactId -Dversion=aVersion "
+ + "-Dclassifier=aClassifier -Dpackaging=jar -Dfile=/path/to/file" + LS
+ + LS
+ + " Alternatively, if you host your own repository you can deploy the file there: " + LS
+ + " mvn deploy:deploy-file -DgroupId=aGroupId -DartifactId=anArtifactId"
+ + " -Dversion=aVersion -Dclassifier=aClassifier -Dpackaging=jar -Dfile=/path/to/file"
+ + " -Durl=[url] -DrepositoryId=[id]" + LS
+ + LS
+ + " Path to dependency: " + LS
+ + " \t1) dependency1" + LS
+ + " \t2) dependency2" + LS
+ + LS;
+ String actual =
+ AbstractArtifactResolutionException.constructMissingArtifactMessage( message, indentation, groupId,
+ artifactId, version, type, classifier,
+ downloadUrl, path );
+ assertEquals( expected, actual );
}
}
diff --git a/maven-artifact/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactCollectorTest.java b/maven-artifact/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactCollectorTest.java
index d329804..cdb1ff2 100644
--- a/maven-artifact/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactCollectorTest.java
+++ b/maven-artifact/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactCollectorTest.java
@@ -330,11 +330,11 @@
//put it in the repo
ArtifactSpec c = createArtifactSpec( "c", "2.5" );
- source.addArtifact( createArtifactSpec( "c", "2.5" ));
+ source.addArtifact( createArtifactSpec( "c", "2.5" ) );
ArtifactResolutionResult res = collect( a );
- assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact,b1.artifact,c.artifact } ),
+ assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact, b1.artifact, c.artifact } ),
res.getArtifacts() );
assertEquals( "Check version", "2.5", getArtifact( "c", res.getArtifacts() ).getVersion() );
}
@@ -349,12 +349,12 @@
ArtifactSpec b = a.addDependency( "b", "1.0" );
ArtifactSpec e = a.addDependency( "e", "1.0" );
ArtifactSpec c1 = b.addDependency( "c", "3.2" );
- ArtifactSpec d1 = c1.addDependency( "d","1.1" );
+ ArtifactSpec d1 = c1.addDependency( "d", "1.1" );
e.addDependency( "c", "[1.0,3.0]" );
// put it in the repo
ArtifactSpec c = createArtifactSpec( "c", "2.5" );
- ArtifactSpec d = c.addDependency( "d","1.0" );
+ ArtifactSpec d = c.addDependency( "d", "1.0" );
source.addArtifact( c );
source.addArtifact( d );
@@ -364,7 +364,7 @@
ArtifactResolutionResult res = collect( a );
assertEquals( "Check artifact list",
- createSet( new Object[] { a.artifact, b.artifact, e.artifact, c.artifact,d.artifact } ), res.getArtifacts() );
+ createSet( new Object[] { a.artifact, b.artifact, e.artifact, c.artifact, d.artifact } ), res.getArtifacts() );
assertEquals( "Check version", "2.5", getArtifact( "c", res.getArtifacts() ).getVersion() );
}
@@ -821,8 +821,8 @@
}
catch ( OverConstrainedVersionException e )
{
- assertTrue( "Versions unordered", e.getMessage().indexOf( "[3.2.1-v3235e, 3.3.0-v3346]" ) != -1);
- assertTrue( "DependencyTrail not resolved", e.getMessage().indexOf( "Path to dependency:" ) != -1);
+ assertTrue( "Versions unordered", e.getMessage().indexOf( "[3.2.1-v3235e, 3.3.0-v3346]" ) != -1 );
+ assertTrue( "DependencyTrail not resolved", e.getMessage().indexOf( "Path to dependency:" ) != -1 );
}
}