From 4a39c02156a78f3d6398495f14deb9db547a8241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 8 Feb 2014 16:36:34 +0100 Subject: [PATCH 1/2] fixed errors reported by Checkstyle --- .../versioning/DefaultArtifactVersion.java | 2 +- .../maven/artifact/ArtifactScopeEnum.java | 4 +- .../java/org/apache/maven/DefaultMaven.java | 4 +- .../execution/MojoExecutionListener.java | 6 +- .../execution/ProjectExecutionListener.java | 10 +- .../maven/execution/ReactorManager.java | 20 ++- .../scope/WeakMojoExecutionListener.java | 6 +- .../internal/BuildThreadFactory.java | 21 +++- .../lifecycle/internal/ProjectBuildList.java | 18 +-- .../lifecycle/internal/builder/Builder.java | 23 +++- .../builder/BuilderNotFoundException.java | 28 ++++- .../multithreaded/MultiThreadedBuilder.java | 14 ++- .../singlethreaded/SingleThreadedBuilder.java | 19 +++ .../java/org/apache/maven/cli/MavenCli.java | 2 +- .../validation/DefaultModelValidator.java | 117 ++++++++++-------- 15 files changed, 190 insertions(+), 104 deletions(-) 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 cf3dc95d3a..745afddadc 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 @@ -176,7 +176,7 @@ public class DefaultArtifactVersion if ( tok.hasMoreTokens() ) { qualifier = tok.nextToken(); - fallback = Pattern.compile("\\d+").matcher( qualifier ).matches(); + fallback = Pattern.compile( "\\d+" ).matcher( qualifier ).matches(); } // string tokenzier won't detect these and ignores them 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 c6d02c6fde..7051e3bf55 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 @@ -91,7 +91,7 @@ public enum ArtifactScopeEnum } } - private static final ArtifactScopeEnum [][][] _compliancySets = { + private static final ArtifactScopeEnum [][][] COMPLIANCY_SETS = { { { compile }, { compile, provided, system } } , { { test }, { compile, test, provided, system } } , { { runtime }, { compile, runtime, system } } @@ -114,7 +114,7 @@ public enum ArtifactScopeEnum return scope.id == system.id; } - for ( ArtifactScopeEnum[][] set : _compliancySets ) + for ( ArtifactScopeEnum[][] set : COMPLIANCY_SETS ) { if ( id == set[0][0].id ) { 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 a0c3d3b111..e1b66a32d9 100644 --- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java +++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java @@ -320,7 +320,7 @@ public class DefaultMaven { afterSessionEnd( projects, session ); } - catch (MavenExecutionException e) + catch ( MavenExecutionException e ) { return addExceptionToResult( result, e ); } @@ -349,7 +349,7 @@ public class DefaultMaven { afterSessionEnd( projects, session ); } - catch (MavenExecutionException e) + catch ( MavenExecutionException e ) { return addExceptionToResult( result, e ); } diff --git a/maven-core/src/main/java/org/apache/maven/execution/MojoExecutionListener.java b/maven-core/src/main/java/org/apache/maven/execution/MojoExecutionListener.java index 6a4cf2cc54..a14e43ecff 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/MojoExecutionListener.java +++ b/maven-core/src/main/java/org/apache/maven/execution/MojoExecutionListener.java @@ -31,11 +31,11 @@ import org.apache.maven.plugin.MojoExecutionException; */ public interface MojoExecutionListener { - public void beforeMojoExecution( MojoExecutionEvent event ) + void beforeMojoExecution( MojoExecutionEvent event ) throws MojoExecutionException; - public void afterMojoExecutionSuccess( MojoExecutionEvent event ) + void afterMojoExecutionSuccess( MojoExecutionEvent event ) throws MojoExecutionException; - public void afterExecutionFailure( MojoExecutionEvent event ); + void afterExecutionFailure( MojoExecutionEvent event ); } diff --git a/maven-core/src/main/java/org/apache/maven/execution/ProjectExecutionListener.java b/maven-core/src/main/java/org/apache/maven/execution/ProjectExecutionListener.java index 3208f2254a..b19294da0c 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/ProjectExecutionListener.java +++ b/maven-core/src/main/java/org/apache/maven/execution/ProjectExecutionListener.java @@ -29,16 +29,16 @@ import org.apache.maven.lifecycle.LifecycleExecutionException; * @since 3.1.2 * @provisional This interface is part of work in progress and can be changed or removed without notice. */ -public interface ProjectExecutionListener +interface ProjectExecutionListener { - public void beforeProjectExecution( ProjectExecutionEvent event ) + void beforeProjectExecution( ProjectExecutionEvent event ) throws LifecycleExecutionException; - public void beforeProjectLifecycleExecution( ProjectExecutionEvent event ) + void beforeProjectLifecycleExecution( ProjectExecutionEvent event ) throws LifecycleExecutionException; - public void afterProjectExecutionSuccess( ProjectExecutionEvent event ) + void afterProjectExecutionSuccess( ProjectExecutionEvent event ) throws LifecycleExecutionException; - public void afterProjectExecutionFailure( ProjectExecutionEvent event ); + void afterProjectExecutionFailure( ProjectExecutionEvent event ); } diff --git a/maven-core/src/main/java/org/apache/maven/execution/ReactorManager.java b/maven-core/src/main/java/org/apache/maven/execution/ReactorManager.java index bf089ab838..1b99a3be93 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/ReactorManager.java +++ b/maven-core/src/main/java/org/apache/maven/execution/ReactorManager.java @@ -19,7 +19,6 @@ package org.apache.maven.execution; * under the License. */ - import org.apache.maven.artifact.ArtifactUtils; import org.apache.maven.plugin.descriptor.PluginDescriptor; import org.apache.maven.project.DuplicateProjectException; @@ -29,7 +28,6 @@ import org.codehaus.plexus.util.dag.CycleDetectedException; import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; @@ -49,9 +47,9 @@ public class ReactorManager // make projects that depend on me, and projects that I depend on public static final String MAKE_BOTH_MODE = "make-both"; - private List blackList = new ArrayList(); + private List blackList = new ArrayList(); - private Map buildFailuresByProject = new HashMap(); + private Map buildFailuresByProject = new HashMap(); private Map pluginContextsByProjectAndPluginKey = new HashMap(); @@ -59,9 +57,9 @@ public class ReactorManager private final ProjectSorter sorter; - private Map buildSuccessesByProject = new HashMap(); + private Map buildSuccessesByProject = new HashMap(); - public ReactorManager( List projects ) + public ReactorManager( List projects ) throws CycleDetectedException, DuplicateProjectException { this.sorter = new ProjectSorter( projects ); @@ -123,16 +121,14 @@ public class ReactorManager { blackList.add( id ); - List dependents = sorter.getDependents( id ); + List dependents = sorter.getDependents( id ); if ( dependents != null && !dependents.isEmpty() ) { - for ( Object dependent : dependents ) + for ( String dependentId : dependents ) { - String dependentId = (String) dependent; - - if ( !buildSuccessesByProject.containsKey( dependentId ) && !buildFailuresByProject.containsKey( - dependentId ) ) + if ( !buildSuccessesByProject.containsKey( dependentId ) + && !buildFailuresByProject.containsKey( dependentId ) ) { blackList( dependentId ); } diff --git a/maven-core/src/main/java/org/apache/maven/execution/scope/WeakMojoExecutionListener.java b/maven-core/src/main/java/org/apache/maven/execution/scope/WeakMojoExecutionListener.java index fa84bdfd9d..7ab30e9c53 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/scope/WeakMojoExecutionListener.java +++ b/maven-core/src/main/java/org/apache/maven/execution/scope/WeakMojoExecutionListener.java @@ -35,11 +35,11 @@ import org.apache.maven.plugin.MojoExecutionException; */ public interface WeakMojoExecutionListener { - public void beforeMojoExecution( MojoExecutionEvent event ) + void beforeMojoExecution( MojoExecutionEvent event ) throws MojoExecutionException; - public void afterMojoExecutionSuccess( MojoExecutionEvent event ) + void afterMojoExecutionSuccess( MojoExecutionEvent event ) throws MojoExecutionException; - public void afterExecutionFailure( MojoExecutionEvent event ); + void afterExecutionFailure( MojoExecutionEvent event ); } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildThreadFactory.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildThreadFactory.java index eb54418e4c..f2d957586d 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildThreadFactory.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildThreadFactory.java @@ -1,5 +1,24 @@ package org.apache.maven.lifecycle.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.concurrent.ThreadFactory; import java.util.concurrent.atomic.AtomicInteger; @@ -11,7 +30,7 @@ public class BuildThreadFactory { private final AtomicInteger ID = new AtomicInteger(); - private String PREFIX = "BuilderThread"; + private static final String PREFIX = "BuilderThread"; public Thread newThread( Runnable r ) { diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectBuildList.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectBuildList.java index ee596eca4b..ee335db4ad 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectBuildList.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectBuildList.java @@ -145,12 +145,14 @@ public class ProjectBuildList /** * @return a set of all the projects managed by the build */ - public Set getProjects() { - Set projects = new HashSet(); - - for (ProjectSegment s : items) { - projects.add(s.getProject()); - } - return projects; - } + public Set getProjects() + { + Set projects = new HashSet(); + + for ( ProjectSegment s : items ) + { + projects.add( s.getProject() ); + } + return projects; + } } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/Builder.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/Builder.java index d3a04403c7..61ce6cb7df 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/Builder.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/Builder.java @@ -1,5 +1,24 @@ package org.apache.maven.lifecycle.internal.builder; +/* + * 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.List; import java.util.concurrent.ExecutionException; @@ -22,7 +41,7 @@ public interface Builder // Be nice to whittle this down to Session, maybe add task segments to the session. The session really is the // the place to store reactor related information. // - public void build( MavenSession session, ReactorContext reactorContext, ProjectBuildList projectBuilds, - List taskSegments, ReactorBuildStatus reactorBuildStatus ) + void build( MavenSession session, ReactorContext reactorContext, ProjectBuildList projectBuilds, + List taskSegments, ReactorBuildStatus reactorBuildStatus ) throws ExecutionException, InterruptedException; } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderNotFoundException.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderNotFoundException.java index a90c0d46f9..52c668f1b9 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderNotFoundException.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderNotFoundException.java @@ -1,9 +1,29 @@ package org.apache.maven.lifecycle.internal.builder; -public class BuilderNotFoundException extends Exception +/* + * 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. + */ + +public class BuilderNotFoundException + extends Exception { - public BuilderNotFoundException(String message) + public BuilderNotFoundException( String message ) { - super(message); - } + super( message ); + } } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/MultiThreadedBuilder.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/MultiThreadedBuilder.java index c0104ef7b4..15499efae7 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/MultiThreadedBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/MultiThreadedBuilder.java @@ -53,7 +53,8 @@ import org.codehaus.plexus.logging.Logger; * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. */ @Component( role = Builder.class, hint = "multithreaded" ) -public class MultiThreadedBuilder implements Builder +public class MultiThreadedBuilder + implements Builder { @Requirement @@ -72,9 +73,12 @@ public class MultiThreadedBuilder implements Builder List taskSegments, ReactorBuildStatus reactorBuildStatus ) throws ExecutionException, InterruptedException { - ExecutorService executor = Executors.newFixedThreadPool(Math.min(session.getRequest().getDegreeOfConcurrency(), session.getProjects().size()), new BuildThreadFactory()); - CompletionService service = new ExecutorCompletionService(executor); - ConcurrencyDependencyGraph analyzer = new ConcurrencyDependencyGraph(projectBuilds, session.getProjectDependencyGraph()); + ExecutorService executor = + Executors.newFixedThreadPool( Math.min( session.getRequest().getDegreeOfConcurrency(), + session.getProjects().size() ), new BuildThreadFactory() ); + CompletionService service = new ExecutorCompletionService( executor ); + ConcurrencyDependencyGraph analyzer = + new ConcurrencyDependencyGraph( projectBuilds, session.getProjectDependencyGraph() ); // Currently disabled ThreadOutputMuxer muxer = null; // new ThreadOutputMuxer( analyzer.getProjectBuilds(), System.out ); @@ -189,4 +193,4 @@ public class MultiThreadedBuilder implements Builder } }; } -} \ No newline at end of file +} diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.java index a6c9d033e1..464944f14d 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.java @@ -1,5 +1,24 @@ package org.apache.maven.lifecycle.internal.builder.singlethreaded; +/* + * 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.List; import org.apache.maven.execution.MavenSession; 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 79871df523..f07ba4fb4e 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 @@ -1093,7 +1093,7 @@ public class MavenCli threadConfiguration.contains( "C" ) ? Integer.valueOf( threadConfiguration.replace( "C", "" ) ) * Runtime.getRuntime().availableProcessors() : Integer.valueOf( threadConfiguration ); - request.setDegreeOfConcurrency(threads); + request.setDegreeOfConcurrency( threads ); } if ( commandLine.hasOption( CLIManager.BUILDER ) ) diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java index 7fd4d86dc8..beb3ec27ad 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java @@ -77,11 +77,14 @@ public class DefaultModelValidator Parent parent = model.getParent(); if ( parent != null ) { - validateStringNotEmpty( "parent.groupId", problems, Severity.FATAL, Version.BASE, parent.getGroupId(), parent ); + validateStringNotEmpty( "parent.groupId", problems, Severity.FATAL, Version.BASE, parent.getGroupId(), + parent ); - validateStringNotEmpty( "parent.artifactId", problems, Severity.FATAL, Version.BASE, parent.getArtifactId(), parent ); + validateStringNotEmpty( "parent.artifactId", problems, Severity.FATAL, Version.BASE, + parent.getArtifactId(), parent ); - validateStringNotEmpty( "parent.version", problems, Severity.FATAL, Version.BASE, parent.getVersion(), parent ); + validateStringNotEmpty( "parent.version", problems, Severity.FATAL, Version.BASE, parent.getVersion(), + parent ); if ( equals( parent.getGroupId(), model.getGroupId() ) && equals( parent.getArtifactId(), model.getArtifactId() ) ) @@ -95,7 +98,8 @@ public class DefaultModelValidator { Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 ); - validateEnum( "modelVersion", problems, Severity.ERROR, Version.V20, model.getModelVersion(), null, model, "4.0.0" ); + validateEnum( "modelVersion", problems, Severity.ERROR, Version.V20, model.getModelVersion(), null, model, + "4.0.0" ); validateStringNoExpression( "groupId", problems, Severity.WARNING, Version.V20, model.getGroupId(), model ); if ( parent == null ) @@ -103,7 +107,8 @@ public class DefaultModelValidator validateStringNotEmpty( "groupId", problems, Severity.FATAL, Version.V20, model.getGroupId(), model ); } - validateStringNoExpression( "artifactId", problems, Severity.WARNING, Version.V20, model.getArtifactId(), model ); + validateStringNoExpression( "artifactId", problems, Severity.WARNING, Version.V20, model.getArtifactId(), + model ); validateStringNotEmpty( "artifactId", problems, Severity.FATAL, Version.V20, model.getArtifactId(), model ); validateVersionNoExpression( "version", problems, Severity.WARNING, Version.V20, model.getVersion(), model ); @@ -117,13 +122,13 @@ public class DefaultModelValidator if ( model.getDependencyManagement() != null ) { validate20RawDependencies( problems, model.getDependencyManagement().getDependencies(), - "dependencyManagement.dependencies.dependency", request ); + "dependencyManagement.dependencies.dependency", request ); } validateRawRepositories( problems, model.getRepositories(), "repositories.repository", request ); validateRawRepositories( problems, model.getPluginRepositories(), "pluginRepositories.pluginRepository", - request ); + request ); Build build = model.getBuild(); if ( build != null ) @@ -133,8 +138,7 @@ public class DefaultModelValidator PluginManagement mngt = build.getPluginManagement(); if ( mngt != null ) { - validate20RawPlugins( problems, mngt.getPlugins(), "build.pluginManagement.plugins.plugin", - request ); + validate20RawPlugins( problems, mngt.getPlugins(), "build.pluginManagement.plugins.plugin", request ); } } @@ -681,32 +685,34 @@ public class DefaultModelValidator return false; } - private boolean validateVersionNoExpression(String fieldName, ModelProblemCollector problems, Severity severity, Version version, - String string, InputLocationTracker tracker) + private boolean validateVersionNoExpression( String fieldName, ModelProblemCollector problems, Severity severity, + Version version, String string, InputLocationTracker tracker ) { - - if ( !hasExpression( string ) ) - { - return true; - } - - // - // Acceptable versions for continuous delivery - // - // changelist - // revision - // sha1 - // - if( string.trim().contains("${changelist}") || string.trim().contains("${revision}") || string.trim().contains("${sha1}") ) - { - return true; - } - - addViolation(problems, severity, version, fieldName, null, "contains an expression but should be a constant.", tracker); - - return false; - } - + + if ( !hasExpression( string ) ) + { + return true; + } + + // + // Acceptable versions for continuous delivery + // + // changelist + // revision + // sha1 + // + if ( string.trim().contains( "${changelist}" ) || string.trim().contains( "${revision}" ) + || string.trim().contains( "${sha1}" ) ) + { + return true; + } + + addViolation( problems, severity, version, fieldName, null, "contains an expression but should be a constant.", + tracker ); + + return false; + } + private boolean hasExpression( String value ) { return value != null && value.contains( "${" ); @@ -764,8 +770,8 @@ public class DefaultModelValidator return false; } - private boolean validateBoolean( String fieldName, ModelProblemCollector problems, Severity severity, Version version, - String string, String sourceHint, InputLocationTracker tracker ) + private boolean validateBoolean( String fieldName, ModelProblemCollector problems, Severity severity, + Version version, String string, String sourceHint, InputLocationTracker tracker ) { if ( string == null || string.length() <= 0 ) { @@ -777,14 +783,14 @@ public class DefaultModelValidator return true; } - addViolation( problems, severity, version, fieldName, sourceHint, "must be 'true' or 'false' but is '" + string + "'.", - tracker ); + addViolation( problems, severity, version, fieldName, sourceHint, "must be 'true' or 'false' but is '" + string + + "'.", tracker ); return false; } - private boolean validateEnum( String fieldName, ModelProblemCollector problems, Severity severity, Version version, String string, - String sourceHint, InputLocationTracker tracker, String... validValues ) + private boolean validateEnum( String fieldName, ModelProblemCollector problems, Severity severity, Version version, + String string, String sourceHint, InputLocationTracker tracker, String... validValues ) { if ( string == null || string.length() <= 0 ) { @@ -804,9 +810,9 @@ public class DefaultModelValidator return false; } - private boolean validateBannedCharacters( String fieldName, ModelProblemCollector problems, Severity severity, Version version, - String string, String sourceHint, InputLocationTracker tracker, - String banned ) + private boolean validateBannedCharacters( String fieldName, ModelProblemCollector problems, Severity severity, + Version version, String string, String sourceHint, + InputLocationTracker tracker, String banned ) { if ( string != null ) { @@ -825,8 +831,8 @@ public class DefaultModelValidator return true; } - private boolean validateVersion( String fieldName, ModelProblemCollector problems, Severity severity, Version version, - String string, String sourceHint, InputLocationTracker tracker ) + private boolean validateVersion( String fieldName, ModelProblemCollector problems, Severity severity, + Version version, String string, String sourceHint, InputLocationTracker tracker ) { if ( string == null || string.length() <= 0 ) { @@ -845,8 +851,9 @@ public class DefaultModelValidator } - private boolean validate20ProperSnapshotVersion( String fieldName, ModelProblemCollector problems, Severity severity, Version version, - String string, String sourceHint, InputLocationTracker tracker ) + private boolean validate20ProperSnapshotVersion( String fieldName, ModelProblemCollector problems, + Severity severity, Version version, String string, + String sourceHint, InputLocationTracker tracker ) { if ( string == null || string.length() <= 0 ) { @@ -855,8 +862,8 @@ public class DefaultModelValidator if ( string.endsWith( "SNAPSHOT" ) && !string.endsWith( "-SNAPSHOT" ) ) { - addViolation( problems, severity, version, fieldName, sourceHint, "uses an unsupported snapshot version format" - + ", should be '*-SNAPSHOT' instead.", tracker ); + addViolation( problems, severity, version, fieldName, sourceHint, + "uses an unsupported snapshot version format" + ", should be '*-SNAPSHOT' instead.", tracker ); return false; } @@ -864,8 +871,8 @@ public class DefaultModelValidator } private boolean validate20PluginVersion( String fieldName, ModelProblemCollector problems, String string, - String sourceHint, InputLocationTracker tracker, - ModelBuildingRequest request ) + String sourceHint, InputLocationTracker tracker, + ModelBuildingRequest request ) { if ( string == null ) { @@ -882,16 +889,16 @@ public class DefaultModelValidator if ( string.length() <= 0 || "RELEASE".equals( string ) || "LATEST".equals( string ) ) { - addViolation( problems, errOn30, Version.V20, fieldName, sourceHint, "must be a valid version but is '" + string + "'.", - tracker ); + addViolation( problems, errOn30, Version.V20, fieldName, sourceHint, "must be a valid version but is '" + + string + "'.", tracker ); return false; } return true; } - private static void addViolation( ModelProblemCollector problems, Severity severity, Version version, String fieldName, - String sourceHint, String message, InputLocationTracker tracker ) + private static void addViolation( ModelProblemCollector problems, Severity severity, Version version, + String fieldName, String sourceHint, String message, InputLocationTracker tracker ) { StringBuilder buffer = new StringBuilder( 256 ); buffer.append( '\'' ).append( fieldName ).append( '\'' ); From 81619e6f1a19f9ee4c94ceff07a515eb928e6b09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 8 Feb 2014 16:41:28 +0100 Subject: [PATCH 2/2] restore public interface --- .../org/apache/maven/execution/ProjectExecutionListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-core/src/main/java/org/apache/maven/execution/ProjectExecutionListener.java b/maven-core/src/main/java/org/apache/maven/execution/ProjectExecutionListener.java index b19294da0c..24c49b902f 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/ProjectExecutionListener.java +++ b/maven-core/src/main/java/org/apache/maven/execution/ProjectExecutionListener.java @@ -29,7 +29,7 @@ import org.apache.maven.lifecycle.LifecycleExecutionException; * @since 3.1.2 * @provisional This interface is part of work in progress and can be changed or removed without notice. */ -interface ProjectExecutionListener +public interface ProjectExecutionListener { void beforeProjectExecution( ProjectExecutionEvent event ) throws LifecycleExecutionException;