ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Taskdef.java
Date Tue, 26 Sep 2000 11:05:46 GMT
bodewig     00/09/26 04:05:46

  Modified:    src/main/org/apache/tools/ant AntClassLoader.java
                        Project.java
               src/main/org/apache/tools/ant/taskdefs Taskdef.java
  Log:
  Loading tasks from a ClassLoader other than the default one now works
  on JDK 1.1 as well.
  
  Added org.apache.tools.ant to the list of packages that need to be
  loaded via the system class loader as the loaded class wouldn't be an
  instance of Task (loaded by default loader) otherwise.
  
  Revision  Changes    Path
  1.6       +2 -2      jakarta-ant/src/main/org/apache/tools/ant/AntClassLoader.java
  
  Index: AntClassLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/AntClassLoader.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AntClassLoader.java	2000/08/14 11:14:05	1.5
  +++ AntClassLoader.java	2000/09/26 11:05:43	1.6
  @@ -115,7 +115,7 @@
       /**
        * Create a classloader for the given project using the classpath given.
        *
  -     * @param project the project to ehich this classloader is to belong.
  +     * @param project the project to which this classloader is to belong.
        * @param classpath the classpath to use to load the classes.
        */
       public AntClassLoader(Project project, Path classpath, boolean systemFirst) {
  @@ -129,7 +129,7 @@
        *
        * All subpackages are also included.
        *
  -     * @param packageRoot the root of akll packages to be included.
  +     * @param packageRoot the root of all packages to be included.
        */
       public void addSystemPackageRoot(String packageRoot) {
           systemPackages.addElement(packageRoot + ".");
  
  
  
  1.42      +3 -3      jakarta-ant/src/main/org/apache/tools/ant/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- Project.java	2000/09/19 09:09:23	1.41
  +++ Project.java	2000/09/26 11:05:43	1.42
  @@ -452,10 +452,10 @@
               String msg = "   +Task: " + taskType;
               log (msg, MSG_DEBUG);
               return task;
  -        } catch (Exception e) {
  +        } catch (Throwable t) {
               String msg = "Could not create task of type: "
  -                 + taskType + " due to " + e;
  -            throw new BuildException(msg);
  +                 + taskType + " due to " + t;
  +            throw new BuildException(msg, t);
           }
       }
   
  
  
  
  1.10      +13 -2     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Taskdef.java
  
  Index: Taskdef.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Taskdef.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Taskdef.java	2000/09/18 14:04:57	1.9
  +++ Taskdef.java	2000/09/26 11:05:46	1.10
  @@ -95,7 +95,14 @@
   	    try {
                   ClassLoader loader = null;
                   if (classpath != null) {
  -                    loader = new AntClassLoader(project, classpath, false);
  +                    AntClassLoader al = new AntClassLoader(project, classpath,
  +                                                           false);
  +                    al.addSystemPackageRoot("org.apache.tools.ant");
  +                    if (project.getJavaVersion().startsWith("1.1")) {
  +                        // JDK > 1.1 adds these by default
  +                        al.addSystemPackageRoot("java");
  +                    }
  +                    loader = al;
                   } else {
                       loader = this.getClass().getClassLoader();
                   }
  @@ -110,7 +117,11 @@
   	    } catch (ClassNotFoundException cnfe) {
   		String msg = "taskdef class " + value +
   		    " cannot be found";
  -		throw new BuildException(msg, location);
  +		throw new BuildException(msg, cnfe, location);
  +	    } catch (NoClassDefFoundError ncdfe) {
  +		String msg = "taskdef class " + value +
  +		    " cannot be found";
  +		throw new BuildException(msg, ncdfe, location);
   	    }
       }
       
  
  
  

Mime
View raw message