You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2010/03/25 00:15:37 UTC
svn commit: r927220 - in
/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype:
./ common/ common/util/ exception/ generator/ old/ repositorycrawler/ source/
Author: hboutemy
Date: Wed Mar 24 23:15:36 2010
New Revision: 927220
URL: http://svn.apache.org/viewvc?rev=927220&view=rev
Log:
fixed errors reported by Checkstyle
Modified:
maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/Archetype.java
maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultPomManager.java
maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/util/Format.java
maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/util/XMLOutputter.java
maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeNotConfigured.java
maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java
maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java
maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java
maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/repositorycrawler/RepositoryCrawler.java
maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/source/RemoteCatalogArchetypeDataSource.java
Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/Archetype.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/Archetype.java?rev=927220&r1=927219&r2=927220&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/Archetype.java (original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/Archetype.java Wed Mar 24 23:15:36 2010
@@ -97,7 +97,7 @@ public interface Archetype
File archiveArchetype( File archetypeDirectory, File outputDirectory, String finalName )
throws DependencyResolutionRequiredException, IOException;
- void updateLocalCatalog(org.apache.maven.archetype.catalog.Archetype archetype, String path);
+ void updateLocalCatalog( org.apache.maven.archetype.catalog.Archetype archetype, String path );
- void updateLocalCatalog(org.apache.maven.archetype.catalog.Archetype archetype);
+ void updateLocalCatalog( org.apache.maven.archetype.catalog.Archetype archetype );
}
Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultPomManager.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultPomManager.java?rev=927220&r1=927219&r2=927220&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultPomManager.java (original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultPomManager.java Wed Mar 24 23:15:36 2010
@@ -60,15 +60,18 @@ import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.StringWriter;
import java.io.Writer;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
/** @plexus.component */
public class DefaultPomManager
extends AbstractLogEnabled
implements PomManager
{
- public void addModule( File pom,
- String artifactId )
+ public void addModule( File pom, String artifactId )
throws IOException, XmlPullParserException, DocumentException, InvalidPackaging
{
boolean found = false;
@@ -150,12 +153,11 @@ public class DefaultPomManager
}
}
- public void addParent( File pom,
- File parentPom )
+ public void addParent( File pom, File parentPom )
throws IOException, XmlPullParserException
{
Model generatedModel = readPom( pom );
- if( null != generatedModel.getParent() )
+ if ( null != generatedModel.getParent() )
{
getLogger().info( "Parent element not overwrited in " + pom );
return;
@@ -180,8 +182,7 @@ public class DefaultPomManager
writePom( generatedModel, pom, pom );
}
- public void mergePoms( File pom,
- File temporaryPom )
+ public void mergePoms( File pom, File temporaryPom )
throws IOException, XmlPullParserException
{
Model model = readPom( pom );
@@ -289,9 +290,7 @@ public class DefaultPomManager
return reader.read( pomReader );
}
- public void writePom( final Model model,
- final File pomFile,
- final File initialPomFile )
+ public void writePom( final Model model, final File pomFile, final File initialPomFile )
throws IOException
{
InputStream inputStream = null;
@@ -463,8 +462,7 @@ public class DefaultPomManager
}
}
- private void mergeReportPlugins( Model model,
- Model generatedModel )
+ private void mergeReportPlugins( Model model, Model generatedModel )
{
if ( generatedModel.getReporting() != null )
{
Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/util/Format.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/util/Format.java?rev=927220&r1=927219&r2=927220&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/util/Format.java (original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/util/Format.java Wed Mar 24 23:15:36 2010
@@ -40,9 +40,6 @@ public class Format
implements Cloneable
{
- private static final String CVS_ID =
- "@(#) $RCSfile: Format.java,v $ $Revision: 1.10 $ $Date: 2004/09/07 06:37:20 $ $Name: jdom_1_0 $";
-
/**
* Returns a new Format object that performs no whitespace changes, uses
* the UTF-8 encoding, doesn't expand empty elements, includes the
@@ -438,18 +435,18 @@ public class Format
public DefaultEscapeStrategy( String encoding )
{
- if ( "UTF-8".equalsIgnoreCase( encoding ) ||
- "UTF-16".equalsIgnoreCase( encoding ) )
+ if ( "UTF-8".equalsIgnoreCase( encoding )
+ || "UTF-16".equalsIgnoreCase( encoding ) )
{
bits = 16;
}
- else if ( "ISO-8859-1".equalsIgnoreCase( encoding ) ||
- "Latin1".equalsIgnoreCase( encoding ) )
+ else if ( "ISO-8859-1".equalsIgnoreCase( encoding )
+ || "Latin1".equalsIgnoreCase( encoding ) )
{
bits = 8;
}
- else if ( "US-ASCII".equalsIgnoreCase( encoding ) ||
- "ASCII".equalsIgnoreCase( encoding ) )
+ else if ( "US-ASCII".equalsIgnoreCase( encoding )
+ || "ASCII".equalsIgnoreCase( encoding ) )
{
bits = 7;
}
@@ -461,11 +458,11 @@ public class Format
{
Class charsetClass = Class.forName( "java.nio.charset.Charset" );
Class encoderClass = Class.forName( "java.nio.charset.CharsetEncoder" );
- Method forName = charsetClass.getMethod( "forName", new Class[]{String.class} );
- Object charsetObj = forName.invoke( null, new Object[]{encoding} );
+ Method forName = charsetClass.getMethod( "forName", new Class[] { String.class } );
+ Object charsetObj = forName.invoke( null, new Object[] { encoding } );
Method newEncoder = charsetClass.getMethod( "newEncoder", null );
encoder = newEncoder.invoke( charsetObj, null );
- canEncode = encoderClass.getMethod( "canEncode", new Class[]{char.class} );
+ canEncode = encoderClass.getMethod( "canEncode", new Class[] { char.class } );
}
catch ( Exception ignored )
{
@@ -481,17 +478,11 @@ public class Format
}
if ( bits == 8 )
{
- if ( (int) ch > 255 )
- return true;
- else
- return false;
+ return ( (int) ch > 255 );
}
if ( bits == 7 )
{
- if ( (int) ch > 127 )
- return true;
- else
- return false;
+ return ( (int) ch > 127 );
}
else
{
@@ -499,7 +490,7 @@ public class Format
{
try
{
- Boolean val = (Boolean) canEncode.invoke( encoder, new Object[]{new Character( ch )} );
+ Boolean val = (Boolean) canEncode.invoke( encoder, new Object[] { new Character( ch ) } );
return !val.booleanValue();
}
catch ( Exception ignored )
Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/util/XMLOutputter.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/util/XMLOutputter.java?rev=927220&r1=927219&r2=927220&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/util/XMLOutputter.java (original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/util/XMLOutputter.java Wed Mar 24 23:15:36 2010
@@ -961,8 +961,8 @@ public class XMLOutputter
{
String str = ( currentFormat.mode == Format.TextMode.NORMALIZE )
? cdata.getTextNormalize()
- : ( ( currentFormat.mode == Format.TextMode.TRIM ) ?
- cdata.getText().trim() : cdata.getText() );
+ : ( ( currentFormat.mode == Format.TextMode.TRIM )
+ ? cdata.getText().trim() : cdata.getText() );
out.write( "<![CDATA[" );
out.write( str );
out.write( "]]>" );
@@ -981,8 +981,8 @@ public class XMLOutputter
{
String str = ( currentFormat.mode == Format.TextMode.NORMALIZE )
? text.getTextNormalize()
- : ( ( currentFormat.mode == Format.TextMode.TRIM ) ?
- text.getText().trim() : text.getText() );
+ : ( ( currentFormat.mode == Format.TextMode.TRIM )
+ ? text.getText().trim() : text.getText() );
out.write( escapeElementEntities( str ) );
}
@@ -1062,7 +1062,9 @@ public class XMLOutputter
// Print out attributes
if ( attributes != null )
+ {
printAttributes( out, attributes, element, namespaces );
+ }
// Depending on the settings (newlines, textNormalize, etc), we may
// or may not want to print all of the content, so determine the
@@ -1167,7 +1169,9 @@ public class XMLOutputter
if ( first < index )
{
if ( !firstNode )
+ {
newline( out );
+ }
indent( out, level );
printTextRange( out, content, first, index );
}
@@ -1260,8 +1264,7 @@ public class XMLOutputter
}
else
{
- throw new IllegalStateException( "Should see only " +
- "CDATA, Text, or EntityRef" );
+ throw new IllegalStateException( "Should see only CDATA, Text, or EntityRef" );
}
// This may save a little time
@@ -1274,11 +1277,11 @@ public class XMLOutputter
// only need in trim or normalizing mode)
if ( previous != null )
{ // Not 1st node
- if ( currentFormat.mode == Format.TextMode.NORMALIZE ||
- currentFormat.mode == Format.TextMode.TRIM )
+ if ( currentFormat.mode == Format.TextMode.NORMALIZE
+ || currentFormat.mode == Format.TextMode.TRIM )
{
- if ( ( endsWithWhite( previous ) ) ||
- ( startsWithWhite( next ) ) )
+ if ( ( endsWithWhite( previous ) )
+ || ( startsWithWhite( next ) ) )
{
out.write( " " );
}
@@ -1361,8 +1364,8 @@ public class XMLOutputter
{
Attribute attribute = (Attribute) attributes.get( i );
Namespace ns = attribute.getNamespace();
- if ( ( ns != Namespace.NO_NAMESPACE ) &&
- ( ns != Namespace.XML_NAMESPACE ) )
+ if ( ( ns != Namespace.NO_NAMESPACE )
+ && ( ns != Namespace.XML_NAMESPACE ) )
{
printNamespace( out, ns, namespaces );
}
@@ -1392,8 +1395,8 @@ public class XMLOutputter
{
return;
}
- if ( !( ( ns == Namespace.NO_NAMESPACE ) &&
- ( namespaces.getURI( "" ) == null ) ) )
+ if ( !( ( ns == Namespace.NO_NAMESPACE )
+ && ( namespaces.getURI( "" ) == null ) ) )
{
printNamespace( out, ns, namespaces );
}
@@ -1447,8 +1450,8 @@ public class XMLOutputter
throws
IOException
{
- if ( currentFormat.indent == null ||
- currentFormat.indent.equals( "" ) )
+ if ( currentFormat.indent == null
+ || currentFormat.indent.equals( "" ) )
{
return;
}
@@ -1510,7 +1513,9 @@ public class XMLOutputter
while ( index >= 0 )
{
if ( !isAllWhitespace( content.get( index - 1 ) ) )
+ {
break;
+ }
--index;
}
}
@@ -1568,7 +1573,9 @@ public class XMLOutputter
for ( int i = 0; i < str.length(); i++ )
{
if ( !isWhitespace( str.charAt( i ) ) )
+ {
return false;
+ }
}
return true;
}
@@ -1576,36 +1583,20 @@ public class XMLOutputter
// Determine if a string starts with a XML whitespace.
private boolean startsWithWhite( String str )
{
- if ( ( str != null ) &&
- ( str.length() > 0 ) &&
- isWhitespace( str.charAt( 0 ) ) )
- {
- return true;
- }
- return false;
+ return ( ( str != null ) && ( str.length() > 0 ) && isWhitespace( str.charAt( 0 ) ) );
}
// Determine if a string ends with a XML whitespace.
private boolean endsWithWhite( String str )
{
- if ( ( str != null ) &&
- ( str.length() > 0 ) &&
- isWhitespace( str.charAt( str.length() - 1 ) ) )
- {
- return true;
- }
- return false;
+ return ( ( str != null ) && ( str.length() > 0 ) && isWhitespace( str.charAt( str.length() - 1 ) ) );
}
// Determine if a character is a XML whitespace.
// XXX should this method be in Verifier
private static boolean isWhitespace( char c )
{
- if ( c == ' ' || c == '\n' || c == '\t' || c == '\r' )
- {
- return true;
- }
- return false;
+ return ( c == ' ' || c == '\n' || c == '\t' || c == '\r' );
}
/**
@@ -1712,7 +1703,10 @@ public class XMLOutputter
*/
public String escapeElementEntities( String str )
{
- if ( escapeOutput == false ) return str;
+ if ( escapeOutput == false )
+ {
+ return str;
+ }
StringBuffer buffer;
char ch;
@@ -1835,13 +1829,13 @@ public class XMLOutputter
}
return (
- "XMLOutputter[omitDeclaration = " + userFormat.omitDeclaration + ", " +
- "encoding = " + userFormat.encoding + ", " +
- "omitEncoding = " + userFormat.omitEncoding + ", " +
- "indent = '" + userFormat.indent + "'" + ", " +
- "expandEmptyElements = " + userFormat.expandEmptyElements + ", " +
- "lineSeparator = '" + buffer.toString() + "', " +
- "textMode = " + userFormat.mode + "]"
+ "XMLOutputter[omitDeclaration = " + userFormat.omitDeclaration + ", "
+ + "encoding = " + userFormat.encoding + ", "
+ + "omitEncoding = " + userFormat.omitEncoding + ", "
+ + "indent = '" + userFormat.indent + "'" + ", "
+ + "expandEmptyElements = " + userFormat.expandEmptyElements + ", "
+ + "lineSeparator = '" + buffer.toString() + "', "
+ + "textMode = " + userFormat.mode + "]"
);
}
Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeNotConfigured.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeNotConfigured.java?rev=927220&r1=927219&r2=927220&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeNotConfigured.java (original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeNotConfigured.java Wed Mar 24 23:15:36 2010
@@ -26,7 +26,8 @@ public class ArchetypeNotConfigured
{
private List missingProperties;
- public List getMissingProperties() {
+ public List getMissingProperties()
+ {
return missingProperties;
}
Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java?rev=927220&r1=927219&r2=927220&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java (original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java Wed Mar 24 23:15:36 2010
@@ -73,7 +73,7 @@ public class DefaultArchetypeGenerator
throw new ArchetypeNotDefined( "The archetype is not defined" );
}
- List repos = new ArrayList(/* repositories */);
+ List repos = new ArrayList/* repositories */();
ArtifactRepository remoteRepo = null;
if ( request != null && request.getArchetypeRepository() != null )
Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java?rev=927220&r1=927219&r2=927220&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java (original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java Wed Mar 24 23:15:36 2010
@@ -312,7 +312,7 @@ public class DefaultFilesetArchetypeGene
directory + "/" + ( packaged ? getPackageAsDirectory( packageName ) : "" ) + "/"
+ templateName.substring( moduleOffset.length() );
- if ( TOKEN_PATTERN.matcher(outputFileName).matches() )
+ if ( TOKEN_PATTERN.matcher( outputFileName ).matches() )
{
outputFileName = replaceFilenameTokens( outputFileName, context );
}
Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java?rev=927220&r1=927219&r2=927220&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java (original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java Wed Mar 24 23:15:36 2010
@@ -137,8 +137,8 @@ public class DefaultOldArchetype
{
getLogger().info( "----------------------------------------------------------------------------" );
- getLogger().info( "Using following parameters for creating OldArchetype: " + archetypeArtifactId + ":" +
- archetypeVersion );
+ getLogger().info( "Using following parameters for creating OldArchetype: " + archetypeArtifactId + ":"
+ + archetypeVersion );
getLogger().info( "----------------------------------------------------------------------------" );
@@ -242,8 +242,8 @@ public class DefaultOldArchetype
}
else
{
- throw new ArchetypeTemplateProcessingException( "Directory " +
- outputDirectoryFile.getName() + " already exists - please run from a clean directory" );
+ throw new ArchetypeTemplateProcessingException( "Directory "
+ + outputDirectoryFile.getName() + " already exists - please run from a clean directory" );
}
}
@@ -754,8 +754,8 @@ public class DefaultOldArchetype
private String getOutputDirectory( String outputDirectory,
String testResourceDirectory )
{
- return outputDirectory +
- ( testResourceDirectory.startsWith( "/" ) ? testResourceDirectory : "/" + testResourceDirectory );
+ return outputDirectory
+ + ( testResourceDirectory.startsWith( "/" ) ? testResourceDirectory : "/" + testResourceDirectory );
}
// ----------------------------------------------------------------------
Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/repositorycrawler/RepositoryCrawler.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/repositorycrawler/RepositoryCrawler.java?rev=927220&r1=927219&r2=927220&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/repositorycrawler/RepositoryCrawler.java (original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/repositorycrawler/RepositoryCrawler.java Wed Mar 24 23:15:36 2010
@@ -32,5 +32,5 @@ public interface RepositoryCrawler
ArchetypeCatalog crawl ( File repository );
- boolean writeCatalog (ArchetypeCatalog archetypeCatalog, File archetypeCatalogFile);
+ boolean writeCatalog( ArchetypeCatalog archetypeCatalog, File archetypeCatalogFile );
}
Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/source/RemoteCatalogArchetypeDataSource.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/source/RemoteCatalogArchetypeDataSource.java?rev=927220&r1=927219&r2=927220&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/source/RemoteCatalogArchetypeDataSource.java (original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/source/RemoteCatalogArchetypeDataSource.java Wed Mar 24 23:15:36 2010
@@ -40,7 +40,7 @@ public class RemoteCatalogArchetypeDataS
/** @plexus.requirement */
private WagonManager wagonManager;
- public static String REPOSITORY_PROPERTY = "repository";
+ public static final String REPOSITORY_PROPERTY = "repository";
public ArchetypeCatalog getArchetypeCatalog( Properties properties )
throws ArchetypeDataSourceException
@@ -80,7 +80,7 @@ public class RemoteCatalogArchetypeDataS
throw e;
}
catch ( Exception e )
- {// When the default archetype catalog names doesn't works, we assume the repository is the URL to a file
+ { // When the default archetype catalog names doesn't works, we assume the repository is the URL to a file
try
{
String repositoryPath = repository.substring( 0, repository.lastIndexOf( "/" ) );