bodewig 2003/01/06 06:11:53
Modified: . Tag: ANT_15_BRANCH WHATSNEW
src/main/org/apache/tools/ant/taskdefs Tag: ANT_15_BRANCH
Ant.java
Log:
Merge Costin's fix for a potential NPE in <ant> from HEAD.
Revision Changes Path
No revision
No revision
1.263.2.106 +7 -0 jakarta-ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
retrieving revision 1.263.2.105
retrieving revision 1.263.2.106
diff -u -r1.263.2.105 -r1.263.2.106
--- WHATSNEW 13 Dec 2002 12:32:42 -0000 1.263.2.105
+++ WHATSNEW 6 Jan 2003 14:11:52 -0000 1.263.2.106
@@ -44,6 +44,13 @@
* Ant didn't find the runtime libraries on IBM's JDK 1.4 for Linux.
+* Ant could incorrectly try to use the 1.4 regexp implementation even
+ if it isn't available if you run the JVM with -Xverify:none.
+
+* Ant would die with an exception if you used nested <reference>
+ elements in Ant and the refid attribute didn't point to an existing
+ project reference.
+
Other changes:
--------------
No revision
No revision
1.56.2.10 +12 -6
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java
Index: Ant.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java,v
retrieving revision 1.56.2.9
retrieving revision 1.56.2.10
diff -u -r1.56.2.9 -r1.56.2.10
--- Ant.java 25 Sep 2002 12:38:22 -0000 1.56.2.9
+++ Ant.java 6 Jan 2003 14:11:53 -0000 1.56.2.10
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -88,7 +88,7 @@
* </pre>
*
*
- * @author [EMAIL PROTECTED]
+ * @author Costin Manolache
*
* @since Ant 1.1
*
@@ -356,8 +356,6 @@
target = newProject.getDefaultTarget();
}
- addReferences();
-
// Are we trying to call the target in which we are defined?
if (newProject.getBaseDir().equals(project.getBaseDir()) &&
newProject.getProperty("ant.file").equals(project.getProperty("ant.file")) &&
@@ -368,6 +366,8 @@
+ "target");
}
+ addReferences();
+
newProject.executeTarget(target);
} finally {
// help the gc
@@ -462,6 +462,12 @@
*/
private void copyReference(String oldKey, String newKey) {
Object orig = getProject().getReference(oldKey);
+ if (orig == null) {
+ log("No object referenced by " + oldKey + ". Can't copy to "
+ + newKey,
+ Project.MSG_WARN);
+ return;
+ }
Class c = orig.getClass();
Object copy = orig;
try {
@@ -588,8 +594,8 @@
*
* @return the id of the reference in the new project.
*/
- public String getToRefid() {
- return targetid;
+ public String getToRefid() {
+ return targetid;
}
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>