View | Details | Raw Unified | Return to bug 35234
Collapse All | Expand All

(-)apache-ant-1.6.2/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java~ (-3 / +17 lines)
Lines 26-31 Link Here
26
import org.apache.tools.ant.BuildException;
26
import org.apache.tools.ant.BuildException;
27
import org.apache.tools.ant.Project;
27
import org.apache.tools.ant.Project;
28
import org.apache.tools.ant.Task;
28
import org.apache.tools.ant.Task;
29
import org.apache.tools.ant.taskdefs.Execute;
29
import org.apache.tools.ant.types.Commandline;
30
import org.apache.tools.ant.types.Commandline;
30
import org.apache.tools.ant.types.Path;
31
import org.apache.tools.ant.types.Path;
31
import org.apache.tools.ant.types.Reference;
32
import org.apache.tools.ant.types.Reference;
Lines 307-312 Link Here
307
        */
308
        */
308
309
309
310
311
        Method runMethod = null;
312
        Object javahMain = null;
310
        try {
313
        try {
311
            Class javahMainClass = null;
314
            Class javahMainClass = null;
312
            try {
315
            try {
Lines 322-333 Link Here
322
            Constructor constructor = javahMainClass.getConstructor(strings);
325
            Constructor constructor = javahMainClass.getConstructor(strings);
323
326
324
            // construct the javah Main instance
327
            // construct the javah Main instance
325
            Object javahMain = constructor.newInstance(new Object[] {cmd.getArguments()});
328
            javahMain = constructor.newInstance(
329
                new Object[] {cmd.getArguments()});
326
330
327
            // find the run method
331
            // find the run method
328
            Method runMethod = javahMainClass.getMethod("run", new Class[0]);
332
            runMethod = javahMainClass.getMethod("run", new Class[0]);
333
        } catch (Exception ex) {
334
            // fall back to executing javah
335
        }
329
336
330
            runMethod.invoke(javahMain, new Object[0]);
337
        try {
338
            if (runMethod != null) {
339
                runMethod.invoke(javahMain, new Object[0]);
340
            }
341
            else {
342
                cmd.setExecutable(JavaEnvUtils.getJdkExecutable("javah"));
343
                Execute.runCommand(this, cmd.getCommandline());
344
            }
331
        } catch (Exception ex) {
345
        } catch (Exception ex) {
332
            if (ex instanceof BuildException) {
346
            if (ex instanceof BuildException) {
333
                throw (BuildException) ex;
347
                throw (BuildException) ex;

Return to bug 35234