fixed errors reported by Checkstyle
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-2/branches/maven-2.2.x@813686 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java b/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java
index 15f9a2e..dc93db2 100644
--- a/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java
+++ b/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java
@@ -45,7 +45,7 @@
implements Cloneable
{
/** The Plexus component type */
- public static String MAVEN_PLUGIN = "maven-plugin";
+ public static final String MAVEN_PLUGIN = "maven-plugin";
/** "once-per-session" execution strategy */
public static final String SINGLE_PASS_EXEC_STRATEGY = "once-per-session";
@@ -192,9 +192,9 @@
{
if ( parameters != null && parameters.contains( parameter ) )
{
- throw new DuplicateParameterException( parameter.getName() +
- " has been declared multiple times in mojo with goal: " + getGoal() + " (implementation: " +
- getImplementation() + ")" );
+ throw new DuplicateParameterException( parameter.getName()
+ + " has been declared multiple times in mojo with goal: " + getGoal() + " (implementation: "
+ + getImplementation() + ")" );
}
if ( parameters == null )
@@ -203,7 +203,7 @@
}
parameters.add( parameter );
-
+
parameterMap = null;
}
diff --git a/maven-plugin-descriptor/src/test/java/org/apache/maven/plugin/lifecycle/LifecycleXpp3ReaderTest.java b/maven-plugin-descriptor/src/test/java/org/apache/maven/plugin/lifecycle/LifecycleXpp3ReaderTest.java
index ad5b67d..5b314be 100644
--- a/maven-plugin-descriptor/src/test/java/org/apache/maven/plugin/lifecycle/LifecycleXpp3ReaderTest.java
+++ b/maven-plugin-descriptor/src/test/java/org/apache/maven/plugin/lifecycle/LifecycleXpp3ReaderTest.java
@@ -50,7 +50,7 @@
assertEquals( "check id", "generate-sources", p.getId() );
assertEquals( "check number of executions", 1, p.getExecutions().size() );
Execution e = (Execution) p.getExecutions().iterator().next();
- assertEquals( "check configuration", "true", ((Xpp3Dom) e.getConfiguration()).getChild( "debug" ).getValue() );
+ assertEquals( "check configuration", "true", ( (Xpp3Dom) e.getConfiguration() ).getChild( "debug" ).getValue() );
assertEquals( "check number of goals", 1, e.getGoals().size() );
String g = (String) e.getGoals().iterator().next();
assertEquals( "check goal", "clover:compiler", g );
diff --git a/maven-plugin-parameter-documenter/src/test/java/org/apache/maven/usability/plugin/Xpp3ParseTest.java b/maven-plugin-parameter-documenter/src/test/java/org/apache/maven/usability/plugin/Xpp3ParseTest.java
index c65e073..f4b9ad0 100644
--- a/maven-plugin-parameter-documenter/src/test/java/org/apache/maven/usability/plugin/Xpp3ParseTest.java
+++ b/maven-plugin-parameter-documenter/src/test/java/org/apache/maven/usability/plugin/Xpp3ParseTest.java
@@ -33,28 +33,28 @@
public class Xpp3ParseTest
extends TestCase
{
-
+
public void testParse() throws IOException, XmlPullParserException
{
InputStream testDocStream = getClass().getClassLoader().getResourceAsStream( "test.paramdoc.xml" );
ParamdocXpp3Reader reader = new ParamdocXpp3Reader();
-
- ExpressionDocumentation documentation = reader.read(new InputStreamReader( testDocStream ) );
-
+
+ ExpressionDocumentation documentation = reader.read( new InputStreamReader( testDocStream ) );
+
Map exprs = documentation.getExpressionsBySyntax();
-
+
Expression expr = (Expression) exprs.get( "localRepository" );
-
+
assertNotNull( expr );
-
+
Properties p = expr.getCliOptions();
-
+
assertNotNull( p );
-
+
assertEquals( 1, p.size() );
-
+
assertEquals( "Override the local repository location on a per-build basis.", p.getProperty( "-Dmaven.repo.local=/path/to/local/repo" ) );
-
+
}
}
diff --git a/maven-plugin-registry/src/main/java/org/apache/maven/plugin/registry/DefaultPluginRegistryBuilder.java b/maven-plugin-registry/src/main/java/org/apache/maven/plugin/registry/DefaultPluginRegistryBuilder.java
index f946ca7..9db0928 100644
--- a/maven-plugin-registry/src/main/java/org/apache/maven/plugin/registry/DefaultPluginRegistryBuilder.java
+++ b/maven-plugin-registry/src/main/java/org/apache/maven/plugin/registry/DefaultPluginRegistryBuilder.java
@@ -62,8 +62,8 @@
getLogger().debug( "Building Maven user-level plugin registry from: '" + userRegistryFile.getAbsolutePath() + "'" );
- if ( System.getProperty( "maven.home" ) != null ||
- System.getProperty( MavenPluginRegistryBuilder.ALT_GLOBAL_PLUGIN_REG_LOCATION ) != null )
+ if ( System.getProperty( "maven.home" ) != null
+ || System.getProperty( MavenPluginRegistryBuilder.ALT_GLOBAL_PLUGIN_REG_LOCATION ) != null )
{
globalRegistryFile = getFile( globalRegistryPath, "maven.home", MavenPluginRegistryBuilder.ALT_GLOBAL_PLUGIN_REG_LOCATION );
@@ -130,13 +130,13 @@
// -------------------------------------------------------------------------------------
// Alright, here's the justification for all the regexp wizardry below...
//
- // Continuum and other server-like apps may need to locate the user-level and
+ // Continuum and other server-like apps may need to locate the user-level and
// global-level settings somewhere other than ${user.home} and ${maven.home},
// respectively. Using a simple replacement of these patterns will allow them
// to specify the absolute path to these files in a customized components.xml
// file. Ideally, we'd do full pattern-evaluation against the sysprops, but this
// is a first step. There are several replacements below, in order to normalize
- // the path character before we operate on the string as a regex input, and
+ // the path character before we operate on the string as a regex input, and
// in order to avoid surprises with the File construction...
// -------------------------------------------------------------------------------------
@@ -149,7 +149,7 @@
String basedir = System.getProperty( basedirSysProp );
basedir = basedir.replaceAll( "\\\\", "/" );
- basedir = basedir.replaceAll("\\$", "\\\\\\$");
+ basedir = basedir.replaceAll( "\\$", "\\\\\\$" );
path = pathPattern.replaceAll( "\\$\\{" + basedirSysProp + "\\}", basedir );
path = path.replaceAll( "\\\\", "/" );
diff --git a/maven-settings/src/test/java/org/apache/maven/settings/SettingsTest.java b/maven-settings/src/test/java/org/apache/maven/settings/SettingsTest.java
index 6d52d06..91e3808 100644
--- a/maven-settings/src/test/java/org/apache/maven/settings/SettingsTest.java
+++ b/maven-settings/src/test/java/org/apache/maven/settings/SettingsTest.java
@@ -1,33 +1,59 @@
package org.apache.maven.settings;
+/*
+ * 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;
import junit.framework.TestCase;
-public class SettingsTest extends TestCase {
+public class SettingsTest
+ extends TestCase
+{
- private Settings settingsNoProxies;
- private Settings settingsOneInactiveProxy;
- private Settings settingsOneActiveProxy;
+ private Settings settingsNoProxies;
+ private Settings settingsOneInactiveProxy;
+ private Settings settingsOneActiveProxy;
-
- protected void setUp() throws Exception {
-
- super.setUp();
- // Read different settings files for proxy testing.
- DefaultMavenSettingsBuilder settingsBuilder = new DefaultMavenSettingsBuilder();
- settingsNoProxies = settingsBuilder.buildSettings(new File("src/test/resources/org/apache/maven/settings/settings-no-proxies.xml"), false);
- settingsOneInactiveProxy = settingsBuilder.buildSettings(new File("src/test/resources/org/apache/maven/settings/settings-one-inactive-proxy.xml"), false);
- settingsOneActiveProxy = settingsBuilder.buildSettings(new File("src/test/resources/org/apache/maven/settings/settings-one-active-proxy.xml"), false);
-
- }
-
-
- public void testProxySettings() {
-
- assertNull(settingsNoProxies.getActiveProxy());
- assertNull(settingsOneInactiveProxy.getActiveProxy());
- assertNotNull(settingsOneActiveProxy.getActiveProxy());
- }
+ protected void setUp()
+ throws Exception
+ {
+
+ super.setUp();
+
+ // Read different settings files for proxy testing.
+ DefaultMavenSettingsBuilder settingsBuilder = new DefaultMavenSettingsBuilder();
+ File dir = new File( "src/test/resources/org/apache/maven/settings" );
+ settingsNoProxies = settingsBuilder.buildSettings( new File( dir, "settings-no-proxies.xml" ), false );
+ settingsOneInactiveProxy =
+ settingsBuilder.buildSettings( new File( dir, "settings-one-inactive-proxy.xml" ), false );
+ settingsOneActiveProxy =
+ settingsBuilder.buildSettings( new File( dir, "settings-one-active-proxy.xml" ), false );
+
+ }
+
+
+ public void testProxySettings()
+ {
+ assertNull( settingsNoProxies.getActiveProxy() );
+ assertNull( settingsOneInactiveProxy.getActiveProxy() );
+ assertNotNull( settingsOneActiveProxy.getActiveProxy() );
+ }
}
diff --git a/maven-toolchain/src/main/java/org/apache/maven/toolchain/DefaultToolchainManager.java b/maven-toolchain/src/main/java/org/apache/maven/toolchain/DefaultToolchainManager.java
index ed68636..72faba7 100644
--- a/maven-toolchain/src/main/java/org/apache/maven/toolchain/DefaultToolchainManager.java
+++ b/maven-toolchain/src/main/java/org/apache/maven/toolchain/DefaultToolchainManager.java
@@ -67,7 +67,7 @@
public void contextualize( Context context )
throws ContextException
{
- container = (PlexusContainer) context.get(PlexusConstants.PLEXUS_KEY);
+ container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
}
public ToolchainPrivate[] getToolchainsForType( String type )
@@ -94,7 +94,7 @@
}
else
{
- getLogger().error("Missing toolchain factory for type:" + toolchainModel.getType() + ". Possibly caused by misconfigured project.");
+ getLogger().error( "Missing toolchain factory for type:" + toolchainModel.getType() + ". Possibly caused by misconfigured project." );
}
}
}
@@ -110,11 +110,11 @@
}
}
ToolchainPrivate[] tc = new ToolchainPrivate[ toRet.size() ];
- return (ToolchainPrivate[]) toRet.toArray(tc);
+ return (ToolchainPrivate[]) toRet.toArray( tc );
}
catch ( ComponentLookupException ex )
{
- getLogger().fatalError("Error in component lookup", ex);
+ getLogger().fatalError( "Error in component lookup", ex );
}
return new ToolchainPrivate[0];
}
@@ -122,65 +122,67 @@
public Toolchain getToolchainFromBuildContext( String type,
MavenSession session )
{
- Map context = retrieveContext(session);
- if ( "javac".equals( type ))
+ Map context = retrieveContext( session );
+ if ( "javac".equals( type ) )
{
//HACK to make compiler plugin happy
type = "jdk";
}
Object obj = context.get( getStorageKey( type ) );
- ToolchainModel model = (ToolchainModel)obj;
-
- if ( model != null )
+ ToolchainModel model = (ToolchainModel) obj;
+
+ if ( model != null )
{
try
{
- ToolchainFactory fact = (ToolchainFactory) container.lookup(ToolchainFactory.ROLE, type);
+ ToolchainFactory fact = (ToolchainFactory) container.lookup( ToolchainFactory.ROLE, type );
return fact.createToolchain( model );
}
catch ( ComponentLookupException ex )
{
- getLogger().fatalError("Error in component lookup", ex);
+ getLogger().fatalError( "Error in component lookup", ex );
}
catch ( MisconfiguredToolchainException ex )
{
- getLogger().error("Misconfigured toolchain.", ex);
+ getLogger().error( "Misconfigured toolchain.", ex );
}
}
return null;
}
- private MavenProject getCurrentProject(MavenSession session) {
- //use reflection since MavenSession.getCurrentProject() is not part of 2.0.8
- try
+ private MavenProject getCurrentProject( MavenSession session )
+ {
+ // use reflection since MavenSession.getCurrentProject() is not part of 2.0.8
+ try
{
- Method meth = session.getClass().getMethod("getCurrentProject", new Class[0]);
- return (MavenProject) meth.invoke(session, null);
- } catch (Exception ex)
+ Method meth = session.getClass().getMethod( "getCurrentProject", new Class[0] );
+ return (MavenProject) meth.invoke( session, null );
+ }
+ catch ( Exception ex )
{
- //just ignore, we're running in pre- 2.0.9
+ // just ignore, we're running in pre- 2.0.9
}
return null;
}
-
- private Map retrieveContext( MavenSession session )
+
+ private Map retrieveContext( MavenSession session )
{
- if (session == null)
+ if ( session == null )
{
return new HashMap();
}
PluginDescriptor desc = new PluginDescriptor();
desc.setGroupId( PluginDescriptor.getDefaultPluginGroupId() );
- desc.setArtifactId( PluginDescriptor.getDefaultPluginArtifactId ("toolchains") );
- MavenProject current = getCurrentProject(session);
- if ( current != null )
+ desc.setArtifactId( PluginDescriptor.getDefaultPluginArtifactId( "toolchains" ) );
+ MavenProject current = getCurrentProject( session );
+ if ( current != null )
{
return session.getPluginContext( desc, current );
-
+
}
return new HashMap();
}
-
+
public void storeToolchainToBuildContext( ToolchainPrivate toolchain,
MavenSession session )
@@ -188,12 +190,12 @@
Map<String, Object> context = retrieveContext( session );
context.put( getStorageKey( toolchain.getType() ), toolchain.getModel () );
}
-
+
public static final String getStorageKey( String type )
{
return "toolchain-" + type; //NOI18N
}
-
+
private PersistedToolchains readToolchainSettings( )
throws MisconfiguredToolchainException
diff --git a/maven-toolchain/src/test/java/org/apache/maven/toolchain/RequirementMatcherFactoryTest.java b/maven-toolchain/src/test/java/org/apache/maven/toolchain/RequirementMatcherFactoryTest.java
index fe5c411..7f1fcfd 100644
--- a/maven-toolchain/src/test/java/org/apache/maven/toolchain/RequirementMatcherFactoryTest.java
+++ b/maven-toolchain/src/test/java/org/apache/maven/toolchain/RequirementMatcherFactoryTest.java
@@ -1,3 +1,5 @@
+package org.apache.maven.toolchain;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -17,45 +19,48 @@
* under the License.
*/
-package org.apache.maven.toolchain;
-
import junit.framework.TestCase;
/**
*
* @author mkleint
*/
-public class RequirementMatcherFactoryTest extends TestCase {
-
- public RequirementMatcherFactoryTest(String testName) {
- super(testName);
+public class RequirementMatcherFactoryTest
+ extends TestCase
+{
+
+ public RequirementMatcherFactoryTest( String testName )
+ {
+ super( testName );
}
/**
* Test of createExactMatcher method, of class RequirementMatcherFactory.
*/
- public void testCreateExactMatcher() {
+ public void testCreateExactMatcher()
+ {
RequirementMatcher matcher;
- matcher = RequirementMatcherFactory.createExactMatcher("foo");
- assertFalse(matcher.matches("bar"));
- assertFalse(matcher.matches("foobar"));
- assertFalse(matcher.matches("foob"));
- assertTrue(matcher.matches("foo"));
+ matcher = RequirementMatcherFactory.createExactMatcher( "foo" );
+ assertFalse( matcher.matches( "bar" ) );
+ assertFalse( matcher.matches( "foobar" ) );
+ assertFalse( matcher.matches( "foob" ) );
+ assertTrue( matcher.matches( "foo" ) );
}
/**
* Test of createVersionMatcher method, of class RequirementMatcherFactory.
*/
- public void testCreateVersionMatcher() {
+ public void testCreateVersionMatcher()
+ {
RequirementMatcher matcher;
- matcher = RequirementMatcherFactory.createVersionMatcher("1.5.2");
- assertFalse(matcher.matches("1.5"));
- assertTrue(matcher.matches("1.5.2"));
- assertFalse(matcher.matches("[1.4,1.5)"));
- assertFalse(matcher.matches("[1.5,1.5.2)"));
- assertFalse(matcher.matches("(1.5.2,1.6)"));
- assertTrue(matcher.matches("(1.4,1.5.2]"));
- assertTrue(matcher.matches("(1.5,)"));
+ matcher = RequirementMatcherFactory.createVersionMatcher( "1.5.2" );
+ assertFalse( matcher.matches( "1.5" ) );
+ assertTrue( matcher.matches( "1.5.2" ) );
+ assertFalse( matcher.matches( "[1.4,1.5)" ) );
+ assertFalse( matcher.matches( "[1.5,1.5.2)" ) );
+ assertFalse( matcher.matches( "(1.5.2,1.6)" ) );
+ assertTrue( matcher.matches( "(1.4,1.5.2]" ) );
+ assertTrue( matcher.matches( "(1.5,)" ) );
}
}