Author: cstamas Date: Fri Dec 10 23:58:42 2010 New Revision: 1044541 URL: http://svn.apache.org/viewvc?rev=1044541&view=rev Log: VersionScheme is threadsafe, moved out from method call (this is a frequented method), added aether api to POM.
Modified: maven/indexer/trunk/indexer-core/pom.xml maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfo.java Modified: maven/indexer/trunk/indexer-core/pom.xml URL: http://svn.apache.org/viewvc/maven/indexer/trunk/indexer-core/pom.xml?rev=1044541&r1=1044540&r2=1044541&view=diff ============================================================================== --- maven/indexer/trunk/indexer-core/pom.xml (original) +++ maven/indexer/trunk/indexer-core/pom.xml Fri Dec 10 23:58:42 2010 @@ -46,6 +46,11 @@ <!-- Aether --> <dependency> <groupId>org.sonatype.aether</groupId> + <artifactId>aether-api</artifactId> + <version>${aether.version}</version> + </dependency> + <dependency> + <groupId>org.sonatype.aether</groupId> <artifactId>aether-util</artifactId> <version>${aether.version}</version> </dependency> Modified: maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfo.java URL: http://svn.apache.org/viewvc/maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfo.java?rev=1044541&r1=1044540&r2=1044541&view=diff ============================================================================== --- maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfo.java (original) +++ maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfo.java Fri Dec 10 23:58:42 2010 @@ -36,6 +36,7 @@ import org.codehaus.plexus.util.StringUt import org.sonatype.aether.util.version.GenericVersionScheme; import org.sonatype.aether.version.InvalidVersionSpecificationException; import org.sonatype.aether.version.Version; +import org.sonatype.aether.version.VersionScheme; /** * ArtifactInfo holds the values known about an repository artifact. This is a simple Value Object kind of stuff. @@ -209,6 +210,8 @@ public class ArtifactInfo private final List<MatchHighlight> matchHighlights = new ArrayList<MatchHighlight>(); + private final VersionScheme versionScheme = new GenericVersionScheme(); + public ArtifactInfo() { } @@ -226,24 +229,14 @@ public class ArtifactInfo { if ( artifactVersion == null ) { - GenericVersionScheme scheme = new GenericVersionScheme(); - try { - artifactVersion = scheme.parseVersion( version ); + artifactVersion = versionScheme.parseVersion( version ); } catch ( InvalidVersionSpecificationException e ) { // will not happen, only with version ranges but we should not have those // we handle POM versions here, not dependency versions - try - { - artifactVersion = scheme.parseVersion( "0.0" ); - } - catch ( InvalidVersionSpecificationException e1 ) - { - // noo - } } }