diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenAetherModule.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenAetherModule.java index 0432cdb6d0..6f391fd434 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenAetherModule.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenAetherModule.java @@ -1,5 +1,24 @@ package org.apache.maven.repository.internal; +/* + * 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.util.Collections; import java.util.HashSet; import java.util.Set; 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 c80134f993..82d9b61148 100644 --- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java +++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java @@ -171,17 +171,17 @@ public class DefaultMaven } catch ( OutOfMemoryError e ) { - result = addExceptionToResult(new DefaultMavenExecutionResult(), e); + result = addExceptionToResult( new DefaultMavenExecutionResult(), e ); } catch ( MavenExecutionRequestPopulationException e ) { - result = addExceptionToResult(new DefaultMavenExecutionResult(), e); + result = addExceptionToResult( new DefaultMavenExecutionResult(), e ); } catch ( RuntimeException e ) { result = - addExceptionToResult(new DefaultMavenExecutionResult(), - new InternalErrorException("Internal error: " + e, e)); + addExceptionToResult( new DefaultMavenExecutionResult(), + new InternalErrorException( "Internal error: " + e, e ) ); } finally { @@ -191,7 +191,6 @@ public class DefaultMaven return result; } - @SuppressWarnings({"ThrowableInstanceNeverThrown", "ThrowableResultOfMethodCallIgnored"}) private MavenExecutionResult doExecute( MavenExecutionRequest request ) { //TODO: Need a general way to inject standard properties @@ -211,7 +210,7 @@ public class DefaultMaven } catch ( LocalRepositoryNotAccessibleException e ) { - return addExceptionToResult(result, e); + return addExceptionToResult( result, e ); } DelegatingLocalArtifactRepository delegatingLocalArtifactRepository = @@ -233,7 +232,7 @@ public class DefaultMaven } catch ( MavenExecutionException e ) { - return addExceptionToResult(result, e); + return addExceptionToResult( result, e ); } eventCatapult.fire( ExecutionEvent.Type.ProjectDiscoveryStarted, session, null ); @@ -249,7 +248,7 @@ public class DefaultMaven } catch ( ProjectBuildingException e ) { - return addExceptionToResult(result, e); + return addExceptionToResult( result, e ); } session.setProjects( projects ); @@ -275,7 +274,7 @@ public class DefaultMaven } catch ( org.apache.maven.DuplicateProjectException e ) { - return addExceptionToResult(result, e); + return addExceptionToResult( result, e ); } repoSession.setReadOnly(); @@ -292,7 +291,7 @@ public class DefaultMaven } catch ( MavenExecutionException e ) { - return addExceptionToResult(result, e); + return addExceptionToResult( result, e ); } finally { @@ -315,15 +314,15 @@ public class DefaultMaven ProjectCycleException error = new ProjectCycleException( message, e ); - return addExceptionToResult(result, error); + return addExceptionToResult( result, error ); } catch ( DuplicateProjectException e ) { - return addExceptionToResult(result, e); + return addExceptionToResult( result, e ); } catch ( MavenExecutionException e ) { - return addExceptionToResult(result, e); + return addExceptionToResult( result, e ); } result.setTopologicallySortedProjects( session.getProjects() ); @@ -339,7 +338,7 @@ public class DefaultMaven if ( session.getResult().hasExceptions() ) { - return addExceptionToResult(result, session.getResult().getExceptions().get(0)); + return addExceptionToResult( result, session.getResult().getExceptions().get( 0 ) ); } return result; @@ -592,7 +591,7 @@ public class DefaultMaven return lifecycleListeners; } - private MavenExecutionResult addExceptionToResult(MavenExecutionResult result, Throwable e) + private MavenExecutionResult addExceptionToResult( MavenExecutionResult result, Throwable e ) { if ( !result.getExceptions().contains( e ) ) { 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 be1efb3399..90d102f9d9 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/lifecycle/internal/LifecycleThreadedBuilder.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleThreadedBuilder.java index dbd3f4f992..d5c7d9b845 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleThreadedBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleThreadedBuilder.java @@ -67,20 +67,20 @@ public class LifecycleThreadedBuilder for ( TaskSegment taskSegment : currentTaskSegment ) { Map projectBuildMap = projectBuilds.selectSegment( taskSegment ); - try - { + try + { multiThreadedProjectTaskSegmentBuild( analyzer, reactorContext, session, service, taskSegment, projectBuildMap, muxer ); - if ( reactorContext.getReactorBuildStatus().isHalted( ) ) - { - break; - } - } - catch ( Exception e ) + if ( reactorContext.getReactorBuildStatus().isHalted() ) { - session.getResult().addException(e); break; } + } + catch ( Exception e ) + { + session.getResult().addException( e ); + break; + } } } @@ -126,12 +126,12 @@ public class LifecycleThreadedBuilder } catch ( InterruptedException e ) { - rootSession.getResult().addException(e); + rootSession.getResult().addException( e ); break; } catch ( ExecutionException e ) { - rootSession.getResult().addException(e); + rootSession.getResult().addException( e ); break; } } diff --git a/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java b/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java index 4027fccf0f..f14bfc0a37 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java @@ -100,29 +100,29 @@ public class PluginParameterException } } - messageBuffer.append( "Inside the definition for plugin \'"); + messageBuffer.append( "Inside the definition for plugin \'" ); messageBuffer.append( mojo.getPluginDescriptor().getArtifactId() ); messageBuffer.append( "\', specify the following:\n\n\n ...\n" ); messageBuffer.append( " <" ).append( param.getName() ).append( '>' ); - if( isArray || isCollection ) + if ( isArray || isCollection ) { - messageBuffer.append( '\n' ); + messageBuffer.append( '\n' ); messageBuffer.append( " " ); } else if ( isProperties ) { - messageBuffer.append( '\n' ); + messageBuffer.append( '\n' ); messageBuffer.append( " \n" ); messageBuffer.append( " KEY\n" ); messageBuffer.append( " " ); } else if ( isMap ) { - messageBuffer.append( '\n' ); + messageBuffer.append( '\n' ); messageBuffer.append( " " ); } messageBuffer.append( "VALUE" ); - if( isArray || isCollection ) + if ( isArray || isCollection ) { messageBuffer.append( "\n" ); messageBuffer.append( " " ); 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 9ed113dad4..2055d5e656 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 @@ -122,8 +122,9 @@ public interface ProjectBuildingRequest List getInactiveProfileIds(); /** - * Add a {@link org.apache.maven.model.Profile} that has come from an external source. This may be from a custom configuration - * like the MavenCLI settings.xml file, or from a custom dialog in an IDE integration like M2Eclipse. + * Add a {@link org.apache.maven.model.Profile} that has come from an external source. This may be from a custom + * configuration like the MavenCLI settings.xml file, or from a custom dialog in an IDE integration like M2Eclipse. + * * @param profile */ void addProfile( Profile profile ); @@ -143,7 +144,6 @@ public interface ProjectBuildingRequest * Sets the start time of the build. * * @param buildStartTime The start time of the build, may be {@code null}. - * @return This request, never {@code null}. */ void setBuildStartTime( Date buildStartTime ); diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java index d30a16dcae..73a906ab0d 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java @@ -97,7 +97,7 @@ public class CLIManager public static final String THREADS = "T"; - public static final String LEGACY_LOCAL_REPOSITORY ="llr"; + public static final String LEGACY_LOCAL_REPOSITORY = "llr"; protected Options options; diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java index 661c9e3eb4..ca1034be6c 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java @@ -27,7 +27,10 @@ package org.apache.maven.cli.logging; */ public interface Slf4jConfiguration { - public static enum Level { DEBUG, INFO, ERROR } + public static enum Level + { + DEBUG, INFO, ERROR + } /** * Set root logging level. diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Log4j2Configuration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Log4j2Configuration.java index 9cec3ccb80..5637b64afd 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Log4j2Configuration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Log4j2Configuration.java @@ -43,7 +43,7 @@ public class Log4j2Configuration value = "info"; break; - case ERROR: + default: value = "error"; break; } diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java index b72940a3a7..256478fd4c 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java @@ -45,7 +45,7 @@ public class LogbackConfiguration value = ch.qos.logback.classic.Level.INFO; break; - case ERROR: + default: value = ch.qos.logback.classic.Level.ERROR; break; } diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java index 6a7f38518e..94a80a65d0 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java @@ -45,7 +45,7 @@ public class Slf4jSimpleConfiguration value = "info"; break; - case ERROR: + default: value = "error"; break; } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileActivationContext.java b/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileActivationContext.java index 5bd1c58383..4fd08253b8 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileActivationContext.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileActivationContext.java @@ -110,7 +110,7 @@ public class DefaultProfileActivationContext * @param systemProperties The system properties, may be {@code null}. * @return This context, never {@code null}. */ - @SuppressWarnings("unchecked") + @SuppressWarnings( "unchecked" ) public DefaultProfileActivationContext setSystemProperties( Properties systemProperties ) { if ( systemProperties != null ) @@ -159,7 +159,7 @@ public class DefaultProfileActivationContext * @param userProperties The user properties, may be {@code null}. * @return This context, never {@code null}. */ - @SuppressWarnings("unchecked") + @SuppressWarnings( "unchecked" ) public DefaultProfileActivationContext setUserProperties( Properties userProperties ) { if ( userProperties != null )