ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r418146 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
Date Thu, 29 Jun 2006 21:57:15 GMT
Author: mbenson
Date: Thu Jun 29 14:57:15 2006
New Revision: 418146

URL: http://svn.apache.org/viewvc?rev=418146&view=rev
Log:
If the class invoked by the <java> task threw a ClassNotFoundException,
this was misinterpreted as the specified class itself not being found.

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=418146&r1=418145&r2=418146&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Thu Jun 29 14:57:15 2006
@@ -235,6 +235,9 @@
 * <scp> can now handle uris with @s other than the final one denoting the
   domain.  Bugzilla 38082.
 
+* If the class invoked by the <java> task threw a ClassNotFoundException,
+  this was misinterpreted as the specified class itself not being found.
+
 Other changes:
 --------------
 * took in bugzilla report 39320.

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java?rev=418146&r1=418145&r2=418146&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java Thu Jun 29 14:57:15
2006
@@ -1,5 +1,5 @@
 /*
- * Copyright  2000-2006 The Apache Software Foundation
+ * Copyright 2000-2006 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -120,17 +120,23 @@
                 sysProperties.setSystem();
             }
             Class target = null;
-            if (classpath == null) {
-                target = Class.forName(classname);
-            } else {
-                loader = project.createClassLoader(classpath);
-                loader.setParent(project.getCoreLoader());
-                loader.setParentFirst(false);
-                loader.addJavaLibraries();
-                loader.setIsolated(true);
-                loader.setThreadContextLoader();
-                loader.forceLoadClass(classname);
-                target = Class.forName(classname, true, loader);
+            try {
+                if (classpath == null) {
+                    target = Class.forName(classname);
+                } else {
+                    loader = project.createClassLoader(classpath);
+                    loader.setParent(project.getCoreLoader());
+                    loader.setParentFirst(false);
+                    loader.addJavaLibraries();
+                    loader.setIsolated(true);
+                    loader.setThreadContextLoader();
+                    loader.forceLoadClass(classname);
+                    target = Class.forName(classname, true, loader);
+                }
+            } catch (ClassNotFoundException e) {
+                throw new BuildException("Could not find " + classname + "."
+                                         + " Make sure you have it in your"
+                                         + " classpath");
             }
             main = target.getMethod("main", new Class[] {String[].class});
             if (main == null) {
@@ -176,10 +182,6 @@
             if (caught != null) {
                 throw caught;
             }
-        } catch (ClassNotFoundException e) {
-            throw new BuildException("Could not find " + classname + "."
-                                     + " Make sure you have it in your"
-                                     + " classpath");
         } catch (BuildException e) {
             throw e;
         } catch (SecurityException e) {



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


Mime
View raw message