tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1309560 - in /tomcat/maven-plugin/trunk: tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RunMojo.java tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/RunMojo.java
Date Wed, 04 Apr 2012 19:31:33 GMT
Author: olamy
Date: Wed Apr  4 19:31:33 2012
New Revision: 1309560

URL: http://svn.apache.org/viewvc?rev=1309560&view=rev
Log:
[MTOMCAT-134] Empty additionalClasspathDir causes NPE in RunMojo.java
Submitted by John Meyer.

Modified:
    tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RunMojo.java
    tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/RunMojo.java

Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RunMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RunMojo.java?rev=1309560&r1=1309559&r2=1309560&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RunMojo.java
(original)
+++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RunMojo.java
Wed Apr  4 19:31:33 2012
@@ -23,6 +23,7 @@ import org.apache.catalina.Context;
 import org.apache.catalina.loader.WebappLoader;
 import org.apache.catalina.startup.Embedded;
 import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.tomcat.maven.common.run.ClassLoaderEntriesCalculator;
@@ -48,7 +49,7 @@ import java.util.Set;
  *
  * @author Jurgen Lust
  * @author Mark Hobson <markhobson@gmail.com>
- * @version $Id: RunMojo.java 13551 2011-02-09 16:05:47Z olamy $
+ * @version $Id$
  * @goal run
  * @execute phase="compile"
  * @requiresDependencyResolution test
@@ -204,13 +205,16 @@ public class RunMojo
             {
                 for ( String additionalClasspathDir : additionalClasspathDirs )
                 {
-                    File file = new File( additionalClasspathDir );
-                    if ( file.exists() )
-                    {
-                        String fileUri = file.toURI().toString();
-                        getLog().debug( "add file:" + fileUri + " as a additionalClasspathDir"
);
-                        loader.addRepository( fileUri );
-                    }
+                	if( StringUtils.isNotBlank(additionalClasspathDir))
+                	{
+	                    File file = new File( additionalClasspathDir );
+	                    if ( file.exists() )
+	                    {
+	                        String fileUri = file.toURI().toString();
+	                        getLog().debug( "add file:" + fileUri + " as a additionalClasspathDir"
);
+	                        loader.addRepository( fileUri );
+	                    }
+                	}
                 }
             }
         }

Modified: tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/RunMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/RunMojo.java?rev=1309560&r1=1309559&r2=1309560&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/RunMojo.java
(original)
+++ tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/RunMojo.java
Wed Apr  4 19:31:33 2012
@@ -20,6 +20,7 @@ package org.apache.tomcat.maven.plugin.t
 
 import org.apache.catalina.loader.WebappLoader;
 import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.tomcat.maven.common.run.ClassLoaderEntriesCalculator;
@@ -265,13 +266,16 @@ public class RunMojo
             {
                 for ( String additionalClasspathDir : additionalClasspathDirs )
                 {
-                    File file = new File( additionalClasspathDir );
-                    if ( file.exists() )
-                    {
-                        String fileUri = file.toURI().toString();
-                        getLog().debug( "add file:" + fileUri + " as a additionalClasspathDir"
);
-                        loader.addRepository( fileUri );
-                    }
+                	if( StringUtils.isNotBlank(additionalClasspathDir))
+                	{
+	                    File file = new File( additionalClasspathDir );
+	                    if ( file.exists() )
+	                    {
+	                        String fileUri = file.toURI().toString();
+	                        getLog().debug( "add file:" + fileUri + " as a additionalClasspathDir"
);
+	                        loader.addRepository( fileUri );
+	                    }
+                	}
                 }
             }
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message