From b3a0cca7caed8bb8ca0c267aad7e60cae78eaa37 Mon Sep 17 00:00:00 2001 From: Costin Manolache Date: Mon, 5 May 2003 13:59:24 +0000 Subject: [PATCH] Last part of component helper merge ( including the fix contains -> containsKey for the test case ) PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274550 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/ant/ComponentHelper.java | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/main/org/apache/tools/ant/ComponentHelper.java b/src/main/org/apache/tools/ant/ComponentHelper.java index ebd04de01..05ec724e9 100644 --- a/src/main/org/apache/tools/ant/ComponentHelper.java +++ b/src/main/org/apache/tools/ant/ComponentHelper.java @@ -597,26 +597,33 @@ public class ComponentHelper { } 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 @@ public class ComponentHelper { 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 @@ public class ComponentHelper { return taskClass; } - public boolean contains( Object key ) { + public boolean containsKey( Object key ) { return get( key ) != null; }