Author: hboutemy
Date: Fri Nov 28 21:58:20 2014
New Revision: 1642370

URL: http://svn.apache.org/r1642370
Log:
updated parent pom and fixed errors reported by Checkstyle

Modified:
    maven/plugins/trunk/maven-patch-plugin/pom.xml
    
maven/plugins/trunk/maven-patch-plugin/src/main/java/org/apache/maven/plugin/patch/ApplyMojo.java

Modified: maven/plugins/trunk/maven-patch-plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-patch-plugin/pom.xml?rev=1642370&r1=1642369&r2=1642370&view=diff
==============================================================================
--- maven/plugins/trunk/maven-patch-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-patch-plugin/pom.xml Fri Nov 28 21:58:20 2014
@@ -25,7 +25,7 @@ under the License.
   <parent>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-plugins</artifactId>
-    <version>25</version>
+    <version>27</version>
     <relativePath>../maven-plugins/pom.xml</relativePath>
   </parent>
 
@@ -64,7 +64,6 @@ under the License.
 
   <properties>
     <mavenVersion>2.2.1</mavenVersion>
-    <mavenPluginVersion>3.2</mavenPluginVersion>
   </properties>
 
   <dependencies>
@@ -77,7 +76,6 @@ under the License.
     <dependency>
       <groupId>org.apache.maven.plugin-tools</groupId>
       <artifactId>maven-plugin-annotations</artifactId>
-      <version>${mavenPluginVersion}</version>
       <scope>provided</scope>
     </dependency>
 
@@ -101,18 +99,10 @@ under the License.
     <pluginManagement>
       <plugins>
         <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-plugin-plugin</artifactId>
-          <version>${mavenPluginVersion}</version>
-          <configuration>
-            <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
-          </configuration>
-        </plugin>
-        <plugin>
           <groupId>org.apache.rat</groupId>
           <artifactId>apache-rat-plugin</artifactId>
           <configuration>
-            <excludes>
+            <excludes combine.children="append">
               <!--
                 This is a plugin-specific data file that must only contain the 
names of applied patches.
               -->
@@ -122,19 +112,6 @@ under the License.
         </plugin>
       </plugins>
     </pluginManagement>
-    <plugins>
-      <plugin>
-        <artifactId>maven-plugin-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>generate-descriptor</id>
-            <goals>
-              <goal>descriptor</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
   </build>
 
   <profiles>
@@ -146,16 +123,6 @@ under the License.
             <plugin>
               <artifactId>maven-invoker-plugin</artifactId>
               <configuration>
-                <debug>true</debug>
-                <projectsDirectory>src/it</projectsDirectory>
-                
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
-                <pomIncludes>
-                  <pomInclude>*/pom.xml</pomInclude>
-                </pomIncludes>
-                <preBuildHookScript>setup</preBuildHookScript>
-                <postBuildHookScript>verify</postBuildHookScript>
-                
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
-                <settingsFile>src/it/settings.xml</settingsFile>
                 <goals>
                   <goal>clean</goal>
                   <goal>initialize</goal>

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=1642370&r1=1642369&r2=1642370&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
 Fri Nov 28 21:58:20 2014
@@ -322,30 +322,37 @@ public class ApplyMojo
             throw new MojoFailureException( "unable to read patch tracking 
file: " + ioe.getMessage() );
         }
 
-        for (Object patche : patches) {
+        for ( Object patche : patches )
+        {
             String patch = (String) patche;
 
-            if (!alreadyAppliedPatches.contains(patch)) {
-                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 {
-                        getLog().info(
-                                "Skipping patch: " + patch + " listed in the 
parameter \"patches\"; "
-                                        + "it is missing.");
+                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 {
-                    foundPatchFiles.remove(patch);
+                    else
+                    {
+                        getLog().info( "Skipping patch: " + patch + " listed 
in the parameter \"patches\"; "
+                                           + "it is missing." );
+                    }
+                }
+                else
+                {
+                    foundPatchFiles.remove( patch );
 
-                    patchesApplied.put(patch, createPatchCommand(patchFile));
+                    patchesApplied.put( patch, createPatchCommand( patchFile ) 
);
                 }
             }
         }
@@ -372,22 +379,24 @@ public class ApplyMojo
 
             List limbo = new ArrayList( foundPatchFiles );
 
-            for (Object anIgnored : ignored) {
+            for ( Object anIgnored : ignored )
+            {
                 String ignoredFile = (String) anIgnored;
 
-                limbo.remove(ignoredFile);
+                limbo.remove( ignoredFile );
             }
 
             if ( !limbo.isEmpty() )
             {
                 StringBuilder extraFileBuffer = new StringBuilder();
 
-                extraFileBuffer.append("Found ").append(limbo.size()).append(" 
unlisted patch files:");
+                extraFileBuffer.append( "Found " ).append( limbo.size() 
).append( " unlisted patch files:" );
 
-                for (Object foundPatchFile : foundPatchFiles) {
+                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, "
@@ -419,35 +428,44 @@ public class ApplyMojo
         // used if failFast is false
         List failedPatches = new ArrayList();
 
-        for (Object o : patchesApplied.entrySet()) {
+        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 (Object failedPatche : failedPatches) {
-                getLog().error("* " + failedPatche);
+            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." 
);
@@ -515,12 +533,14 @@ public class ApplyMojo
     private void checkForWatchPhrases( String output )
         throws MojoExecutionException
     {
-        for (Object failurePhrase : failurePhrases) {
+        for ( Object failurePhrase : failurePhrases )
+        {
             String phrase = (String) failurePhrase;
 
-            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.");
+            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." );
             }
         }
     }


Reply via email to