+++ /dev/null
-diff -Nur apache-ant-1.5.3.orig/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java apache-ant-1.5.3.chng/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java
---- apache-ant-1.5.3.orig/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java Tue Apr 8 17:24:05 2003
-+++ apache-ant-1.5.3.chng/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java Tue Jul 1 11:54:09 2003
-@@ -54,22 +54,20 @@
-
- package org.apache.tools.ant.taskdefs.optional;
-
-+import java.io.File;
-+import java.lang.reflect.Constructor;
-+import java.lang.reflect.Method;
-+import java.util.Enumeration;
-+import java.util.StringTokenizer;
-+import java.util.Vector;
- import org.apache.tools.ant.BuildException;
--
- import org.apache.tools.ant.Project;
- import org.apache.tools.ant.Task;
--
-+import org.apache.tools.ant.types.Commandline;
- import org.apache.tools.ant.types.Path;
- import org.apache.tools.ant.types.Reference;
--import org.apache.tools.ant.types.Commandline;
--
- import org.apache.tools.ant.util.JavaEnvUtils;
-
--import java.io.File;
--import java.util.Vector;
--import java.util.StringTokenizer;
--import java.util.Enumeration;
--
- /**
- * Generates JNI header files using javah.
- *
-@@ -104,8 +102,6 @@
-
- public class Javah extends Task {
-
-- private static final String FAIL_MSG = "Compile failed, messages should have been provided.";
--
- private Vector classes = new Vector(2);
- private String cls;
- private File destDir;
-@@ -175,7 +171,7 @@
- */
- public Path createClasspath() {
- if (classpath == null) {
-- classpath = new Path(project);
-+ classpath = new Path(getProject());
- }
- return classpath.createPath();
- }
-@@ -204,7 +200,7 @@
- */
- public Path createBootclasspath() {
- if (bootclasspath == null) {
-- bootclasspath = new Path(project);
-+ bootclasspath = new Path(getProject());
- }
- return bootclasspath.createPath();
- }
-@@ -285,19 +281,19 @@
- // first off, make sure that we've got a srcdir
-
- if ((cls == null) && (classes.size() == 0)) {
-- throw new BuildException("class attribute must be set!", location);
-+ throw new BuildException("class attribute must be set!", getLocation());
- }
-
- if ((cls != null) && (classes.size() > 0)) {
-- throw new BuildException("set class attribute or class element, not both.", location);
-+ throw new BuildException("set class attribute or class element, not both.", getLocation());
- }
-
- if (destDir != null) {
- if (!destDir.isDirectory()) {
-- throw new BuildException("destination directory \"" + destDir + "\" does not exist or is not a directory", location);
-+ throw new BuildException("destination directory \"" + destDir + "\" does not exist or is not a directory", getLocation());
- }
- if (outputFile != null) {
-- throw new BuildException("destdir and outputFile are mutually exclusive", location);
-+ throw new BuildException("destdir and outputFile are mutually exclusive", getLocation());
- }
- }
-
-@@ -307,7 +303,7 @@
- classpath = classpath.concatSystemClasspath("ignore");
- }
-
-- String compiler = project.getProperty("build.compiler");
-+ String compiler = getProject().getProperty("build.compiler");
- if (compiler == null) {
- if (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1) &&
- !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)) {
-@@ -341,24 +337,38 @@
- throw new BuildException("Compile failed");
- }
- */
-+
-+
- try {
-- // Javac uses logstr to change the output stream and calls
-- // the constructor's invoke method to create a compiler instance
-- // dynamically. However, javah has a different interface and this
-- // makes it harder, so here's a simple alternative.
-- //------------------------------------------------------------------
-- com.sun.tools.javah.Main main
-- = new com.sun.tools.javah.Main(cmd.getArguments());
-- main.run();
-+ Class javahMainClass = null;
-+ try {
-+ // first search for the "old" javah class in 1.4.2 tools.jar
-+ javahMainClass = Class.forName("com.sun.tools.javah.oldjavah.Main");
-+ } catch(ClassNotFoundException cnfe) {
-+ // assume older than 1.4.2 tools.jar
-+ javahMainClass = Class.forName("com.sun.tools.javah.Main");
-+ }
-+
-+ // now search for the constructor that takes in String[] arguments.
-+ Class[] strings = new Class[] {String[].class};
-+ Constructor constructor = javahMainClass.getConstructor(strings);
-+
-+ // construct the javah Main instance
-+ Object javahMain = constructor.newInstance(new Object[] {cmd.getArguments()});
-+
-+ // find the run method
-+ Method runMethod = javahMainClass.getMethod("run",new Class[0]);
-+
-+ runMethod.invoke(javahMain,new Object[0]);
- } catch (Exception ex) {
- if (ex instanceof BuildException) {
- throw (BuildException) ex;
- } else {
-- throw new BuildException("Error starting javah: " + ex, ex, location);
-+ throw new BuildException("Error starting javah: " + ex, ex, getLocation());
- }
- }
- }
--
-+
- /**
- * Does the command line argument processing common to classic and
- * modern.
-@@ -400,7 +410,7 @@
-
- if (stubs) {
- if (!old) {
-- throw new BuildException("stubs only available in old mode.", location);
-+ throw new BuildException("stubs only available in old mode.", getLocation());
- }
- cmd.createArgument().setValue("-stubs");
- }