bodewig     2004/09/30 05:41:52

  Modified:    src/main/org/apache/tools/ant/taskdefs/compilers
                        CompilerAdapterFactory.java
               src/main/org/apache/tools/ant/types/selectors/modifiedselector
                        ModifiedSelector.java
  Log:
  Don't assume class.getClassLoader is not null, PR 31450
  
  Revision  Changes    Path
  1.27      +5 -2      
ant/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java
  
  Index: CompilerAdapterFactory.java
  ===================================================================
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- CompilerAdapterFactory.java       9 Mar 2004 16:48:13 -0000       1.26
  +++ CompilerAdapterFactory.java       30 Sep 2004 12:41:52 -0000      1.27
  @@ -140,8 +140,11 @@
               return true;
           } catch (ClassNotFoundException cnfe) {
               try {
  -                
CompilerAdapterFactory.class.getClassLoader().loadClass(MODERN_COMPILER);
  -                return true;
  +                ClassLoader cl = 
CompilerAdapterFactory.class.getClassLoader();
  +                if (cl != null) {
  +                    cl.loadClass(MODERN_COMPILER);
  +                    return true;
  +                }
               } catch (ClassNotFoundException cnfe2) {
               }
           }
  
  
  
  1.10      +9 -1      
ant/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java
  
  Index: ModifiedSelector.java
  ===================================================================
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ModifiedSelector.java     13 Jul 2004 15:23:32 -0000      1.9
  +++ ModifiedSelector.java     30 Sep 2004 12:41:52 -0000      1.10
  @@ -487,7 +487,15 @@
       protected Object loadClass(String classname, String msg, Class type) {
           try {
               // load the specified class
  -            Object rv = getClassLoader().loadClass(classname).newInstance();
  +            ClassLoader cl = getClassLoader();
  +            Class clazz = null;
  +            if (cl != null) {
  +                clazz = cl.loadClass(classname);
  +            } else {
  +                clazz = Class.forName(classname);
  +            }
  +            
  +            Object rv = clazz.newInstance();
   
               if (!type.isInstance(rv)) {
                   throw new BuildException("Specified class (" + classname + 
") " + msg);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to