You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2001/07/05 14:27:49 UTC

cvs commit: jakarta-ant/src/main/org/apache/tools/zip ZipExtraField.java

bodewig     01/07/05 05:27:48

  Modified:    src/main/org/apache/tools/ant/taskdefs Definer.java
               src/main/org/apache/tools/ant/types Path.java
               src/main/org/apache/tools/zip ZipExtraField.java
  Log:
  Work around a feature of the system classloader in some VMs - it
  drops all classpath entries that are not present at VM start time.
  
  PR: 2412
  
  Revision  Changes    Path
  1.2       +10 -15    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Definer.java
  
  Index: Definer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Definer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Definer.java	2001/06/07 11:42:08	1.1
  +++ Definer.java	2001/07/05 12:27:40	1.2
  @@ -97,25 +97,20 @@
           }
           try {
               ClassLoader loader = null;
  +            AntClassLoader al = null;
               if (classpath != null) {
  -                AntClassLoader al = new AntClassLoader(project, classpath,
  -                                                       false);
  -                // need to load Task via system classloader or the new
  -                // task we want to define will never be a Task but always
  -                // be wrapped into a TaskAdapter.
  -                al.addSystemPackageRoot("org.apache.tools.ant");
  -                loader = al;
  +                al = new AntClassLoader(project, classpath, false);
               } else {
  -                loader = this.getClass().getClassLoader();
  +                al = new AntClassLoader(project, Path.systemClasspath, false);
               }
  +            // need to load Task via system classloader or the new
  +            // task we want to define will never be a Task but always
  +            // be wrapped into a TaskAdapter.
  +            al.addSystemPackageRoot("org.apache.tools.ant");
  +            loader = al;
   
  -            Class c = null;
  -            if (loader != null) {
  -                c = loader.loadClass(value);
  -                AntClassLoader.initializeClass(c);
  -            } else {
  -                c = Class.forName(value);
  -            }
  +            Class c = loader.loadClass(value);
  +            AntClassLoader.initializeClass(c);
               addDefinition(name, c);
           } catch (ClassNotFoundException cnfe) {
               String msg = getTaskName()+" class " + value +
  
  
  
  1.17      +8 -3      jakarta-ant/src/main/org/apache/tools/ant/types/Path.java
  
  Index: Path.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/Path.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Path.java	2001/05/23 16:58:15	1.16
  +++ Path.java	2001/07/05 12:27:43	1.17
  @@ -484,9 +484,14 @@
   
           Path result = new Path(project);
   
  -        String order = project.getProperty("build.sysclasspath");
  -        if (order == null) order=defValue;
  -
  +        String order = defValue;
  +        if (project != null) {
  +            String o = project.getProperty("build.sysclasspath");
  +            if (o != null) {
  +                order = o;
  +            }
  +        }
  +        
           if (order.equals("only")) {
               // only: the developer knows what (s)he is doing
               result.addExisting(Path.systemClasspath);
  
  
  
  1.2       +3 -3      jakarta-ant/src/main/org/apache/tools/zip/ZipExtraField.java
  
  Index: ZipExtraField.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/zip/ZipExtraField.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ZipExtraField.java	2001/04/23 16:12:21	1.1
  +++ ZipExtraField.java	2001/07/05 12:27:46	1.2
  @@ -59,14 +59,14 @@
   /**
    * General format of extra field data.
    *
  - * <p>Extra fields usually apper twice per file, once in the local
  + * <p>Extra fields usually appear twice per file, once in the local
    * file data and once in the central directory.  Usually they are the
    * same, but they don't have to be.  {@link
    * java.util.zip.ZipOutputStream java.util.zip.ZipOutputStream} will
  - * only use write the local file data at both places.</p>
  + * only use the local file data in both places.</p>
    *
    * @author <a href="stefan.bodewig@epost.de">Stefan Bodewig</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public interface ZipExtraField {