bodewig 02/04/16 07:01:17
Modified: src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
Log:
fix nasty NPE in <junit> when the user doesn't specify a nested <classpath>.
Revision Changes Path
1.42 +14 -9
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
Index: JUnitTask.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- JUnitTask.java 15 Apr 2002 12:11:48 -0000 1.41
+++ JUnitTask.java 16 Apr 2002 14:01:17 -0000 1.42
@@ -146,7 +146,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Gerrit Riessen</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Erik Hatcher</a>
*
- * @version $Revision: 1.41 $
+ * @version $Revision: 1.42 $
*
* @since Ant 1.2
*
@@ -722,14 +722,17 @@
try {
log("Using System properties " + System.getProperties(),
Project.MSG_VERBOSE);
- Path classpath = (Path) commandline.getClasspath().clone();
- if (includeAntRuntime) {
- log("Implicitly adding " + antRuntimeClasses + " to
CLASSPATH",
- Project.MSG_VERBOSE);
- classpath.append(antRuntimeClasses);
- }
-
+ Path userClasspath = commandline.getClasspath();
+ Path classpath = userClasspath == null
+ ? null
+ : (Path) userClasspath.clone();
if (classpath != null) {
+ if (includeAntRuntime) {
+ log("Implicitly adding " + antRuntimeClasses
+ + " to CLASSPATH", Project.MSG_VERBOSE);
+ classpath.append(antRuntimeClasses);
+ }
+
cl = new AntClassLoader(null, project, classpath, false);
log("Using CLASSPATH " + cl.getClasspath(),
Project.MSG_VERBOSE);
@@ -772,7 +775,9 @@
if (sysProperties != null) {
sysProperties.restoreSystem();
}
- cl.resetThreadContextLoader();
+ if (cl != null) {
+ cl.resetThreadContextLoader();
+ }
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>