You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kr...@apache.org on 2013/08/25 20:02:45 UTC
svn commit: r1517354 [4/4] - in /maven/plugins/trunk:
maven-acr-plugin/src/main/java/org/apache/maven/plugin/acr/
maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/
maven-ant-plugin/src/test/java/org/apache/maven/plugin/ant/stubs/
maven-antrun...
Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/util/JavaEEVersion.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/util/JavaEEVersion.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/util/JavaEEVersion.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/util/JavaEEVersion.java Sun Aug 25 18:02:43 2013
@@ -45,22 +45,22 @@ public class JavaEEVersion
/**
* Represents the J2EE 1.3 version.
*/
- public static final JavaEEVersion OneDotThree = new JavaEEVersion( Integer.valueOf( 0 ), VERSION_1_3 );
+ public static final JavaEEVersion OneDotThree = new JavaEEVersion(0, VERSION_1_3 );
/**
* Represents the J2EE 1.4 version.
*/
- public static final JavaEEVersion OneDotFour = new JavaEEVersion( Integer.valueOf( 1 ), VERSION_1_4 );
+ public static final JavaEEVersion OneDotFour = new JavaEEVersion(1, VERSION_1_4 );
/**
* Represents the JavaEE 5 version.
*/
- public static final JavaEEVersion Five = new JavaEEVersion( Integer.valueOf( 2 ), VERSION_5 );
+ public static final JavaEEVersion Five = new JavaEEVersion(2, VERSION_5 );
/**
* Represents the JavaEE 7 version.
*/
- public static final JavaEEVersion Six = new JavaEEVersion( Integer.valueOf( 3 ), VERSION_6 );
+ public static final JavaEEVersion Six = new JavaEEVersion(3, VERSION_6 );
private final Integer index;
Modified: maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/AbstractEarPluginIT.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/AbstractEarPluginIT.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/AbstractEarPluginIT.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/AbstractEarPluginIT.java Sun Aug 25 18:02:43 2013
@@ -100,7 +100,7 @@ public abstract class AbstractEarPluginI
catch ( VerificationException e )
{
//@TODO needs to be handled nicely in the verifier
- if ( expectNoError || e.getMessage().indexOf( "Exit code was non-zero" ) == -1 )
+ if ( expectNoError || !e.getMessage().contains("Exit code was non-zero"))
{
throw e;
}
@@ -299,20 +299,13 @@ public abstract class AbstractEarPluginI
list we add it but we don't add it's content. Otherwise, we don't
add the directory *BUT* we browse it's content
*/
- for ( int i = 0; i < result.length; i++ )
- {
- File file = result[i];
- if ( file.isFile() )
- {
- files.add( file );
- }
- else if ( expectedDirectories.contains( file ) )
- {
- files.add( file );
- }
- else
- {
- addFiles( file, files, expectedDirectories );
+ for (File file : result) {
+ if (file.isFile()) {
+ files.add(file);
+ } else if (expectedDirectories.contains(file)) {
+ files.add(file);
+ } else {
+ addFiles(file, files, expectedDirectories);
}
}
}
Modified: maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java Sun Aug 25 18:02:43 2013
@@ -487,9 +487,9 @@ public class EarMojoIT
final File baseDir = doTestProject( "project-045", new String[]{ "README.txt", "ejb-sample-one-1.0.jar" } );
final File actualReadme = new File( getEarDirectory( baseDir, "project-045" ), "README.txt" );
final String content = IOUtil.toString( ReaderFactory.newReader( actualReadme, "UTF-8" ) );
- assertTrue( "application name and version was not filtered properly", content.indexOf( "my-app 99.0" ) != -1 );
+ assertTrue( "application name and version was not filtered properly", content.contains("my-app 99.0"));
assertTrue( "Escaping did not work properly",
- content.indexOf( "will not be filtered ${application.name}." ) != -1 );
+ content.contains("will not be filtered ${application.name}."));
}
/**
@@ -502,10 +502,10 @@ public class EarMojoIT
final File baseDir = doTestProject( "project-046", new String[]{ "README.txt", "ejb-sample-one-1.0.jar" } );
final File actualReadme = new File( getEarDirectory( baseDir, "project-046" ), "README.txt" );
final String content = IOUtil.toString( ReaderFactory.newReader( actualReadme, "UTF-8" ) );
- assertTrue( "application name and version was not filtered properly", content.indexOf( "my-app 99.0" ) != -1 );
- assertTrue( "application build was not filtered properly", content.indexOf( "(Build 2)" ) != -1 );
+ assertTrue( "application name and version was not filtered properly", content.contains("my-app 99.0"));
+ assertTrue( "application build was not filtered properly", content.contains("(Build 2)"));
assertTrue( "Unknown property should not have been filtered",
- content.indexOf( "will not be filtered ${application.unknown}." ) != -1 );
+ content.contains("will not be filtered ${application.unknown}."));
}
/**
@@ -518,9 +518,9 @@ public class EarMojoIT
final File actualReadme = new File( getEarDirectory( baseDir, "project-047" ), "README.txt" );
final String content = IOUtil.toString( ReaderFactory.newReader( actualReadme, "UTF-8" ) );
assertTrue( "application name and version should not have been filtered",
- content.indexOf( "my-app 99.0" ) == -1 );
+ !content.contains("my-app 99.0"));
assertTrue( "original properties not found",
- content.indexOf( "${application.name} ${project.version}" ) != -1 );
+ content.contains("${application.name} ${project.version}"));
}
/**
Modified: maven/plugins/trunk/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java (original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java Sun Aug 25 18:02:43 2013
@@ -280,7 +280,7 @@ public class EjbMojo
if ( excludes != null && !excludes.isEmpty() )
{
excludes.add( EJB_JAR_XML );
- mainJarExcludes = (String[]) excludes.toArray( EMPTY_STRING_ARRAY );
+ mainJarExcludes = (String[]) excludes.toArray(new String[excludes.size()]);
}
archiver.getArchiver().addDirectory( outputDirectory, DEFAULT_INCLUDES, mainJarExcludes );
@@ -358,12 +358,12 @@ public class EjbMojo
if ( clientIncludes != null && !clientIncludes.isEmpty() )
{
- includes = (String[]) clientIncludes.toArray( EMPTY_STRING_ARRAY );
+ includes = (String[]) clientIncludes.toArray(new String[clientIncludes.size()]);
}
if ( clientExcludes != null && !clientExcludes.isEmpty() )
{
- excludes = (String[]) clientExcludes.toArray( EMPTY_STRING_ARRAY );
+ excludes = (String[]) clientExcludes.toArray(new String[clientExcludes.size()]);
}
File clientJarFile = new File( basedir, clientJarName + "-client.jar" );
Modified: maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/EjbMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/EjbMojoTest.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/EjbMojoTest.java (original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/EjbMojoTest.java Sun Aug 25 18:02:43 2013
@@ -608,20 +608,16 @@ public class EjbMojoTest
final JarContentChecker inclusionChecker = new JarContentChecker();
// set expected jar contents
- for ( int i = 0; i < expectedFiles.length; i++ )
- {
- String expectedFile = expectedFiles[i];
- inclusionChecker.addFile( new File( expectedFile ) );
+ for (String expectedFile : expectedFiles) {
+ inclusionChecker.addFile(new File(expectedFile));
}
assertTrue( inclusionChecker.isOK( new JarFile( checkedJarFile ) ) );
}
if ( unexpectedFiles != null )
{
final JarContentChecker exclusionChecker = new JarContentChecker();
- for ( int i = 0; i < unexpectedFiles.length; i++ )
- {
- String unexpectedFile = unexpectedFiles[i];
- exclusionChecker.addFile( new File( unexpectedFile ) );
+ for (String unexpectedFile : unexpectedFiles) {
+ exclusionChecker.addFile(new File(unexpectedFile));
}
assertFalse( exclusionChecker.isOK( new JarFile( checkedJarFile ) ) );
}
Modified: maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBuildStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBuildStub.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBuildStub.java (original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBuildStub.java Sun Aug 25 18:02:43 2013
@@ -225,20 +225,17 @@ public class MavenProjectBuildStub
{
File currentDirectory;
- for ( int nIndex = 0; nIndex < directoryList.size(); nIndex++ )
- {
- currentDirectory = new File( parent, "/" + (String) directoryList.get( nIndex ) );
+ for (Object aDirectoryList : directoryList) {
+ currentDirectory = new File(parent, "/" + (String) aDirectoryList);
- if ( !currentDirectory.exists() )
- {
+ if (!currentDirectory.exists()) {
currentDirectory.mkdirs();
}
// duplicate dir structure in test resources
- currentDirectory = new File( testparent, "/" + (String) directoryList.get( nIndex ) );
+ currentDirectory = new File(testparent, "/" + (String) aDirectoryList);
- if ( !currentDirectory.exists() )
- {
+ if (!currentDirectory.exists()) {
currentDirectory.mkdirs();
}
}
@@ -278,26 +275,20 @@ public class MavenProjectBuildStub
return;
}
- for ( int nIndex = 0; nIndex < list.size(); nIndex++ )
- {
- currentFile = new File( parent, (String) list.get( nIndex ) );
+ for (Object aList : list) {
+ currentFile = new File(parent, (String) aList);
// create the necessary parent directories
// before we create the files
- if ( !currentFile.getParentFile().exists() )
- {
+ if (!currentFile.getParentFile().exists()) {
currentFile.getParentFile().mkdirs();
}
- if ( !currentFile.exists() )
- {
- try
- {
+ if (!currentFile.exists()) {
+ try {
currentFile.createNewFile();
- populateFile( currentFile, RESOURCES_FILE );
- }
- catch ( IOException io )
- {
+ populateFile(currentFile, RESOURCES_FILE);
+ } catch (IOException io) {
//TODO: handle exception
}
}
Modified: maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/utils/JarContentChecker.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/utils/JarContentChecker.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/utils/JarContentChecker.java (original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/utils/JarContentChecker.java Sun Aug 25 18:02:43 2013
@@ -78,7 +78,7 @@ public class JarContentChecker
*/
public boolean isOK( JarFile jarFile )
{
- boolean bRetVal = false;
+ boolean bRetVal;
Enumeration zipentries = jarFile.entries();
ZipEntry entry;
File entryFile;
Modified: maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSignAttachedMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSignAttachedMojo.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSignAttachedMojo.java (original)
+++ maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/GpgSignAttachedMojo.java Sun Aug 25 18:02:43 2013
@@ -185,20 +185,18 @@ public class GpgSignAttachedMojo
// Attached artifacts
// ----------------------------------------------------------------------------
- for ( Iterator i = project.getAttachedArtifacts().iterator(); i.hasNext(); )
- {
- Artifact artifact = (Artifact) i.next();
+ for (Object o : project.getAttachedArtifacts()) {
+ Artifact artifact = (Artifact) o;
File file = artifact.getFile();
- getLog().debug( "Generating signature for " + file );
+ getLog().debug("Generating signature for " + file);
- File signature = signer.generateSignatureForArtifact( file );
+ File signature = signer.generateSignatureForArtifact(file);
- if ( signature != null )
- {
- signingBundles.add( new SigningBundle( artifact.getArtifactHandler().getExtension(),
- artifact.getClassifier(), signature ) );
+ if (signature != null) {
+ signingBundles.add(new SigningBundle(artifact.getArtifactHandler().getExtension(),
+ artifact.getClassifier(), signature));
}
}
@@ -206,12 +204,11 @@ public class GpgSignAttachedMojo
// Attach all the signatures
// ----------------------------------------------------------------------------
- for ( Iterator i = signingBundles.iterator(); i.hasNext(); )
- {
- SigningBundle bundle = (SigningBundle) i.next();
+ for (Object signingBundle : signingBundles) {
+ SigningBundle bundle = (SigningBundle) signingBundle;
- projectHelper.attachArtifact( project, bundle.getExtension() + GpgSigner.SIGNATURE_EXTENSION,
- bundle.getClassifier(), bundle.getSignature() );
+ projectHelper.attachArtifact(project, bundle.getExtension() + GpgSigner.SIGNATURE_EXTENSION,
+ bundle.getClassifier(), bundle.getSignature());
}
}
@@ -224,10 +221,8 @@ public class GpgSignAttachedMojo
*/
protected boolean isExcluded( String name )
{
- for ( int i = 0; i < excludes.length; i++ )
- {
- if ( SelectorUtils.matchPath( excludes[i], name ) )
- {
+ for (String exclude : excludes) {
+ if (SelectorUtils.matchPath(exclude, name)) {
return true;
}
}
Modified: maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/SignAndDeployFileMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/SignAndDeployFileMojo.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/SignAndDeployFileMojo.java (original)
+++ maven/plugins/trunk/maven-gpg-plugin/src/main/java/org/apache/maven/plugin/gpg/SignAndDeployFileMojo.java Sun Aug 25 18:02:43 2013
@@ -459,20 +459,16 @@ public class SignAndDeployFileMojo
List attachedArtifacts = project.getAttachedArtifacts();
- for ( Iterator i = attachedArtifacts.iterator(); i.hasNext(); )
- {
- Artifact attached = (Artifact) i.next();
+ for (Object attachedArtifact : attachedArtifacts) {
+ Artifact attached = (Artifact) attachedArtifact;
- fileSig = signer.generateSignatureForArtifact( attached.getFile() );
- attached = new AttachedSignedArtifact(attached, new AscArtifactMetadata( attached, fileSig, false ) );
- try
- {
- deploy( attached.getFile(), attached, deploymentRepository, localRepository );
- }
- catch ( ArtifactDeploymentException e )
- {
+ fileSig = signer.generateSignatureForArtifact(attached.getFile());
+ attached = new AttachedSignedArtifact(attached, new AscArtifactMetadata(attached, fileSig, false));
+ try {
+ deploy(attached.getFile(), attached, deploymentRepository, localRepository);
+ } catch (ArtifactDeploymentException e) {
throw new MojoExecutionException(
- "Error deploying attached artifact " + attached.getFile() + ": " + e.getMessage(), e );
+ "Error deploying attached artifact " + attached.getFile() + ": " + e.getMessage(), e);
}
}
@@ -657,10 +653,9 @@ public class SignAndDeployFileMojo
"Retrying deployment attempt " + ( count + 1 ) + " of " + retryFailedDeploymentCount );
}
deployer.deploy( source, artifact, deploymentRepository, localRepository );
- for ( Iterator i = artifact.getMetadataList().iterator(); i.hasNext(); )
- {
- ArtifactMetadata metadata = (ArtifactMetadata) i.next();
- getLog().info( "Metadata[" + metadata.getKey() + "].filename = " + metadata.getRemoteFilename());
+ for (Object o : artifact.getMetadataList()) {
+ ArtifactMetadata metadata = (ArtifactMetadata) o;
+ getLog().info("Metadata[" + metadata.getKey() + "].filename = " + metadata.getRemoteFilename());
}
exception = null;
break;
Modified: maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java (original)
+++ maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java Sun Aug 25 18:02:43 2013
@@ -950,8 +950,8 @@ public class DescribeMojo
Integer.TYPE } );
m.setAccessible( true );
List<String> output = (List<String>) m.invoke( HelpMojo.class,
- new Object[]{ text, Integer.valueOf( indent ), Integer.valueOf( indentSize ),
- Integer.valueOf( lineLength ) } );
+ new Object[]{ text, indent, indentSize,
+ lineLength} );
if ( output == null )
{
Modified: maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java (original)
+++ maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java Sun Aug 25 18:02:43 2013
@@ -267,9 +267,9 @@ public class EvaluateMojo
throw new IllegalArgumentException( "artifact parameter could not be empty" );
}
- String groupId = null; // required
- String artifactId = null; // required
- String version = null; // optional
+ String groupId; // required
+ String artifactId; // required
+ String version; // optional
String classifier = null; // optional
String[] artifactParts = artifactString.split( ":" );
@@ -602,7 +602,7 @@ public class EvaluateMojo
String name = jarEntry.getName().substring( 0, jarEntry.getName().indexOf( "." ) );
name = name.replaceAll( "/", "\\." );
- if ( name.indexOf( packageFilter ) != -1 )
+ if (name.contains(packageFilter))
{
try
{
Modified: maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/ExpressionsMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/ExpressionsMojo.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/ExpressionsMojo.java (original)
+++ maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/ExpressionsMojo.java Sun Aug 25 18:02:43 2013
@@ -168,9 +168,8 @@ public class ExpressionsMojo
StringBuilder sb = new StringBuilder();
String[] lines = StringUtils.split( description, "\r\n" );
- for ( int i = 0; i < lines.length; i++ )
- {
- sb.append( StringUtils.trim( lines[i] ) ).append( " " );
+ for (String line : lines) {
+ sb.append(StringUtils.trim(line)).append(" ");
}
return sb.toString();
Modified: maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/HelpUtil.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/HelpUtil.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/HelpUtil.java (original)
+++ maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/HelpUtil.java Sun Aug 25 18:02:43 2013
@@ -83,7 +83,7 @@ public class HelpUtil
m.setAccessible( true );
MojoDescriptor mojoDescriptor =
(MojoDescriptor) m.invoke( lifecycleExecutor, new Object[] { task, session, project, invokedVia,
- Boolean.valueOf( canUsePrefix ), Boolean.valueOf( isOptionalMojo ) } );
+ canUsePrefix, isOptionalMojo} );
if ( mojoDescriptor == null )
{
Modified: maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/SystemMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/SystemMojo.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/SystemMojo.java (original)
+++ maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/SystemMojo.java Sun Aug 25 18:02:43 2013
@@ -66,11 +66,10 @@ public class SystemMojo
message.append( StringUtils.repeat( "=", LINE_LENGTH ) ).append( '\n' );
Properties systemProperties = System.getProperties();
- for ( Iterator<?> it = systemProperties.keySet().iterator(); it.hasNext(); )
- {
- String key = it.next().toString();
- message.append( "\n" );
- message.append( key ).append( "=" ).append( systemProperties.get( key ) );
+ for (Object o1 : systemProperties.keySet()) {
+ String key = o1.toString();
+ message.append("\n");
+ message.append(key).append("=").append(systemProperties.get(key));
}
message.append( '\n' ).append( '\n' );
@@ -80,11 +79,10 @@ public class SystemMojo
try
{
Properties envVars = CommandLineUtils.getSystemEnvVars();
- for ( Iterator<?> it2 = envVars.keySet().iterator(); it2.hasNext(); )
- {
- String key = it2.next().toString();
- message.append( "\n" );
- message.append( key ).append( "=" ).append( envVars.get( key ) );
+ for (Object o : envVars.keySet()) {
+ String key = o.toString();
+ message.append("\n");
+ message.append(key).append("=").append(envVars.get(key));
}
}
catch ( IOException e )
Modified: maven/plugins/trunk/maven-help-plugin/src/test/java/org/apache/maven/plugins/help/DescribeMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-help-plugin/src/test/java/org/apache/maven/plugins/help/DescribeMojoTest.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-help-plugin/src/test/java/org/apache/maven/plugins/help/DescribeMojoTest.java (original)
+++ maven/plugins/trunk/maven-help-plugin/src/test/java/org/apache/maven/plugins/help/DescribeMojoTest.java Sun Aug 25 18:02:43 2013
@@ -44,8 +44,8 @@ public class DescribeMojoTest
try
{
PrivateAccessor.invoke( DescribeMojo.class, "toLines", new Class[] { String.class, Integer.TYPE,
- Integer.TYPE, Integer.TYPE }, new Object[] { "", new Integer( 2 ), new Integer( 2 ),
- new Integer( 80 ) } );
+ Integer.TYPE, Integer.TYPE }, new Object[] { "", 2, 2,
+ 80} );
assertTrue( true );
}
catch ( Throwable e )
Modified: maven/plugins/trunk/maven-help-plugin/src/test/java/org/apache/maven/plugins/help/stubs/DefaultMavenProjectStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-help-plugin/src/test/java/org/apache/maven/plugins/help/stubs/DefaultMavenProjectStub.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-help-plugin/src/test/java/org/apache/maven/plugins/help/stubs/DefaultMavenProjectStub.java (original)
+++ maven/plugins/trunk/maven-help-plugin/src/test/java/org/apache/maven/plugins/help/stubs/DefaultMavenProjectStub.java Sun Aug 25 18:02:43 2013
@@ -39,7 +39,7 @@ public class DefaultMavenProjectStub
public DefaultMavenProjectStub()
{
MavenXpp3Reader pomReader = new MavenXpp3Reader();
- Model model = null;
+ Model model;
try
{
Modified: maven/plugins/trunk/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarSignMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarSignMojo.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarSignMojo.java (original)
+++ maven/plugins/trunk/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarSignMojo.java Sun Aug 25 18:02:43 2013
@@ -273,9 +273,8 @@ public class JarSignMojo
addArgIf( arguments, alias != null, this.alias );
- for ( Iterator it = arguments.iterator(); it.hasNext(); )
- {
- commandLine.createArgument().setValue( it.next().toString() );
+ for (Object argument : arguments) {
+ commandLine.createArgument().setValue(argument.toString());
}
commandLine.setWorkingDirectory( workingDirectory.getAbsolutePath() );
@@ -352,7 +351,7 @@ public class JarSignMojo
private String purgePassword( Commandline commandLine )
{
String out = commandLine.toString();
- if ( keypass != null && out.indexOf( keypass ) != -1 )
+ if ( keypass != null && out.contains(keypass))
{
out = StringUtils.replace( out, keypass, "******" );
}
Modified: maven/plugins/trunk/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarSignVerifyMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarSignVerifyMojo.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarSignVerifyMojo.java (original)
+++ maven/plugins/trunk/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarSignVerifyMojo.java Sun Aug 25 18:02:43 2013
@@ -134,9 +134,8 @@ public class JarSignVerifyMojo
arguments.add( getJarFile() );
- for ( Iterator it = arguments.iterator() ; it.hasNext() ; )
- {
- commandLine.createArgument().setValue( it.next().toString() );
+ for (Object argument : arguments) {
+ commandLine.createArgument().setValue(argument.toString());
}
commandLine.setWorkingDirectory( workingDirectory.getAbsolutePath() );
Modified: maven/plugins/trunk/maven-jarsigner-plugin/src/main/java/org/apache/maven/plugins/jarsigner/AbstractJarsignerMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jarsigner-plugin/src/main/java/org/apache/maven/plugins/jarsigner/AbstractJarsignerMojo.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jarsigner-plugin/src/main/java/org/apache/maven/plugins/jarsigner/AbstractJarsignerMojo.java (original)
+++ maven/plugins/trunk/maven-jarsigner-plugin/src/main/java/org/apache/maven/plugins/jarsigner/AbstractJarsignerMojo.java Sun Aug 25 18:02:43 2013
@@ -207,21 +207,18 @@ public abstract class AbstractJarsignerM
excludes.addAll( Arrays.asList( excludeClassifiers ) );
}
- for ( Iterator it = this.project.getAttachedArtifacts().iterator(); it.hasNext(); )
- {
- final Artifact artifact = (Artifact) it.next();
+ for (Object o : this.project.getAttachedArtifacts()) {
+ final Artifact artifact = (Artifact) o;
- if ( !includes.isEmpty() && !includes.contains( artifact.getClassifier() ) )
- {
+ if (!includes.isEmpty() && !includes.contains(artifact.getClassifier())) {
continue;
}
- if ( excludes.contains( artifact.getClassifier() ) )
- {
+ if (excludes.contains(artifact.getClassifier())) {
continue;
}
- processed += processArtifact( artifact ) ? 1 : 0;
+ processed += processArtifact(artifact) ? 1 : 0;
}
}
else
@@ -252,17 +249,16 @@ public abstract class AbstractJarsignerM
"Failed to scan archive directory for JARs: " + e.getMessage(), e );
}
- for ( Iterator it = jarFiles.iterator(); it.hasNext(); )
- {
- File jarFile = (File) it.next();
+ for (Object jarFile1 : jarFiles) {
+ File jarFile = (File) jarFile1;
- processArchive( jarFile );
+ processArchive(jarFile);
processed++;
}
}
}
- getLog().info( getMessage( "processed", Integer.valueOf( processed ) ) );
+ getLog().info( getMessage( "processed", processed) );
}
else
{
@@ -403,7 +399,7 @@ public abstract class AbstractJarsignerM
if ( resultCode != 0 )
{
throw new MojoExecutionException(
- getMessage( "failure", getCommandlineInfo( commandLine ), new Integer( resultCode ) ) );
+ getMessage( "failure", getCommandlineInfo( commandLine ), resultCode) );
}
}
Modified: maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/LinkcheckReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/LinkcheckReport.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/LinkcheckReport.java (original)
+++ maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/LinkcheckReport.java Sun Aug 25 18:02:43 2013
@@ -484,7 +484,7 @@ public class LinkcheckReport
// Exclude this report
pagesToExclude.add( getOutputName() + ".html" );
- return (String[]) pagesToExclude.toArray( new String[0] );
+ return (String[]) pagesToExclude.toArray(new String[pagesToExclude.size()]);
}
// ----------------------------------------------------------------------
@@ -515,10 +515,9 @@ public class LinkcheckReport
try
{
getLog().debug( "Copying static linkcheck resources." );
- for ( int i = 0; i < resourceNames.length; i++ )
- {
- URL url = this.getClass().getClassLoader().getResource( pluginResourcesBase + "/" + resourceNames[i] );
- FileUtils.copyURLToFile( url, new File( getReportOutputDirectory(), resourceNames[i] ) );
+ for (String resourceName : resourceNames) {
+ URL url = this.getClass().getClassLoader().getResource(pluginResourcesBase + "/" + resourceName);
+ FileUtils.copyURLToFile(url, new File(getReportOutputDirectory(), resourceName));
}
}
catch ( IOException e )
@@ -539,7 +538,7 @@ public class LinkcheckReport
for ( int i = 0; i < array.length; i++ )
{
- newArray[i] = array[i].intValue();
+ newArray[i] = array[i];
}
return newArray;
Modified: maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/LinkcheckReportGenerator.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/LinkcheckReportGenerator.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/LinkcheckReportGenerator.java (original)
+++ maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/LinkcheckReportGenerator.java Sun Aug 25 18:02:43 2013
@@ -194,14 +194,13 @@ public class LinkcheckReportGenerator
int totalValidLinks = 0;
int totalErrorLinks = 0;
int totalWarningLinks = 0;
- for ( Iterator it = linkcheckFiles.iterator(); it.hasNext(); )
- {
- LinkcheckFile linkcheckFile = (LinkcheckFile) it.next();
+ for (Object linkcheckFile1 : linkcheckFiles) {
+ LinkcheckFile linkcheckFile = (LinkcheckFile) linkcheckFile1;
totalLinks += linkcheckFile.getNumberOfLinks();
- totalValidLinks += linkcheckFile.getNumberOfLinks( LinkcheckFileResult.VALID_LEVEL );
- totalErrorLinks += linkcheckFile.getNumberOfLinks( LinkcheckFileResult.ERROR_LEVEL );
- totalWarningLinks += linkcheckFile.getNumberOfLinks( LinkcheckFileResult.WARNING_LEVEL );
+ totalValidLinks += linkcheckFile.getNumberOfLinks(LinkcheckFileResult.VALID_LEVEL);
+ totalErrorLinks += linkcheckFile.getNumberOfLinks(LinkcheckFileResult.ERROR_LEVEL);
+ totalWarningLinks += linkcheckFile.getNumberOfLinks(LinkcheckFileResult.WARNING_LEVEL);
}
sink.section1();
@@ -403,109 +402,93 @@ public class LinkcheckReportGenerator
// Content
List linkcheckFiles = linkcheckModel.getFiles();
- for ( Iterator it = linkcheckFiles.iterator(); it.hasNext(); )
- {
- LinkcheckFile linkcheckFile = (LinkcheckFile) it.next();
+ for (Object linkcheckFile1 : linkcheckFiles) {
+ LinkcheckFile linkcheckFile = (LinkcheckFile) linkcheckFile1;
sink.tableRow();
sink.tableCell();
- if ( linkcheckFile.getUnsuccessful() == 0 )
- {
- iconValid( locale, sink );
- }
- else
- {
- iconError( locale, sink );
+ if (linkcheckFile.getUnsuccessful() == 0) {
+ iconValid(locale, sink);
+ } else {
+ iconError(locale, sink);
}
sink.tableCell_();
// tableCell( createLinkPatternedText( linkcheckFile.getRelativePath(), "./"
// + linkcheckFile.getRelativePath() ) );
sink.tableCell();
- sink.link( linkcheckFile.getRelativePath() );
- sink.text( linkcheckFile.getRelativePath() );
+ sink.link(linkcheckFile.getRelativePath());
+ sink.text(linkcheckFile.getRelativePath());
sink.link_();
sink.tableCell_();
sink.tableCell();
- sink.text( String.valueOf( linkcheckFile.getNumberOfLinks() ) );
+ sink.text(String.valueOf(linkcheckFile.getNumberOfLinks()));
sink.tableCell_();
sink.tableCell();
- sink.text( String.valueOf( linkcheckFile.getNumberOfLinks( LinkcheckFileResult.VALID_LEVEL ) ) );
+ sink.text(String.valueOf(linkcheckFile.getNumberOfLinks(LinkcheckFileResult.VALID_LEVEL)));
sink.tableCell_();
sink.tableCell();
- sink.text( String.valueOf( linkcheckFile.getNumberOfLinks( LinkcheckFileResult.WARNING_LEVEL ) ) );
+ sink.text(String.valueOf(linkcheckFile.getNumberOfLinks(LinkcheckFileResult.WARNING_LEVEL)));
sink.tableCell_();
sink.tableCell();
- sink.text( String.valueOf( linkcheckFile.getNumberOfLinks( LinkcheckFileResult.ERROR_LEVEL ) ) );
+ sink.text(String.valueOf(linkcheckFile.getNumberOfLinks(LinkcheckFileResult.ERROR_LEVEL)));
sink.tableCell_();
sink.tableRow_();
// Detail error
- if ( linkcheckFile.getUnsuccessful() != 0 )
- {
+ if (linkcheckFile.getUnsuccessful() != 0) {
sink.tableRow();
sink.tableCell();
- sink.text( "" );
+ sink.text("");
sink.tableCell_();
// TODO it is due to DOXIA-78
- sink.rawText( "<td colspan=\"5\">" );
+ sink.rawText("<td colspan=\"5\">");
sink.table();
- for ( Iterator it2 = linkcheckFile.getResults().iterator(); it2.hasNext(); )
- {
- LinkcheckFileResult linkcheckFileResult = (LinkcheckFileResult) it2.next();
+ for (Object o : linkcheckFile.getResults()) {
+ LinkcheckFileResult linkcheckFileResult = (LinkcheckFileResult) o;
- if ( linkcheckFileResult.getStatusLevel() == LinkcheckFileResult.VALID_LEVEL )
- {
+ if (linkcheckFileResult.getStatusLevel() == LinkcheckFileResult.VALID_LEVEL) {
continue;
}
sink.tableRow();
sink.tableCell();
- if ( linkcheckFileResult.getStatusLevel() == LinkcheckFileResult.WARNING_LEVEL )
- {
- iconWarning( locale, sink );
- }
- else if ( linkcheckFileResult.getStatusLevel() == LinkcheckFileResult.ERROR_LEVEL )
- {
- iconError( locale, sink );
+ if (linkcheckFileResult.getStatusLevel() == LinkcheckFileResult.WARNING_LEVEL) {
+ iconWarning(locale, sink);
+ } else if (linkcheckFileResult.getStatusLevel() == LinkcheckFileResult.ERROR_LEVEL) {
+ iconError(locale, sink);
}
sink.tableCell_();
sink.tableCell();
sink.italic();
- if ( linkcheckFileResult.getTarget().startsWith( "#" ) )
- {
- sink.link( linkcheckFile.getRelativePath() + linkcheckFileResult.getTarget() );
- }
- else if ( linkcheckFileResult.getTarget().startsWith( "." ) )
- {
+ if (linkcheckFileResult.getTarget().startsWith("#")) {
+ sink.link(linkcheckFile.getRelativePath() + linkcheckFileResult.getTarget());
+ } else if (linkcheckFileResult.getTarget().startsWith(".")) {
// We need to calculate a correct absolute path here, because target is a relative path
- String absolutePath = FilenameUtils.getFullPath( linkcheckFile.getRelativePath() )
- + linkcheckFileResult.getTarget();
- String normalizedPath = FilenameUtils.normalize( absolutePath );
- if ( normalizedPath == null )
- {
+ String absolutePath = FilenameUtils.getFullPath(linkcheckFile.getRelativePath())
+ + linkcheckFileResult.getTarget();
+ String normalizedPath = FilenameUtils.normalize(absolutePath);
+ if (normalizedPath == null) {
normalizedPath = absolutePath;
}
- sink.link( normalizedPath );
- }
- else
- {
- sink.link( linkcheckFileResult.getTarget() );
+ sink.link(normalizedPath);
+ } else {
+ sink.link(linkcheckFileResult.getTarget());
}
// Show the link as it was written to make it easy for
// the author to find it in the source document
- sink.text( linkcheckFileResult.getTarget() );
+ sink.text(linkcheckFileResult.getTarget());
sink.link_();
- sink.text( ": " );
- sink.text( linkcheckFileResult.getErrorMessage() );
+ sink.text(": ");
+ sink.text(linkcheckFileResult.getErrorMessage());
sink.italic_();
sink.tableCell_();
Modified: maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/SiteInvoker.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/SiteInvoker.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/SiteInvoker.java (original)
+++ maven/plugins/trunk/maven-linkcheck-plugin/src/main/java/org/apache/maven/plugins/linkcheck/SiteInvoker.java Sun Aug 25 18:02:43 2013
@@ -157,9 +157,8 @@ public class SiteInvoker
{
List profileIds = new ArrayList();
- for ( Iterator it = clone.getActiveProfiles().iterator(); it.hasNext(); )
- {
- profileIds.add( ( (Profile) it.next() ).getId() );
+ for (Object o : clone.getActiveProfiles()) {
+ profileIds.add(((Profile) o).getId());
}
return profileIds;
@@ -233,7 +232,7 @@ public class SiteInvoker
}
if ( invokerLogContent != null
- && invokerLogContent.indexOf( "Error occurred during initialization of VM" ) != -1 )
+ && invokerLogContent.contains("Error occurred during initialization of VM"))
{
getLog().info( "Error occurred during initialization of VM, try to use an empty MAVEN_OPTS." );
Modified: maven/plugins/trunk/maven-patch-plugin/src/main/java/org/apache/maven/plugin/patch/ApplyMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-patch-plugin/src/main/java/org/apache/maven/plugin/patch/ApplyMojo.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-patch-plugin/src/main/java/org/apache/maven/plugin/patch/ApplyMojo.java (original)
+++ maven/plugins/trunk/maven-patch-plugin/src/main/java/org/apache/maven/plugin/patch/ApplyMojo.java Sun Aug 25 18:02:43 2013
@@ -262,7 +262,7 @@ public class ApplyMojo
patchTrackingFile.getParentFile().mkdirs();
- Map patchesToApply = null;
+ Map patchesToApply;
try
{
@@ -322,38 +322,30 @@ public class ApplyMojo
throw new MojoFailureException( "unable to read patch tracking file: " + ioe.getMessage() );
}
- for ( Iterator it = patches.iterator(); it.hasNext(); )
- {
- String patch = (String) it.next();
+ for (Object patche : patches) {
+ String patch = (String) patche;
- if ( alreadyAppliedPatches.indexOf( patch ) == -1 )
- {
- File patchFile = new File( patchSourceDir, patch );
+ if (!alreadyAppliedPatches.contains(patch)) {
+ File patchFile = new File(patchSourceDir, patch);
- getLog().debug( "Looking for patch: " + patch + " in: " + patchFile );
+ getLog().debug("Looking for patch: " + patch + " in: " + patchFile);
- if ( !patchFile.exists() )
- {
- if ( strictPatching )
- {
- throw new MojoFailureException( this, "Patch operation cannot proceed.",
- "Cannot find specified patch: \'" + patch
- + "\' in patch-source directory: \'" + patchSourceDir
- + "\'.\n\nEither fix this error, "
- + "or relax strictPatching." );
- }
- else
- {
+ if (!patchFile.exists()) {
+ if (strictPatching) {
+ throw new MojoFailureException(this, "Patch operation cannot proceed.",
+ "Cannot find specified patch: \'" + patch
+ + "\' in patch-source directory: \'" + patchSourceDir
+ + "\'.\n\nEither fix this error, "
+ + "or relax strictPatching.");
+ } else {
getLog().info(
- "Skipping patch: " + patch + " listed in the parameter \"patches\"; "
- + "it is missing." );
+ "Skipping patch: " + patch + " listed in the parameter \"patches\"; "
+ + "it is missing.");
}
- }
- else
- {
- foundPatchFiles.remove( patch );
+ } else {
+ foundPatchFiles.remove(patch);
- patchesApplied.put( patch, createPatchCommand( patchFile ) );
+ patchesApplied.put(patch, createPatchCommand(patchFile));
}
}
}
@@ -380,11 +372,10 @@ public class ApplyMojo
List limbo = new ArrayList( foundPatchFiles );
- for ( Iterator it = ignored.iterator(); it.hasNext(); )
- {
- String ignoredFile = (String) it.next();
+ for (Object anIgnored : ignored) {
+ String ignoredFile = (String) anIgnored;
- limbo.remove( ignoredFile );
+ limbo.remove(ignoredFile);
}
if ( !limbo.isEmpty() )
@@ -393,11 +384,10 @@ public class ApplyMojo
extraFileBuffer.append( "Found " + limbo.size() + " unlisted patch files:" );
- for ( Iterator it = foundPatchFiles.iterator(); it.hasNext(); )
- {
- String patch = (String) it.next();
+ for (Object foundPatchFile : foundPatchFiles) {
+ String patch = (String) foundPatchFile;
- extraFileBuffer.append( "\n \'" ).append( patch ).append( '\'' );
+ extraFileBuffer.append("\n \'").append(patch).append('\'');
}
extraFileBuffer.append( "\n\nEither remove these files, "
@@ -429,44 +419,35 @@ public class ApplyMojo
// used if failFast is false
List failedPatches = new ArrayList();
- for ( Iterator it = patchesApplied.entrySet().iterator(); it.hasNext(); )
- {
- Map.Entry entry = (Entry) it.next();
+ for (Object o : patchesApplied.entrySet()) {
+ Entry entry = (Entry) o;
String patchName = (String) entry.getKey();
Commandline cli = (Commandline) entry.getValue();
- try
- {
- getLog().info( "Applying patch: " + patchName );
+ try {
+ getLog().info("Applying patch: " + patchName);
- int result = executeCommandLine( cli, consumer, consumer );
+ int result = executeCommandLine(cli, consumer, consumer);
- if ( result != 0 )
- {
- if ( failFast )
- {
- throw new MojoExecutionException( "Patch command failed with exit code " + result + " for "
- + patchName + ". Please see console and debug output for more information." );
- }
- else
- {
- failedPatches.add( patchName );
+ if (result != 0) {
+ if (failFast) {
+ throw new MojoExecutionException("Patch command failed with exit code " + result + " for "
+ + patchName + ". Please see console and debug output for more information.");
+ } else {
+ failedPatches.add(patchName);
}
}
- }
- catch ( CommandLineException e )
- {
- throw new MojoExecutionException( "Failed to apply patch: " + patchName
- + ". See debug output for more information.", e );
+ } catch (CommandLineException e) {
+ throw new MojoExecutionException("Failed to apply patch: " + patchName
+ + ". See debug output for more information.", e);
}
}
if ( !failedPatches.isEmpty() )
{
getLog().error( "Failed applying one or more patches:" );
- for ( Iterator it = failedPatches.iterator(); it.hasNext(); )
- {
- getLog().error( "* " + it.next() );
+ for (Object failedPatche : failedPatches) {
+ getLog().error("* " + failedPatche);
}
throw new MojoExecutionException( "Patch command failed for one or more patches."
+ " Please see console and debug output for more information." );
@@ -534,14 +515,12 @@ public class ApplyMojo
private void checkForWatchPhrases( String output )
throws MojoExecutionException
{
- for ( Iterator it = failurePhrases.iterator(); it.hasNext(); )
- {
- String phrase = (String) it.next();
+ for (Object failurePhrase : failurePhrases) {
+ String phrase = (String) failurePhrase;
- if ( output.indexOf( phrase ) > -1 )
- {
- throw new MojoExecutionException( "Failed to apply patches (detected watch-phrase: \'" + phrase
- + "\' in output). " + "If this is in error, configure the patchFailureWatchPhrases parameter." );
+ if (output.contains(phrase)) {
+ throw new MojoExecutionException("Failed to apply patches (detected watch-phrase: \'" + phrase
+ + "\' in output). " + "If this is in error, configure the patchFailureWatchPhrases parameter.");
}
}
}
Modified: maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/DocumentModelBuilder.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/DocumentModelBuilder.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/DocumentModelBuilder.java (original)
+++ maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/DocumentModelBuilder.java Sun Aug 25 18:02:43 2013
@@ -224,34 +224,28 @@ public class DocumentModelBuilder
final List<DocumentAuthor> ret = new ArrayList<DocumentAuthor>( 4 );
- for ( final Iterator it = project.getDevelopers().iterator(); it.hasNext(); )
- {
- final Developer developer = (Developer) it.next();
+ for (Object o : project.getDevelopers()) {
+ final Developer developer = (Developer) o;
final DocumentAuthor author = new DocumentAuthor();
- author.setName( developer.getName() );
- author.setEmail( developer.getEmail() );
- author.setCompanyName( developer.getOrganization() );
+ author.setName(developer.getName());
+ author.setEmail(developer.getEmail());
+ author.setCompanyName(developer.getOrganization());
StringBuilder roles = null;
- for ( final String role : developer.getRoles() )
- {
- if ( roles == null )
- {
- roles = new StringBuilder( 32 );
- }
- else
- {
- roles.append( ',' ).append( ' ' );
+ for (final String role : developer.getRoles()) {
+ if (roles == null) {
+ roles = new StringBuilder(32);
+ } else {
+ roles.append(',').append(' ');
}
- roles.append( role );
+ roles.append(role);
}
- if ( roles != null )
- {
- author.setPosition( roles.toString() );
+ if (roles != null) {
+ author.setPosition(roles.toString());
}
- ret.add( author );
+ ret.add(author);
}
return ret;
Modified: maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java?rev=1517354&r1=1517353&r2=1517354&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java (original)
+++ maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java Sun Aug 25 18:02:43 2013
@@ -534,7 +534,7 @@ public class PdfMojo
context.put( "StringUtils", new StringUtils() );
context.put( "i18n", i18n );
context.put( "generateTOC", generateTOC );
- context.put( "validate", Boolean.valueOf( validate ) );
+ context.put( "validate", validate);
final DocumentModel model = aggregate ? getDocumentModel( locale ) : null;
@@ -1017,15 +1017,13 @@ public class PdfMojo
}
List mojoDescriptors = pluginDescriptor.getMojos();
- for ( final Iterator it2 = mojoDescriptors.iterator(); it2.hasNext(); )
- {
- final MojoDescriptor mojoDescriptor = (MojoDescriptor) it2.next();
-
- if ( goals.isEmpty() || ( !goals.isEmpty() && goals.contains( mojoDescriptor.getGoal() ) ) )
- {
- MavenReport report = getMavenReport( mojoDescriptor );
-
- generateMavenReport( report, mojoDescriptor.getPluginDescriptor().getPluginArtifact(), locale );
+ for (Object mojoDescriptor1 : mojoDescriptors) {
+ final MojoDescriptor mojoDescriptor = (MojoDescriptor) mojoDescriptor1;
+
+ if (goals.isEmpty() || (!goals.isEmpty() && goals.contains(mojoDescriptor.getGoal()))) {
+ MavenReport report = getMavenReport(mojoDescriptor);
+
+ generateMavenReport(report, mojoDescriptor.getPluginDescriptor().getPluginArtifact(), locale);
}
}
}
@@ -1485,21 +1483,18 @@ public class PdfMojo
if ( pluginProject.getMailingLists() != null && !pluginProject.getMailingLists().isEmpty() )
{
boolean appended = false;
- for ( Iterator i = pluginProject.getMailingLists().iterator(); i.hasNext(); )
- {
- MailingList mailingList = (MailingList) i.next();
+ for (Object o : pluginProject.getMailingLists()) {
+ MailingList mailingList = (MailingList) o;
- if ( StringUtils.isNotEmpty( mailingList.getName() )
- && StringUtils.isNotEmpty( mailingList.getPost() ) )
- {
- if ( !appended )
- {
- sb.append( " Mailing Lists:" ).append( EOL );
+ if (StringUtils.isNotEmpty(mailingList.getName())
+ && StringUtils.isNotEmpty(mailingList.getPost())) {
+ if (!appended) {
+ sb.append(" Mailing Lists:").append(EOL);
appended = true;
}
- sb.append( " " ).append( mailingList.getName() );
- sb.append( ": " ).append( mailingList.getPost() );
- sb.append( EOL );
+ sb.append(" ").append(mailingList.getName());
+ sb.append(": ").append(mailingList.getPost());
+ sb.append(EOL);
}
}
}