From 9009b8f8589e85d66915f535b471a664b69a9db5 Mon Sep 17 00:00:00 2001 From: Herve Boutemy Date: Sun, 25 Nov 2012 11:04:16 +0000 Subject: [PATCH] fixed errors reported by Checkstyle git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1413335 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/DefaultArtifactFilterManager.java | 4 +- .../java/org/apache/maven/DefaultMaven.java | 45 +++++++------------ .../DefaultProjectDependenciesResolver.java | 6 +-- .../maven/ProjectBuildFailureException.java | 19 ++++++++ .../java/org/apache/maven/ReactorReader.java | 6 +-- .../metadata/io/MetadataReader.java | 2 +- .../exception/DefaultExceptionHandler.java | 6 ++- .../apache/maven/cli/CLIReportingUtils.java | 4 +- .../java/org/apache/maven/cli/MavenCli.java | 4 +- .../BatchModeMavenTransferListener.java | 4 +- 10 files changed, 54 insertions(+), 46 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java b/maven-core/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java index 55a576075f..9d772f70b4 100644 --- a/maven-core/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java +++ b/maven-core/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java @@ -37,7 +37,7 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti * @author Jason van Zyl * @todo this should probably be a component with some dynamic control of filtering */ -@Component(role = ArtifactFilterManager.class) +@Component( role = ArtifactFilterManager.class ) public class DefaultArtifactFilterManager implements ArtifactFilterManager { @@ -90,7 +90,7 @@ public class DefaultArtifactFilterManager * wagon from their plugin realm. */ - DEFAULT_EXCLUSIONS = Collections.unmodifiableSet( artifacts); + DEFAULT_EXCLUSIONS = Collections.unmodifiableSet( artifacts ); } protected Set excludedArtifacts = new HashSet( DEFAULT_EXCLUSIONS ); diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java index bdfacbf55c..e80185bbda 100644 --- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java +++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java @@ -1,18 +1,22 @@ package org.apache.maven; /* - * 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; @@ -79,26 +83,11 @@ import org.codehaus.plexus.util.xml.Xpp3Dom; import org.sonatype.aether.ConfigurationProperties; import org.sonatype.aether.RepositorySystem; import org.sonatype.aether.RepositorySystemSession; -import org.sonatype.aether.collection.DependencyGraphTransformer; -import org.sonatype.aether.collection.DependencyManager; -import org.sonatype.aether.collection.DependencySelector; -import org.sonatype.aether.collection.DependencyTraverser; import org.sonatype.aether.repository.Authentication; import org.sonatype.aether.repository.LocalRepository; import org.sonatype.aether.repository.RepositoryPolicy; import org.sonatype.aether.repository.WorkspaceReader; import org.sonatype.aether.util.DefaultRepositorySystemSession; -import org.sonatype.aether.util.graph.manager.ClassicDependencyManager; -import org.sonatype.aether.util.graph.selector.AndDependencySelector; -import org.sonatype.aether.util.graph.selector.ExclusionDependencySelector; -import org.sonatype.aether.util.graph.selector.OptionalDependencySelector; -import org.sonatype.aether.util.graph.selector.ScopeDependencySelector; -import org.sonatype.aether.util.graph.transformer.ChainedDependencyGraphTransformer; -import org.sonatype.aether.util.graph.transformer.NearestVersionConflictResolver; -import org.sonatype.aether.util.graph.transformer.ConflictMarker; -import org.sonatype.aether.util.graph.transformer.JavaDependencyContextRefiner; -import org.sonatype.aether.util.graph.transformer.JavaEffectiveScopeCalculator; -import org.sonatype.aether.util.graph.traverser.FatArtifactTraverser; import org.sonatype.aether.util.repository.ChainedWorkspaceReader; import org.sonatype.aether.util.repository.DefaultAuthenticationSelector; import org.sonatype.aether.util.repository.DefaultMirrorSelector; @@ -107,7 +96,7 @@ import org.sonatype.aether.util.repository.DefaultProxySelector; /** * @author Jason van Zyl */ -@Component(role = Maven.class) +@Component( role = Maven.class ) public class DefaultMaven implements Maven { diff --git a/maven-core/src/main/java/org/apache/maven/DefaultProjectDependenciesResolver.java b/maven-core/src/main/java/org/apache/maven/DefaultProjectDependenciesResolver.java index 4d6fa14bee..d511d1d04e 100644 --- a/maven-core/src/main/java/org/apache/maven/DefaultProjectDependenciesResolver.java +++ b/maven-core/src/main/java/org/apache/maven/DefaultProjectDependenciesResolver.java @@ -42,7 +42,7 @@ import org.apache.maven.repository.RepositorySystem; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; -@Component(role = ProjectDependenciesResolver.class) +@Component( role = ProjectDependenciesResolver.class ) public class DefaultProjectDependenciesResolver implements ProjectDependenciesResolver { @@ -97,8 +97,8 @@ public class DefaultProjectDependenciesResolver return resolved; } - if ( ( scopesToCollect == null || scopesToCollect.isEmpty() ) && - ( scopesToResolve == null || scopesToResolve.isEmpty() ) ) + if ( ( scopesToCollect == null || scopesToCollect.isEmpty() ) + && ( scopesToResolve == null || scopesToResolve.isEmpty() ) ) { return resolved; } diff --git a/maven-core/src/main/java/org/apache/maven/ProjectBuildFailureException.java b/maven-core/src/main/java/org/apache/maven/ProjectBuildFailureException.java index 1e9509842b..480f9c5a5a 100644 --- a/maven-core/src/main/java/org/apache/maven/ProjectBuildFailureException.java +++ b/maven-core/src/main/java/org/apache/maven/ProjectBuildFailureException.java @@ -1,5 +1,24 @@ package org.apache.maven; +/* + * 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.plugin.MojoFailureException; /** diff --git a/maven-core/src/main/java/org/apache/maven/ReactorReader.java b/maven-core/src/main/java/org/apache/maven/ReactorReader.java index 9afe864765..4e1a638f47 100644 --- a/maven-core/src/main/java/org/apache/maven/ReactorReader.java +++ b/maven-core/src/main/java/org/apache/maven/ReactorReader.java @@ -43,9 +43,9 @@ import java.util.Map; class ReactorReader implements WorkspaceReader { - private final static Collection JAR_LIKE_TYPES = Arrays.asList( "jar", "test-jar", "ejb-client" ); + private static final Collection JAR_LIKE_TYPES = Arrays.asList( "jar", "test-jar", "ejb-client" ); - private final static Collection COMPILE_PHASE_TYPES = Arrays.asList( "jar", "ejb-client" ); + private static final Collection COMPILE_PHASE_TYPES = Arrays.asList( "jar", "ejb-client" ); private Map projectsByGAV; @@ -103,7 +103,7 @@ class ReactorReader } else { - String type = artifact.getProperty( "type", ""); + String type = artifact.getProperty( "type", "" ); if ( project.hasLifecyclePhase( "compile" ) && COMPILE_PHASE_TYPES.contains( type ) ) { return new File( project.getBuild().getOutputDirectory() ); diff --git a/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/MetadataReader.java b/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/MetadataReader.java index 7f554e4346..232246fd1d 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/MetadataReader.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/MetadataReader.java @@ -39,7 +39,7 @@ public interface MetadataReader * The key for the option to enable strict parsing. This option is of type {@link Boolean} and defaults to {@code * true}. If {@code false}, unknown elements will be ignored instead of causing a failure. */ - final String IS_STRICT = "org.apache.maven.artifact.repository.metadata.io.isStrict"; + String IS_STRICT = "org.apache.maven.artifact.repository.metadata.io.isStrict"; /** * Reads the metadata from the specified file. diff --git a/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java b/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java index ddbe038fe1..6066593f7b 100644 --- a/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java +++ b/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java @@ -179,9 +179,11 @@ public class DefaultExceptionHandler reference = MojoExecutionException.class.getSimpleName(); Throwable cause = exception.getCause(); - if ( cause instanceof IOException ) { + if ( cause instanceof IOException ) + { cause = cause.getCause(); - if ( cause instanceof ConnectException ) { + if ( cause instanceof ConnectException ) + { reference = ConnectException.class.getSimpleName(); } } 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 a88a0abaa8..0f8262b102 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 @@ -21,8 +21,6 @@ package org.apache.maven.cli; import java.io.IOException; import java.io.InputStream; -import java.io.OutputStream; -import java.io.PrintStream; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; @@ -51,7 +49,7 @@ public final class CLIReportingUtils public static String showVersion() { - String LS = System.getProperty("line.separator"); + final String LS = System.getProperty( "line.separator" ); Properties properties = getBuildProperties(); StringBuffer version = new StringBuffer(); version.append( createMavenVersionString( properties ) ).append( LS ); 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 f6378201ec..772f984494 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 @@ -283,7 +283,7 @@ public class MavenCli if ( cliRequest.commandLine.hasOption( CLIManager.VERSION ) ) { - System.out.println(CLIReportingUtils.showVersion()); + System.out.println( CLIReportingUtils.showVersion() ); throw new ExitException( 0 ); } } @@ -417,7 +417,7 @@ public class MavenCli eventSpyDispatcher.init( eventSpyContext ); // refresh logger in case container got customized by spy - slf4jLogger = slf4jLoggerFactory.getLogger(this.getClass().getName()); + slf4jLogger = slf4jLoggerFactory.getLogger( this.getClass().getName() ); maven = container.lookup( Maven.class ); diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/BatchModeMavenTransferListener.java b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/BatchModeMavenTransferListener.java index ca65d943a7..0e20f17f8d 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/BatchModeMavenTransferListener.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/BatchModeMavenTransferListener.java @@ -1,7 +1,5 @@ package org.apache.maven.cli.transfer; -import java.io.PrintStream; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -21,6 +19,8 @@ import java.io.PrintStream; * under the License. */ +import java.io.PrintStream; + public class BatchModeMavenTransferListener extends AbstractMavenTransferListener {