fixed errors reported by Checkstyle

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@813612 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Herve Boutemy 2009-09-10 21:58:39 +00:00
parent 388fcd100e
commit b82977a18c
13 changed files with 230 additions and 183 deletions

View File

@ -1,18 +1,22 @@
package org.apache.maven.execution;
/*
* 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
* 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.
* 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;
@ -129,7 +133,9 @@ public class DefaultMavenExecutionRequest
*/
private boolean noSnapshotUpdates;
public DefaultMavenExecutionRequest() { }
public DefaultMavenExecutionRequest()
{
}
public static MavenExecutionRequest copy( MavenExecutionRequest original )
{

View File

@ -61,9 +61,9 @@ public class PluginParameterException
if ( param.isEditable() )
{
messageBuffer.append( "Inside the definition for plugin \'" + mojo.getPluginDescriptor().getArtifactId() +
"\' specify the following:\n\n<configuration>\n ...\n <" + param.getName() + ">VALUE</" +
param.getName() + ">\n</configuration>" );
messageBuffer.append( "Inside the definition for plugin \'" + mojo.getPluginDescriptor().getArtifactId()
+ "\' specify the following:\n\n<configuration>\n ...\n <" + param.getName() + ">VALUE</"
+ param.getName() + ">\n</configuration>" );
String alias = param.getAlias();
if ( StringUtils.isNotEmpty( alias ) && !alias.equals( param.getName() ) )

View File

@ -42,8 +42,8 @@ public class InvalidProjectVersionException
private static String formatMessage( String projectId, String locationInPom, String offendingVersion,
InvalidVersionSpecificationException cause )
{
return "Invalid version: " + offendingVersion + " found for: " + locationInPom + " in project: " + projectId +
". Reason: " + cause.getMessage();
return "Invalid version: " + offendingVersion + " found for: " + locationInPom + " in project: " + projectId
+ ". Reason: " + cause.getMessage();
}
public String getOffendingVersion()

View File

@ -43,8 +43,8 @@ public class SettingsConfigurationException
public SettingsConfigurationException( String message, Throwable cause, int lineNumber, int columnNumber )
{
super( message + ( lineNumber > 0 ? "\n Line: " + lineNumber : "" ) +
( columnNumber > 0 ? "\n Column: " + columnNumber : "" ), cause );
super( message + ( lineNumber > 0 ? "\n Line: " + lineNumber : "" )
+ ( columnNumber > 0 ? "\n Column: " + columnNumber : "" ), cause );
this.lineNumber = lineNumber;
this.columnNumber = columnNumber;
}

View File

@ -19,7 +19,6 @@ package org.apache.maven.plugin;
* under the License.
*/
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
@ -33,7 +32,6 @@ import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
@ -74,7 +72,9 @@ public class PluginParameterExpressionEvaluatorTest
}
@Override
protected void tearDown() throws Exception {
protected void tearDown()
throws Exception
{
factory = null;
super.tearDown();
}

View File

@ -35,7 +35,9 @@ public class MavenMetadataSourceTest
}
@Override
protected void tearDown() throws Exception {
protected void tearDown()
throws Exception
{
repositorySystem = null;
super.tearDown();
}

View File

@ -72,11 +72,13 @@ public class ProjectInheritanceTest
assertTrue( "Set size should be 3, is " + set.size(), set.size() == 3 );
Iterator iter = set.iterator();
while (iter.hasNext()) {
while ( iter.hasNext() )
{
Artifact artifact = (Artifact) iter.next();
System.out.println("Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() +
" Optional=" + (artifact.isOptional() ? "true" : "false"));
assertTrue("Incorrect version for " + artifact.getDependencyConflictId(), artifact.getVersion().equals("1.0"));
System.out.println( "Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion()
+ " Optional=" + ( artifact.isOptional() ? "true" : "false" ) );
assertTrue( "Incorrect version for " + artifact.getDependencyConflictId(),
artifact.getVersion().equals( "1.0" ) );
}
}

View File

@ -70,8 +70,8 @@ public class ProjectInheritanceTest
while ( iter.hasNext() )
{
Artifact artifact = (Artifact) iter.next();
System.out.println("Artifact: " + artifact.getDependencyConflictId() + " " +
artifact.getVersion() + " Scope: " + artifact.getScope());
System.out.println( "Artifact: " + artifact.getDependencyConflictId() + " "
+ artifact.getVersion() + " Scope: " + artifact.getScope() );
assertTrue( "Incorrect version for " + artifact.getDependencyConflictId(), artifact.getVersion().equals( "1.0" ) );
}

View File

@ -71,9 +71,10 @@ public class ProjectInheritanceTest
while ( iter.hasNext() )
{
Artifact artifact = (Artifact) iter.next();
System.out.println("Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() +
" Optional=" + (artifact.isOptional() ? "true" : "false"));
assertTrue("Incorrect version for " + artifact.getDependencyConflictId(), artifact.getVersion().equals("1.0"));
System.out.println( "Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion()
+ " Optional=" + ( artifact.isOptional() ? "true" : "false" ) );
assertTrue( "Incorrect version for " + artifact.getDependencyConflictId(),
artifact.getVersion().equals( "1.0" ) );
}
}

View File

@ -72,9 +72,10 @@ public class ProjectInheritanceTest
while ( iter.hasNext() )
{
Artifact artifact = (Artifact) iter.next();
System.out.println("Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() +
" Optional=" + (artifact.isOptional() ? "true" : "false"));
assertTrue("Incorrect version for " + artifact.getDependencyConflictId(), artifact.getVersion().equals("1.0"));
System.out.println( "Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion()
+ " Optional=" + ( artifact.isOptional() ? "true" : "false" ) );
assertTrue( "Incorrect version for " + artifact.getDependencyConflictId(),
artifact.getVersion().equals( "1.0" ) );
}
}

