costin      2003/05/05 06:59:24

  Modified:    src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  Last part of component helper merge ( including the fix contains -> 
containsKey for the test case )
  
  Revision  Changes    Path
  1.9       +16 -7     ant/src/main/org/apache/tools/ant/ComponentHelper.java
  
  Index: ComponentHelper.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/ComponentHelper.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ComponentHelper.java      5 May 2003 02:17:28 -0000       1.8
  +++ ComponentHelper.java      5 May 2003 13:59:24 -0000       1.9
  @@ -597,26 +597,33 @@
           }
   
           protected void initAll( ) {
  -            if( initAllDone ) return;
  +            if( initAllDone ) {
  +                return;
  +            }
               project.log("InitAll", Project.MSG_DEBUG);
  -            if( props==null ) return;
  +            if( props==null ) {
  +                return;
  +            }
               Enumeration enum = props.propertyNames();
               while (enum.hasMoreElements()) {
                   String key = (String) enum.nextElement();
                   Class taskClass=getTask( key );
                   if( taskClass!=null ) {
                       // This will call a get() and a put()
  -                    if( tasks )
  +                    if( tasks ) {
                           project.addTaskDefinition(key, taskClass);
  -                    else
  +                    } else {
                           project.addDataTypeDefinition(key, taskClass );
  +                    }
                   }
               }
               initAllDone=true;
           }
   
           protected Class getTask(String key) {
  -            if( props==null ) return null; // for tasks loaded before init()
  +            if( props==null ) {
  +                return null; // for tasks loaded before init()
  +            }
               String value=props.getProperty(key);
               if( value==null) {
                   //project.log( "No class name for " + key, 
Project.MSG_VERBOSE );
  @@ -634,13 +641,15 @@
                               return taskClass;
                           }
                       } catch( Exception ex ) {
  +                        //ignore
                       }
                   }
                   taskClass = Class.forName(value);
                   return taskClass;
               } catch (NoClassDefFoundError ncdfe) {
                   project.log("Could not load a dependent class ("
  -                        + ncdfe.getMessage() + ") for task " + key, 
Project.MSG_DEBUG);
  +                        + ncdfe.getMessage() + ") for task " 
  +                        + key, Project.MSG_DEBUG);
               } catch (ClassNotFoundException cnfe) {
                   project.log("Could not load class (" + value
                           + ") for task " + key, Project.MSG_DEBUG);
  @@ -665,7 +674,7 @@
               return taskClass;
           }
   
  -        public boolean contains( Object key ) {
  +        public boolean containsKey( Object key ) {
               return get( key ) != null;
           }
   
  
  
  

Reply via email to