From 543870467f11597d815ba9fbce48b5b21be22983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 2 Dec 2012 20:22:52 +0100 Subject: [PATCH] fixed errors reported by Checkstyle --- .../repository/ArtifactRepositoryPolicy.java | 1 - .../versioning/ComparableVersion.java | 18 ++-- .../versioning/DefaultArtifactVersion.java | 2 +- .../maven/artifact/ArtifactScopeEnum.java | 2 +- .../DefaultRepositoryMetadataManager.java | 30 +++--- .../repository/metadata/MetadataBridge.java | 1 - .../resolver/DefaultArtifactResolver.java | 97 ++++++++++++------- .../AbstractStringBasedModelInterpolator.java | 6 +- .../validation/DefaultModelValidator.java | 4 - .../maven/repository/MetadataGraphNode.java | 4 +- .../DefaultArtifactRepositoryFactory.java | 2 +- .../DefaultLegacyArtifactCollector.java | 4 +- .../repository/metadata/ArtifactMetadata.java | 16 +-- .../repository/metadata/MetadataGraph.java | 2 +- .../metadata/MetadataGraphEdge.java | 10 +- .../metadata/MetadataResolution.java | 2 +- .../project/DefaultModelBuildingListener.java | 16 +-- .../apache/maven/project/MavenProject.java | 30 +++--- .../maven/project/ProjectBuildingRequest.java | 2 +- .../maven/repository/RepositorySystem.java | 12 +-- .../apache/maven/cli/CLIReportingUtils.java | 12 ++- .../java/org/apache/maven/cli/MavenCli.java | 2 +- 22 files changed, 157 insertions(+), 118 deletions(-) diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryPolicy.java b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryPolicy.java index 306c90b965..f76e2c1377 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryPolicy.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryPolicy.java @@ -21,7 +21,6 @@ package org.apache.maven.artifact.repository; import java.util.Calendar; import java.util.Date; -import java.util.TimeZone; /** * Describes a set of policies for a repository to use under certain conditions. diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java index da654c8492..481e845d87 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java @@ -69,9 +69,9 @@ public class ComparableVersion private interface Item { - final int INTEGER_ITEM = 0; - final int STRING_ITEM = 1; - final int LIST_ITEM = 2; + int INTEGER_ITEM = 0; + int STRING_ITEM = 1; + int LIST_ITEM = 2; int compareTo( Item item ); @@ -86,7 +86,7 @@ public class ComparableVersion private static class IntegerItem implements Item { - private static final BigInteger BigInteger_ZERO = new BigInteger( "0" ); + private static final BigInteger BIG_INTEGER_ZERO = new BigInteger( "0" ); private final BigInteger value; @@ -94,7 +94,7 @@ public class ComparableVersion private IntegerItem() { - this.value = BigInteger_ZERO; + this.value = BIG_INTEGER_ZERO; } public IntegerItem( String str ) @@ -109,14 +109,14 @@ public class ComparableVersion public boolean isNull() { - return BigInteger_ZERO.equals( value ); + return BIG_INTEGER_ZERO.equals( value ); } public int compareTo( Item item ) { if ( item == null ) { - return BigInteger_ZERO.equals( value ) ? 0 : 1; // 1.0 == 1, 1.1 > 1 + return BIG_INTEGER_ZERO.equals( value ) ? 0 : 1; // 1.0 == 1, 1.1 > 1 } switch ( item.getType() ) @@ -266,7 +266,7 @@ public class ComparableVersion void normalize() { - for( ListIterator iterator = listIterator( size() ); iterator.hasPrevious(); ) + for ( ListIterator iterator = listIterator( size() ); iterator.hasPrevious(); ) { Item item = iterator.previous(); if ( item.isNull() ) @@ -327,7 +327,7 @@ public class ComparableVersion public String toString() { StringBuilder buffer = new StringBuilder( "(" ); - for( Iterator iter = iterator(); iter.hasNext(); ) + for ( Iterator iter = iterator(); iter.hasNext(); ) { buffer.append( iter.next() ); if ( iter.hasNext() ) 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 b588340937..db71dc700c 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 @@ -72,7 +72,7 @@ public class DefaultArtifactVersion { if ( otherVersion instanceof DefaultArtifactVersion ) { - return this.comparable.compareTo( ( (DefaultArtifactVersion) otherVersion).comparable ); + return this.comparable.compareTo( ( (DefaultArtifactVersion) otherVersion ).comparable ); } else { diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java b/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java index 574f7d6d55..c6d02c6fde 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java @@ -108,7 +108,7 @@ public enum ArtifactScopeEnum { final ArtifactScopeEnum s = checkScope( scope ); - // system scope is historic only - and simple + // system scope is historic only - and simple if ( id == system.id ) { return scope.id == system.id; diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java index 0f1030b2e6..cbdcf07bee 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java @@ -1,18 +1,22 @@ 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 regarding - * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. You may obtain a - * copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. + * 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 + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ import java.io.File; @@ -47,7 +51,7 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException; /** * @author Jason van Zyl */ -@Component(role=RepositoryMetadataManager.class) +@Component( role = RepositoryMetadataManager.class ) public class DefaultRepositoryMetadataManager extends AbstractLogEnabled implements RepositoryMetadataManager diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java index a1fb1e8426..8024d310b1 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java @@ -24,7 +24,6 @@ import java.io.File; import org.apache.maven.artifact.metadata.ArtifactMetadata; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.DefaultArtifactRepository; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadata; import org.codehaus.plexus.util.FileUtils; import org.sonatype.aether.RepositoryException; import org.sonatype.aether.metadata.MergeableMetadata; diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java index 2b978b0b44..18deeb2f5e 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java @@ -1,18 +1,22 @@ package org.apache.maven.artifact.resolver; /* - * 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 regarding - * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. You may obtain a - * copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. + * 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 + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ import java.io.File; @@ -65,7 +69,7 @@ import org.sonatype.aether.resolution.ArtifactResult; /** * @author Jason van Zyl */ -@Component(role = ArtifactResolver.class) +@Component( role = ArtifactResolver.class ) public class DefaultArtifactResolver implements ArtifactResolver { @@ -111,7 +115,8 @@ public class DefaultArtifactResolver else { executor = - new ThreadPoolExecutor( 0, threads, 3, TimeUnit.SECONDS, new LinkedBlockingQueue(), new DaemonThreadCreator()); + new ThreadPoolExecutor( 0, threads, 3, TimeUnit.SECONDS, new LinkedBlockingQueue(), + new DaemonThreadCreator() ); } } @@ -151,19 +156,22 @@ public class DefaultArtifactResolver } } - public void resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository, TransferListener resolutionListener ) + public void resolve( Artifact artifact, List remoteRepositories, + ArtifactRepository localRepository, TransferListener resolutionListener ) throws ArtifactResolutionException, ArtifactNotFoundException { resolve( artifact, remoteRepositories, getSession( localRepository ) ); } - public void resolveAlways( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository ) + public void resolveAlways( Artifact artifact, List remoteRepositories, + ArtifactRepository localRepository ) throws ArtifactResolutionException, ArtifactNotFoundException { resolve( artifact, remoteRepositories, getSession( localRepository ) ); } - private void resolve( Artifact artifact, List remoteRepositories, RepositorySystemSession session ) + private void resolve( Artifact artifact, List remoteRepositories, + RepositorySystemSession session ) throws ArtifactResolutionException, ArtifactNotFoundException { if ( artifact == null ) @@ -249,52 +257,73 @@ public class DefaultArtifactResolver } } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, ArtifactRepository localRepository, List remoteRepositories, + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + ArtifactRepository localRepository, + List remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter ) throws ArtifactResolutionException, ArtifactNotFoundException { - return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository, remoteRepositories, source, filter ); + return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository, + remoteRepositories, source, filter ); } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, - List remoteRepositories, ArtifactMetadataSource source ) + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, + ArtifactMetadataSource source ) throws ArtifactResolutionException, ArtifactNotFoundException { - return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, null ); + return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, + remoteRepositories, source, null ); } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, - List remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter ) + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, + ArtifactMetadataSource source, ArtifactFilter filter ) throws ArtifactResolutionException, ArtifactNotFoundException { - return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, filter, null ); + return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, + remoteRepositories, source, filter, null ); } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, List remoteRepositories, ArtifactRepository localRepository, + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + List remoteRepositories, + ArtifactRepository localRepository, ArtifactMetadataSource source ) throws ArtifactResolutionException, ArtifactNotFoundException { return resolveTransitively( artifacts, originatingArtifact, localRepository, remoteRepositories, source, null ); } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, List remoteRepositories, ArtifactRepository localRepository, - ArtifactMetadataSource source, List listeners ) + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + List remoteRepositories, + ArtifactRepository localRepository, + ArtifactMetadataSource source, + List listeners ) throws ArtifactResolutionException, ArtifactNotFoundException { return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository, remoteRepositories, source, null, listeners ); } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, - List remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter, List listeners ) + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, + ArtifactMetadataSource source, ArtifactFilter filter, + List listeners ) throws ArtifactResolutionException, ArtifactNotFoundException { - return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, filter, listeners, null ); + return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, + remoteRepositories, source, filter, listeners, null ); } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, - List remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter, List listeners, + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, + ArtifactMetadataSource source, ArtifactFilter filter, + List listeners, List conflictResolvers ) throws ArtifactResolutionException, ArtifactNotFoundException { @@ -336,7 +365,7 @@ public class DefaultArtifactResolver { Artifact rootArtifact = request.getArtifact(); Set artifacts = request.getArtifactDependencies(); - Map managedVersions = request.getManagedVersionMap(); + Map managedVersions = request.getManagedVersionMap(); List listeners = request.getListeners(); ArtifactFilter collectionFilter = request.getCollectionFilter(); ArtifactFilter resolutionFilter = request.getResolutionFilter(); diff --git a/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java b/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java index aff88e0a03..f4a1b5c41a 100644 --- a/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java +++ b/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java @@ -283,7 +283,7 @@ public abstract class AbstractStringBasedModelInterpolator pathTranslator ) ); } - @SuppressWarnings("unchecked") + @SuppressWarnings( "unchecked" ) protected String interpolateInternal( String src, List valueSources, List postProcessors, boolean debug ) throws ModelInterpolationException @@ -296,7 +296,7 @@ public abstract class AbstractStringBasedModelInterpolator Logger logger = getLogger(); String result = src; - synchronized( this ) + synchronized ( this ) { for ( ValueSource vs : valueSources ) @@ -315,7 +315,7 @@ public abstract class AbstractStringBasedModelInterpolator { result = interpolator.interpolate( result, recursionInterceptor ); } - catch( InterpolationException e ) + catch ( InterpolationException e ) { throw new ModelInterpolationException( e.getMessage(), e ); } diff --git a/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java b/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java index a6782d69f0..0095f80382 100644 --- a/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java +++ b/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java @@ -19,15 +19,11 @@ package org.apache.maven.project.validation; * under the License. */ -import java.util.List; -import org.apache.maven.model.InputLocation; import org.apache.maven.model.Model; import org.apache.maven.model.building.DefaultModelBuildingRequest; import org.apache.maven.model.building.ModelBuildingRequest; import org.apache.maven.model.building.ModelProblem; import org.apache.maven.model.building.ModelProblemCollector; -import org.apache.maven.model.building.ModelProblem.Severity; -import org.apache.maven.model.building.ModelProblem.Version; import org.apache.maven.model.building.ModelProblemCollectorRequest; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; diff --git a/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java b/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java index 3940cf336d..22394e7078 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java @@ -41,8 +41,8 @@ public class MetadataGraphNode public MetadataGraphNode() { - inNodes = new ArrayList(4); - exNodes = new ArrayList(8); + inNodes = new ArrayList( 4 ); + exNodes = new ArrayList( 8 ); } public MetadataGraphNode( MavenArtifactMetadata metadata ) diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java index 85a6bc45da..4bc911673d 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java @@ -43,7 +43,7 @@ public class DefaultArtifactRepositoryFactory private String globalChecksumPolicy; @Requirement( role = ArtifactRepositoryLayout.class ) - private Map repositoryLayouts; + private Map repositoryLayouts; public ArtifactRepositoryLayout getLayout( String layoutId ) throws UnknownRepositoryLayoutException diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java index 651d46e8ce..d69e8125f8 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java @@ -63,10 +63,10 @@ import org.codehaus.plexus.logging.Logger; public class DefaultLegacyArtifactCollector implements LegacyArtifactCollector { - @Requirement(hint="nearest") + @Requirement( hint = "nearest" ) private ConflictResolver defaultConflictResolver; - @Requirement + @Requirement private Logger logger; @Requirement diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java index 00749470d5..2666eafb62 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java @@ -28,7 +28,6 @@ import org.apache.maven.artifact.ArtifactScopeEnum; * Artifact Metadata that is resolved independent of Artifact itself. * * @author Oleg Gusakov - * */ public class ArtifactMetadata { @@ -291,7 +290,7 @@ public class ArtifactMetadata return artifactExists; } - public void setArtifactExists(boolean artifactExists) + public void setArtifactExists( boolean artifactExists ) { this.artifactExists = artifactExists; } @@ -302,7 +301,7 @@ public class ArtifactMetadata return dependencies; } - public void setDependencies(Collection dependencies) + public void setDependencies( Collection dependencies ) { this.dependencies = dependencies; } @@ -312,7 +311,7 @@ public class ArtifactMetadata return artifactUri; } - public void setArtifactUri(String artifactUri) + public void setArtifactUri( String artifactUri ) { this.artifactUri = artifactUri; } @@ -322,23 +321,28 @@ public class ArtifactMetadata { return why; } - public void setWhy(String why) + + public void setWhy( String why ) { this.why = why; } + //------------------------------------------------------------------- public String getError() { return error; } - public void setError(String error) + + public void setError( String error ) { this.error = error; } + public boolean isError() { return error == null; } + //------------------------------------------------------------------ public String getDependencyConflictId() { diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java index d898739275..b116c69f06 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java @@ -294,7 +294,7 @@ public class MetadataGraph //------------------------------------------------------------------------ public List getEdgesBetween( MetadataGraphVertex vFrom, MetadataGraphVertex vTo ) { - List edges = getIncidentEdges(vTo); + List edges = getIncidentEdges( vTo ); if ( edges == null || edges.isEmpty() ) { return null; diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java index 4a50b207b7..9d86933ab2 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java @@ -125,10 +125,10 @@ public class MetadataGraphEdge this.depth = depth; } - public boolean isResolved() - { - return resolved; - } + public boolean isResolved() + { + return resolved; + } public void setResolved( boolean resolved ) { @@ -175,7 +175,7 @@ public class MetadataGraphEdge this.target = target; } - @Override + @Override public String toString() { return "[ " + "FROM:(" diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java index 770ae79d2f..9a9130b2fa 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java @@ -62,7 +62,7 @@ public class MetadataResolution return artifactMetadata; } - public void setArtifactMetadata(ArtifactMetadata artifactMetadata) + public void setArtifactMetadata( ArtifactMetadata artifactMetadata ) { this.artifactMetadata = artifactMetadata; } diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java b/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java index 30423ce4ab..ca2663845b 100644 --- a/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java +++ b/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java @@ -97,9 +97,9 @@ class DefaultModelBuildingListener } catch ( Exception e ) { - event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE) + event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) .setMessage( "Invalid plugin repository: " + e.getMessage() ) - .setException( e )); + .setException( e ) ); } project.setPluginArtifactRepositories( pluginRepositories ); @@ -115,15 +115,15 @@ class DefaultModelBuildingListener } catch ( PluginResolutionException e ) { - event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE) + event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) .setMessage( "Unresolveable build extension: " + e.getMessage()) - .setException( e )); + .setException( e ) ); } catch ( PluginVersionResolutionException e ) { - event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE) + event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) .setMessage( "Unresolveable build extension: " + e.getMessage() ) - .setException( e )); + .setException( e ) ); } projectBuildingHelper.selectProjectRealm( project ); @@ -138,9 +138,9 @@ class DefaultModelBuildingListener } catch ( Exception e ) { - event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE) + event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) .setMessage( "Invalid artifact repository: " + e.getMessage() ) - .setException( e )); + .setException( e ) ); } project.setRemoteArtifactRepositories( remoteRepositories ); } diff --git a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java index 5090c3e4f7..0349e8aa86 100644 --- a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java +++ b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java @@ -1,18 +1,22 @@ package org.apache.maven.project; /* - * 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 regarding - * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. You may obtain a - * copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. + * 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 + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ import org.apache.maven.RepositoryUtils; @@ -1477,7 +1481,7 @@ public class MavenProject for ( int ax = 0; ax < attachedArtifacts.size(); ax++ ) { Artifact a = attachedArtifacts.get( ax ); - if ( a.equals( artifact )) + if ( a.equals( artifact ) ) { if ( logger != null ) { diff --git a/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java b/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java index 39522f6843..db8fe902fa 100644 --- a/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java +++ b/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java @@ -79,7 +79,7 @@ public interface ProjectBuildingRequest */ Properties getUserProperties(); - void setProject(MavenProject mavenProject); + void setProject( MavenProject mavenProject ); MavenProject getProject(); diff --git a/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java b/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java index 147b7cf8ef..7bcd442539 100644 --- a/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java +++ b/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java @@ -42,17 +42,17 @@ import org.sonatype.aether.RepositorySystemSession; */ public interface RepositorySystem { - final String DEFAULT_LOCAL_REPO_ID = "local"; + String DEFAULT_LOCAL_REPO_ID = "local"; - final String userHome = System.getProperty( "user.home" ); + String userHome = System.getProperty( "user.home" ); - final File userMavenConfigurationHome = new File( userHome, ".m2" ); + File userMavenConfigurationHome = new File( userHome, ".m2" ); - final File defaultUserLocalRepository = new File( userMavenConfigurationHome, "repository" ); + File defaultUserLocalRepository = new File( userMavenConfigurationHome, "repository" ); - final String DEFAULT_REMOTE_REPO_ID = "central"; + String DEFAULT_REMOTE_REPO_ID = "central"; - final String DEFAULT_REMOTE_REPO_URL = "http://repo.maven.apache.org/maven2"; + String DEFAULT_REMOTE_REPO_URL = "http://repo.maven.apache.org/maven2"; Artifact createArtifact( String groupId, String artifactId, String version, String packaging ); diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java index 0f8262b102..8f1ae8e163 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java @@ -53,11 +53,15 @@ public final class CLIReportingUtils Properties properties = getBuildProperties(); StringBuffer version = new StringBuffer(); version.append( createMavenVersionString( properties ) ).append( LS ); - version.append( reduce( properties.getProperty( "distributionShortName" ) + " home: " + System.getProperty( "maven.home", "" ) ) ).append( LS ); - version.append( "Java version: " + System.getProperty( "java.version", "" ) + ", vendor: " + System.getProperty( "java.vendor", "" ) ).append( LS ); + version.append( reduce( properties.getProperty( "distributionShortName" ) + " home: " + + System.getProperty( "maven.home", "" ) ) ).append( LS ); + version.append( "Java version: " + System.getProperty( "java.version", "" ) + + ", vendor: " + System.getProperty( "java.vendor", "" ) ).append( LS ); version.append( "Java home: " + System.getProperty( "java.home", "" ) ).append( LS ); - version.append( "Default locale: " + Locale.getDefault() + ", platform encoding: " + System.getProperty( "file.encoding", "" ) ).append( LS ); - version.append( "OS name: \"" + Os.OS_NAME + "\", version: \"" + Os.OS_VERSION + "\", arch: \"" + Os.OS_ARCH + "\", family: \"" + Os.OS_FAMILY + "\"" ); + version.append( "Default locale: " + Locale.getDefault() + ", platform encoding: " + + System.getProperty( "file.encoding", "" ) ).append( LS ); + version.append( "OS name: \"" + Os.OS_NAME + "\", version: \"" + Os.OS_VERSION + "\", arch: \"" + Os.OS_ARCH + + "\", family: \"" + Os.OS_FAMILY + "\"" ); return version.toString(); } diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 81d520b65d..e744e65ed3 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -233,7 +233,7 @@ public class MavenCli } finally { - if (localContainer != null) + if ( localContainer != null ) { localContainer.dispose(); }