View File

@ -1,10 +1,28 @@
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 java.io.IOException;
import java.io.Reader;
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.model.Profile;
import org.apache.maven.project.DefaultProjectBuilder;
@ -22,9 +40,9 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
public class PomConstructionWithSettingsTest
extends PlexusTestCase
{
private static String BASE_DIR = "src/test";
private static final String BASE_DIR = "src/test";
private static String BASE_POM_DIR = BASE_DIR + "/resources-settings";
private static final String BASE_POM_DIR = BASE_DIR + "/resources-settings";
private DefaultProjectBuilder projectBuilder;
@ -41,7 +59,9 @@ public class PomConstructionWithSettingsTest
}
@Override
protected void tearDown() throws Exception {
protected void tearDown()
throws Exception
{
projectBuilder = null;
super.tearDown();
@ -85,9 +105,11 @@ public class PomConstructionWithSettingsTest
config.addProfile( profile );
}
String localRepoUrl = System.getProperty( "maven.repo.local", System.getProperty( "user.home" ) + "/.m2/repository" );
String localRepoUrl =
System.getProperty( "maven.repo.local", System.getProperty( "user.home" ) + "/.m2/repository" );
localRepoUrl = "file://" + localRepoUrl;
config.setLocalRepository( repositorySystem.createArtifactRepository( "local", localRepoUrl, new DefaultRepositoryLayout(), null, null ) );
config.setLocalRepository( repositorySystem.createArtifactRepository( "local", localRepoUrl,
new DefaultRepositoryLayout(), null, null ) );
config.setActiveProfileIds( settings.getActiveProfiles() );
return new PomTestWrapper( pomFile, projectBuilder.build( pomFile, config ).getProject() );

View File

@ -29,21 +29,29 @@ import org.apache.maven.settings.Settings;
*
* @author mkleint
*/
public class DefaultSettingsValidatorTest extends TestCase {
public class DefaultSettingsValidatorTest
extends TestCase
{
public DefaultSettingsValidatorTest(String testName) {
public DefaultSettingsValidatorTest( String testName )
{
super( testName );
}
protected void setUp() throws Exception {
protected void setUp()
throws Exception
{
super.setUp();
}
protected void tearDown() throws Exception {
protected void tearDown()
throws Exception
{
super.tearDown();
}
public void testValidate() {
public void testValidate()
{
Settings model = new Settings();
Profile prof = new Profile();
prof.setId( "xxx" );

View File

@ -25,16 +25,20 @@ import junit.framework.TestCase;
*
* @author mkleint
*/
public class RequirementMatcherFactoryTest extends TestCase {
public class RequirementMatcherFactoryTest
extends TestCase
{
public RequirementMatcherFactoryTest(String testName) {
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" ) );
@ -46,7 +50,8 @@ public class RequirementMatcherFactoryTest extends TestCase {
/**
* 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" ) );