cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-08-23 Thread stevel
stevel  2005/08/23 02:43:07

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  extra javadocs, as requested by JHM
  
  Revision  ChangesPath
  1.62  +24 -0 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.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- ComponentHelper.java  22 Aug 2005 23:02:52 -  1.61
  +++ ComponentHelper.java  23 Aug 2005 09:43:07 -  1.62
  @@ -87,16 +87,40 @@
*/
   private Hashtable createdTasks = new Hashtable();
   
  +/**
  + * this does not appear to be used anywhere in the Ant codebase
  + * even via its accessors
  + */
   private ComponentHelper next;
  +
  +/**
  + * Project that owns a component helper
  + */
   private Project project;
  +
  +/**
  + * Error string when the file taskdefs/defaults.properties cannot be 
found
  + */
   private static final String ERROR_NO_TASK_LIST_LOAD = "Can't load 
default task list";
  +/**
  + * Error string when the typedefs/defaults.properties cannot be found
  + */
   private static final String ERROR_NO_TYPE_LIST_LOAD = "Can't load 
default type list";
  +
  +/**
  + * reference under which we register ourselves with a project [EMAIL 
PROTECTED]
  + */
   public static final String COMPONENT_HELPER_REFERENCE = 
"ant.ComponentHelper";
   
   /**
* string used to control build.syspath policy [EMAIL PROTECTED]
*/
   private static final String BUILD_SYSCLASSPATH_ONLY = "only";
  +
  +/**
  + * special name of ant's property task [EMAIL PROTECTED] There is some
  + * contrived work here to enable this early.
  + */
   private static final String ANT_PROPERTY_TASK = "property";
   
   /**
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java Diagnostics.java

2005-06-06 Thread jkf
jkf 2005/06/06 12:45:32

  Modified:src/main/org/apache/tools/ant/launch Launcher.java
   src/main/org/apache/tools/ant ComponentHelper.java
Diagnostics.java
  Log:
  PR: 35246
  As suggested by Darin Swanson.
  (use USER_LIBDIR, and use File.separatorChar in there)
  
  Revision  ChangesPath
  1.31  +3 -3  ant/src/main/org/apache/tools/ant/launch/Launcher.java
  
  Index: Launcher.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/launch/Launcher.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- Launcher.java 20 May 2005 16:44:56 -  1.30
  +++ Launcher.java 6 Jun 2005 19:45:32 -   1.31
  @@ -50,7 +50,8 @@
   public static final String ANT_PRIVATELIB = "lib";
   
   /** The location of a per-user library directory */
  -public static final String USER_LIBDIR = ANT_PRIVATEDIR + "/" + 
ANT_PRIVATELIB;
  +public static final String USER_LIBDIR = 
  +ANT_PRIVATEDIR + File.separatorChar + ANT_PRIVATELIB;
   
   /** The startup class that is to be run */
   public static final String MAIN_CLASS = "org.apache.tools.ant.Main";
  @@ -206,8 +207,7 @@
   URL[] systemJars = Locator.getLocationURLs(antLibDir);
   
   File userLibDir
  -= new File(System.getProperty(USER_HOMEDIR),
  -ANT_PRIVATEDIR + File.separatorChar + ANT_PRIVATELIB);
  += new File(System.getProperty(USER_HOMEDIR), USER_LIBDIR);
   
   URL[] userJars = noUserLib ? new URL[0] : 
Locator.getLocationURLs(userLibDir);
   
  
  
  
  1.57  +1 -4  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.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- ComponentHelper.java  26 May 2005 18:54:25 -  1.56
  +++ ComponentHelper.java  6 Jun 2005 19:45:32 -   1.57
  @@ -802,10 +802,7 @@
   boolean definitions = false;
   boolean antTask;
   String home = System.getProperty(Launcher.USER_HOMEDIR);
  -File libDir = new File(home,
  -Launcher.ANT_PRIVATEDIR +
  -File.separator +
  -Launcher.ANT_PRIVATELIB);
  +File libDir = new File(home, Launcher.USER_LIBDIR);
   //look up the name
   AntTypeDefinition def = getDefinition(componentName);
   if (def == null) {
  
  
  
  1.29  +1 -2  ant/src/main/org/apache/tools/ant/Diagnostics.java
  
  Index: Diagnostics.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/Diagnostics.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- Diagnostics.java  22 May 2005 16:13:54 -  1.28
  +++ Diagnostics.java  6 Jun 2005 19:45:32 -   1.29
  @@ -285,8 +285,7 @@
   private static void doReportUserHomeLibraries(PrintStream out) {
   String home = System.getProperty(Launcher.USER_HOMEDIR);
   out.println("user.home: " + home);
  -File libDir = new File(home,
  -Launcher.ANT_PRIVATEDIR + File.separator + 
Launcher.ANT_PRIVATELIB);
  +File libDir = new File(home, Launcher.USER_LIBDIR);
   File[] libs = listJarFiles(libDir);
   printLibraries(libs, out);
   }
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-05-26 Thread mbenson
mbenson 2005/05/26 11:54:25

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  Consistency and some spaces
  
  Revision  ChangesPath
  1.56  +19 -19ant/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.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- ComponentHelper.java  23 May 2005 19:27:30 -  1.55
  +++ ComponentHelper.java  26 May 2005 18:54:25 -  1.56
  @@ -810,15 +810,15 @@
   AntTypeDefinition def = getDefinition(componentName);
   if (def == null) {
   //not a known type
  -boolean isAntlib=componentName.indexOf(ANTLIB_PREFIX)==0;
  +boolean isAntlib = componentName.indexOf(ANTLIB_PREFIX) == 0;
   out.println("Cause: The name is undefined.");
   out.println("Action: Check the spelling.");
  -out.println("Action: Check that any custom tasks/types have been 
declared");
  -out.println("Action: Check that any / 
declarations have taken place");
  -if(isAntlib) {
  +out.println("Action: Check that any custom tasks/types have been 
declared.");
  +out.println("Action: Check that any / 
declarations have taken place.");
  +if (isAntlib) {
   out.println();
   out.println("This appears to be an antlib declaration. ");
  -out.println("Action: check that the implementing library 
exists "
  +out.println("Action: Check that the implementing library 
exists "
   + "in ANT_HOME/lib or in ");
   out.println("" + libDir);
   }
  @@ -838,13 +838,13 @@
   out.println("Cause: the class " + classname + " was not 
found.");
   jars = true;
   if (optional) {
  -out.println("This looks like one of Ant's 
optional components");
  -out.println("Action: check that the appropriate optional 
JAR exists "
  +out.println("This looks like one of Ant's 
optional components.");
  +out.println("Action: Check that the appropriate optional 
JAR exists "
   + "in ANT_HOME/lib or in ");
   out.println("" + libDir);
   } else {
  -out.println("Action: check that the component has been 
correctly declared");
  -out.println("And that the implementing JAR is in 
ANT_HOME/lib or in");
  +out.println("Action: Check that the component has been 
correctly declared");
  +out.println("and that the implementing JAR is in 
ANT_HOME/lib or in");
   out.println("" + libDir);
   definitions = true;
   }
  @@ -852,15 +852,15 @@
   jars = true;
   out.println("Cause: Could not load a dependent class "
   +  ncdfe.getMessage());
  -if(optional) {
  +if (optional) {
   out.println("   It is not enough to have Ant's 
optional JAR, you need the JAR");
   out.println("   files that it depends upon.");
   out.println("Ant's optional task dependencies are listed 
in the manual.");
   } else {
  -out.println("   This class may be in a separate JAR, 
that is not installed.");
  +out.println("   This class may be in a separate JAR 
that is not installed.");
   }
  -out.println("Action: determine what extra JAR files are 
needed, and place them");
  -out.println("In ANT_HOME/lib or");
  +out.println("Action: Determine what extra JAR files are 
needed, and place them");
  +out.println("in ANT_HOME/lib or");
   out.println("in " + libDir );
   }
   //here we successfully loaded the class or failed.
  @@ -893,16 +893,16 @@
   jars = true;
   out.println("Cause:  A class needed by class "
   + classname + " cannot be found: ");
  -out.println("   "+ ncdfe.getMessage());
  -out.println("Action: determine what extra JAR files are 
needed, and place them");
  -out.println("In ANT_HOME/lib or");
  +out.println("   " + ncdfe.getMessage());
  +out.println("Action: Determine what extra JAR files are 
needed, and place t

cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-05-23 Thread mbenson
mbenson 2005/05/23 12:27:30

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  add brief version of getElementName()
  
  Revision  ChangesPath
  1.55  +24 -6 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.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- ComponentHelper.java  16 May 2005 12:11:44 -  1.54
  +++ ComponentHelper.java  23 May 2005 19:27:30 -  1.55
  @@ -555,24 +555,42 @@
* @since Ant 1.6
*/
   public String getElementName(Object element) {
  +return getElementName(element, false);
  +}
  +
  +/**
  + * Returns a description of the type of the given element.
  + * 
  + * This is useful for logging purposes.
  + *
  + * @param element The element to describe.
  + *Must not be null.
  + * @param brief   whether to use a brief description.
  + * @return a description of the element type.
  + *
  + * @since Ant 1.7
  + */
  +public String getElementName(Object element, boolean brief) {
   //  PR: I do not know what to do if the object class
   //  has multiple defines
   //  but this is for logging only...
  +String name = null;
   Class elementClass = element.getClass();
   for (Iterator i = antTypeTable.values().iterator(); i.hasNext();) {
   AntTypeDefinition def = (AntTypeDefinition) i.next();
   if (elementClass == def.getExposedClass(project)) {
  -return "The <" + def.getName() + "> type";
  +name = def.getName();
  +return brief ? name : "The <" + name + "> type";
   }
   }
  -return "Class " + elementClass.getName();
  +name = elementClass.getName();
  +return brief
  +? name.substring(name.lastIndexOf('.') + 1) : "Class " + name;
   }
   
  -
   /**
  - * Check if definition is a valid definition - it
  - * may be a definition of an optional task that
  - * does not exist.
  + * Check if definition is a valid definition--it may be a
  + * definition of an optional task that does not exist.
* @param def the definition to test.
* @return true if exposed type of definition is present.
*/
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-05-16 Thread stevel
stevel  2005/05/16 05:11:44

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  merged antlib: strings to a single (currently private) constant.
  
  Revision  ChangesPath
  1.54  +3 -2  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.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- ComponentHelper.java  5 May 2005 15:57:19 -   1.53
  +++ ComponentHelper.java  16 May 2005 12:11:44 -  1.54
  @@ -91,6 +91,7 @@
   private static final String ERROR_NO_TASK_LIST_LOAD = "Can't load 
default task list";
   private static final String ERROR_NO_TYPE_LIST_LOAD = "Can't load 
default type list";
   public static final String COMPONENT_HELPER_REFERENCE = 
"ant.ComponentHelper";
  +private static final String ANTLIB_PREFIX = "antlib:";
   
   /**
* Find a project component for a specific project, creating
  @@ -759,7 +760,7 @@
   definer.setProject(project);
   definer.setURI(uri);
   definer.setResource(
  -uri.substring("antlib:".length()).replace('.', '/')
  +uri.substring(ANTLIB_PREFIX.length()).replace('.', '/')
   + "/antlib.xml");
   // a fishing expedition :- ignore errors if antlib not present
   definer.setOnError(new Typedef.OnError("ignore"));
  @@ -791,7 +792,7 @@
   AntTypeDefinition def = getDefinition(componentName);
   if (def == null) {
   //not a known type
  -boolean isAntlib=componentName.indexOf("antlib:")==0;
  +boolean isAntlib=componentName.indexOf(ANTLIB_PREFIX)==0;
   out.println("Cause: The name is undefined.");
   out.println("Action: Check the spelling.");
   out.println("Action: Check that any custom tasks/types have been 
declared");
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-03-03 Thread jkf
jkf 2005/03/03 06:04:27

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  reduced visibility of the members not defined in super class of a private 
inner class
  removed unnecessary casts
  
  Revision  ChangesPath
  1.52  +7 -10 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.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- ComponentHelper.java  1 Mar 2005 17:17:39 -   1.51
  +++ ComponentHelper.java  3 Mar 2005 14:04:27 -   1.52
  @@ -325,8 +325,7 @@
   for (Iterator i = antTypeTable.keySet().iterator();
i.hasNext();) {
   String name = (String) i.next();
  -Class clazz =
  -(Class) antTypeTable.getExposedClass(name);
  +Class clazz = antTypeTable.getExposedClass(name);
   if (clazz == null) {
   continue;
   }
  @@ -358,8 +357,7 @@
   for (Iterator i = antTypeTable.keySet().iterator();
i.hasNext();) {
   String name = (String) i.next();
  -Class clazz =
  -(Class) antTypeTable.getExposedClass(name);
  +Class clazz = antTypeTable.getExposedClass(name);
   if (clazz == null) {
   continue;
   }
  @@ -911,30 +909,29 @@
   private static class AntTypeTable extends Hashtable {
   private Project project;
   
  -public AntTypeTable(Project project) {
  +AntTypeTable(Project project) {
   this.project = project;
   }
   
  -public AntTypeDefinition getDefinition(String key) {
  +AntTypeDefinition getDefinition(String key) {
   return (AntTypeDefinition) (super.get(key));
   }
   
  -/** Equivalent to getTypeType */
   public Object get(Object key) {
   return getTypeClass((String) key);
   }
   
  -public Object create(String name) {
  +Object create(String name) {
   AntTypeDefinition def = getDefinition(name);
   return (def == null) ? null : def.create(project);
   }
   
  -public Class getTypeClass(String name) {
  +Class getTypeClass(String name) {
   AntTypeDefinition def = getDefinition(name);
   return (def == null) ? null : def.getTypeClass(project);
   }
   
  -public Class getExposedClass(String name) {
  +Class getExposedClass(String name) {
   AntTypeDefinition def = getDefinition(name);
   return (def == null) ? null : def.getExposedClass(project);
   }
  
  
  

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



Re: cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-03-01 Thread Steve Loughran
[EMAIL PROTECTED] wrote:
mbenson 2005/03/01 08:23:41
  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  Some space/punctuation cleanup.  Like it, Steve.
I got fed up with seeing the message myself. Plus I even got a support 
phone call on the problem last week, which really irritated me. The 
message was too long and not accurate enough to be meaningful.

Now, to keep test coverage up, we do have to test all of this :)
-steve
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-03-01 Thread Steve Loughran
Matt Benson wrote:
 //hey, there is nothing
wrong with us
-out.println("The component
could be instantiated");
+out.println("The component
could not be instantiated.");

changes the meaning..

Sorry, didn't occur to me that a success message would
appear here.  ;)  I'll fix it.
It shouldnt, 'cept under testing. as otherwise it only gets called when 
we get a failure.

There is a small chance that something failed one time round and worked 
the next. But you have to implement something in the constructor that 
did that deliberately.


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


cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-03-01 Thread mbenson
mbenson 2005/03/01 09:17:39

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  Clean up spacing, remove erroneously inserted "not".
  
  Revision  ChangesPath
  1.51  +17 -16ant/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.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- ComponentHelper.java  1 Mar 2005 16:23:41 -   1.50
  +++ ComponentHelper.java  1 Mar 2005 17:17:39 -   1.51
  @@ -770,29 +770,30 @@
   }
   
   /**
  - * Handler called to do decent diagnosis on instantiation failure
  - * @param componentName
  + * Handler called to do decent diagnosis on instantiation failure.
  + * @param componentName component name.
  + * @param type component type.
* @return a string containing as much diagnostics info as possible.
*/
  -public String diagnoseCreationFailure(String componentName,String type) {
  -StringWriter errorText=new StringWriter();
  -PrintWriter out=new PrintWriter(errorText);
  -out.println("Problem: failed to create "+ type +" "+componentName);
  +public String diagnoseCreationFailure(String componentName, String type) 
{
  +StringWriter errorText = new StringWriter();
  +PrintWriter out = new PrintWriter(errorText);
  +out.println("Problem: failed to create " + type + " " + 
componentName);
   //class of problem
  -boolean lowlevel=false;
  -boolean jars=false;
  -boolean definitions=false;
  +boolean lowlevel = false;
  +boolean jars = false;
  +boolean definitions = false;
   boolean antTask;
   //look up the name
   AntTypeDefinition def = getDefinition(componentName);
  -if(def==null) {
  +if (def == null) {
   //not a known type
   out.println("Cause: The name is undefined.");
   out.println("Action: Check the spelling.");
   out.println("Action: Check that any custom tasks/types have been 
declared");
   out.println("Action: Check that any / 
declarations have taken place");
  -definitions=true;
  -} else{
  +definitions = true;
  +} else {
   //we are defined, so it is an instantiation problem
   final String classname = def.getClassName();
   antTask = classname.startsWith("org.apache.tools.ant.");
  @@ -805,7 +806,7 @@
   Launcher.ANT_PRIVATELIB);
   
   //start with instantiating the class.
  -Class clazz= null;
  +Class clazz = null;
   try {
   clazz = def.innerGetTypeClass();
   } catch (ClassNotFoundException e) {
  @@ -838,12 +839,12 @@
   out.println("in " + libDir );
   }
   //here we successfully loaded the class or failed.
  -if(clazz!=null) {
  +if (clazz != null) {
   //success: proceed with more steps
   try {
  -def.innerCreateAndSet(clazz,project);
  +def.innerCreateAndSet(clazz, project);
   //hey, there is nothing wrong with us
  -out.println("The component could not be instantiated.");
  +out.println("The component could be instantiated.");
   } catch (NoSuchMethodException e) {
   lowlevel = true;
   out.println("Cause: The class " + classname
  
  
  

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



Re: cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-03-01 Thread Matt Benson
--- Peter Reilly <[EMAIL PROTECTED]> wrote:

> [EMAIL PROTECTED] wrote:
> 
> >mbenson 2005/03/01 08:23:41
> >
> >  Modified:src/main/org/apache/tools/ant
> ComponentHelper.java
> >  Log:
> >  Some space/punctuation cleanup.  Like it, Steve.
> >  
> > 
> >
> snip
> 
> >   //hey, there is nothing
> wrong with us
> >  -out.println("The component
> could be instantiated");
> >  +out.println("The component
> could not be instantiated.");
> >  
> >
> changes the meaning..

Sorry, didn't occur to me that a success message would
appear here.  ;)  I'll fix it.

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


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-03-01 Thread Peter Reilly
[EMAIL PROTECTED] wrote:
mbenson 2005/03/01 08:23:41
 Modified:src/main/org/apache/tools/ant ComponentHelper.java
 Log:
 Some space/punctuation cleanup.  Like it, Steve.
 


snip
  //hey, there is nothing wrong with us
 -out.println("The component could be instantiated");
 +out.println("The component could not be instantiated.");
 

changes the meaning..
Peter
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-03-01 Thread mbenson
mbenson 2005/03/01 08:23:41

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  Some space/punctuation cleanup.  Like it, Steve.
  
  Revision  ChangesPath
  1.50  +19 -24ant/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.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- ComponentHelper.java  1 Mar 2005 14:55:46 -   1.49
  +++ ComponentHelper.java  1 Mar 2005 16:23:41 -   1.50
  @@ -809,9 +809,7 @@
   try {
   clazz = def.innerGetTypeClass();
   } catch (ClassNotFoundException e) {
  -out.println("Cause: the class " +
  -classname
  -+ " was not found");
  +out.println("Cause: the class " + classname + " was not 
found.");
   jars = true;
   if (optional) {
   out.println("This looks like one of Ant's 
optional components");
  @@ -830,8 +828,8 @@
   +  ncdfe.getMessage());
   if(optional) {
   out.println("   It is not enough to have Ant's 
optional JAR, you need the JAR");
  -out.println("   files that it depends upon");
  -out.println("Ant's optional task dependencies are listed 
in the manual");
  +out.println("   files that it depends upon.");
  +out.println("Ant's optional task dependencies are listed 
in the manual.");
   } else {
   out.println("   This class may be in a separate JAR, 
that is not installed.");
   }
  @@ -845,26 +843,24 @@
   try {
   def.innerCreateAndSet(clazz,project);
   //hey, there is nothing wrong with us
  -out.println("The component could be instantiated");
  +out.println("The component could not be instantiated.");
   } catch (NoSuchMethodException e) {
   lowlevel = true;
   out.println("Cause: The class " + classname
  -+ " has no compatible constructor");
  ++ " has no compatible constructor.");
   
   } catch (InstantiationException e) {
   lowlevel = true;
  -out.println("Cause: The class " +
  -classname
  -+ " is abstract and cannot be instantiated");
  +out.println("Cause: The class " + classname
  ++ " is abstract and cannot be instantiated.");
   } catch (IllegalAccessException e) {
   lowlevel = true;
  -out.println("Cause: The constructor for " +
  -classname
  -+ " is private and cannot be invoked");
  +out.println("Cause: The constructor for " + classname
  ++ " is private and cannot be invoked.");
   } catch (InvocationTargetException ex) {
   lowlevel = true;
   Throwable t = ex.getTargetException();
  -out.println("Cause: The constructor threw the exception 
");
  +out.println("Cause: The constructor threw the 
exception");
   out.println(t.toString());
   t.printStackTrace(out);
   }  catch (NoClassDefFoundError ncdfe) {
  @@ -881,28 +877,27 @@
   out.println("Do not panic, this is a common problem.");
   if(definitions) {
   out.println("It may just be a typing error in the build file 
" +
  -"or the task/type declaration");
  +"or the task/type declaration.");
   }
   if (jars) {
  -out.println("The commonest cause is a missing JAR. ");
  +out.println("The commonest cause is a missing JAR.");
   }
   if (lowlevel) {
  -out.println("This is quite a low level problem, which may 
need" +
  -"consultation with the author of the task");
  +out.println("This is quite a low level problem, which may 
need " +
  +"consultation with the author of the task.");
   if(antTask) {
   out.println("This may be the Ant team. Please file a " +
  -"defect or contact the developer team");
  +"defect or contact the 

Re: cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-01-28 Thread Antoine Levy-Lambert
[EMAIL PROTECTED] wrote:
mbenson 2005/01/28 08:01:07
 Modified:src/main/org/apache/tools/ant ComponentHelper.java
 Log:
 Who'd have guessed that:
  boolean xor not boolean
 is equivalent to:
  boolean == boolean?
 
 Added a comment as well so Peter will be my friend again!
 
 

I understand better the new code too.
Cheers,
Antoine
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-01-28 Thread mbenson
mbenson 2005/01/28 08:02:02

  Modified:src/main/org/apache/tools/ant Tag: ANT_16_BRANCH
ComponentHelper.java
  Log:
  Merge
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.28.2.10 +2 -1  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.28.2.9
  retrieving revision 1.28.2.10
  diff -u -r1.28.2.9 -r1.28.2.10
  --- ComponentHelper.java  27 Jan 2005 21:54:46 -  1.28.2.9
  +++ ComponentHelper.java  28 Jan 2005 16:02:02 -  1.28.2.10
  @@ -583,7 +583,8 @@
   private boolean sameDefinition(
   AntTypeDefinition def, AntTypeDefinition old) {
   boolean defValid = validDefinition(def);
  -boolean sameValidity = defValid ^ !validDefinition(old);
  +boolean sameValidity = (defValid == validDefinition(old));
  +//must have same validity; then if they are valid they must also be 
the same:
   return sameValidity && (!defValid || def.sameDefinition(old, 
project));
   }
   
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-01-28 Thread mbenson
mbenson 2005/01/28 08:01:07

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  Who'd have guessed that:
   boolean xor not boolean
  is equivalent to:
   boolean == boolean?
  
  Added a comment as well so Peter will be my friend again!
  
  Revision  ChangesPath
  1.48  +2 -1  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.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- ComponentHelper.java  27 Jan 2005 21:53:27 -  1.47
  +++ ComponentHelper.java  28 Jan 2005 16:01:07 -  1.48
  @@ -583,7 +583,8 @@
   private boolean sameDefinition(
   AntTypeDefinition def, AntTypeDefinition old) {
   boolean defValid = validDefinition(def);
  -boolean sameValidity = defValid ^ !validDefinition(old);
  +boolean sameValidity = (defValid == validDefinition(old));
  +//must have same validity; then if they are valid they must also be 
the same:
   return sameValidity && (!defValid || def.sameDefinition(old, 
project));
   }
   
  
  
  

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



Re: cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-01-28 Thread Peter Reilly
Matt Benson wrote:
--- Peter Reilly <[EMAIL PROTECTED]> wrote:
 

Do we really need code that has to be read five
times
to figure out what it does?
   

You cut me deep, Peter.  Would you settle for a
comment?  ;)
 

I did not mean to be too criticial, it can be fun to replace if else 
type code
with boolean logic type code, and modifing ant code is meant to be fun! :-D

Peter
-Matt
 

Peter
[EMAIL PROTECTED] wrote:
   

mbenson 2005/01/27 13:53:27
Modified:src/main/org/apache/tools/ant
 

ComponentHelper.java
   

Log:
-2 characters
Revision  ChangesPath
1.47  +1 -1 
 

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.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- ComponentHelper.java	26 Jan 2005 20:12:51
 

-	1.46
   

+++ ComponentHelper.java	27 Jan 2005 21:53:27
 

-	1.47
   

@@ -583,7 +583,7 @@
 private boolean sameDefinition(
 AntTypeDefinition def, AntTypeDefinition
 

old) {
   

 boolean defValid = validDefinition(def);
-boolean sameValidity = !(defValid ^
 

validDefinition(old));
   

+boolean sameValidity = defValid ^
 

!validDefinition(old);
   

 return sameValidity && (!defValid ||
 

def.sameDefinition(old, project));
   

 }
 


 

-
   

To unsubscribe, e-mail:
 

[EMAIL PROTECTED]
   

For additional commands, e-mail:
 

[EMAIL PROTECTED]
   


 

   

-
 

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


		
__ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 


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

 


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


Re: cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-01-28 Thread Matt Benson
--- Peter Reilly <[EMAIL PROTECTED]> wrote:

> Do we really need code that has to be read five
> times
> to figure out what it does?
> 

You cut me deep, Peter.  Would you settle for a
comment?  ;)

-Matt

> Peter
> 
> [EMAIL PROTECTED] wrote:
> 
> >mbenson 2005/01/27 13:53:27
> >
> >  Modified:src/main/org/apache/tools/ant
> ComponentHelper.java
> >  Log:
> >  -2 characters
> >  
> >  Revision  ChangesPath
> >  1.47  +1 -1 
>
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.46
> >  retrieving revision 1.47
> >  diff -u -r1.46 -r1.47
> >  --- ComponentHelper.java   26 Jan 2005 20:12:51
> - 1.46
> >  +++ ComponentHelper.java   27 Jan 2005 21:53:27
> - 1.47
> >  @@ -583,7 +583,7 @@
> >   private boolean sameDefinition(
> >   AntTypeDefinition def, AntTypeDefinition
> old) {
> >   boolean defValid = validDefinition(def);
> >  -boolean sameValidity = !(defValid ^
> validDefinition(old));
> >  +boolean sameValidity = defValid ^
> !validDefinition(old);
> >   return sameValidity && (!defValid ||
> def.sameDefinition(old, project));
> >   }
> >   
> >  
> >  
> >  
> >
>
>-
> >To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> >For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> >
> >
> >  
> >
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 




__ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 


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



Re: cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-01-28 Thread Peter Reilly
Do we really need code that has to be read five times
to figure out what it does?
Peter
[EMAIL PROTECTED] wrote:
mbenson 2005/01/27 13:53:27
 Modified:src/main/org/apache/tools/ant ComponentHelper.java
 Log:
 -2 characters
 
 Revision  ChangesPath
 1.47  +1 -1  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.46
 retrieving revision 1.47
 diff -u -r1.46 -r1.47
 --- ComponentHelper.java	26 Jan 2005 20:12:51 -	1.46
 +++ ComponentHelper.java	27 Jan 2005 21:53:27 -	1.47
 @@ -583,7 +583,7 @@
  private boolean sameDefinition(
  AntTypeDefinition def, AntTypeDefinition old) {
  boolean defValid = validDefinition(def);
 -boolean sameValidity = !(defValid ^ validDefinition(old));
 +boolean sameValidity = defValid ^ !validDefinition(old);
  return sameValidity && (!defValid || def.sameDefinition(old, project));
  }
  
 
 
 

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

 


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


cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-01-27 Thread mbenson
mbenson 2005/01/27 13:54:47

  Modified:src/main/org/apache/tools/ant Tag: ANT_16_BRANCH
ComponentHelper.java
  Log:
  Merge
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.28.2.9  +1 -1  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.28.2.8
  retrieving revision 1.28.2.9
  diff -u -r1.28.2.8 -r1.28.2.9
  --- ComponentHelper.java  26 Jan 2005 20:14:58 -  1.28.2.8
  +++ ComponentHelper.java  27 Jan 2005 21:54:46 -  1.28.2.9
  @@ -583,7 +583,7 @@
   private boolean sameDefinition(
   AntTypeDefinition def, AntTypeDefinition old) {
   boolean defValid = validDefinition(def);
  -boolean sameValidity = !(defValid ^ validDefinition(old));
  +boolean sameValidity = defValid ^ !validDefinition(old);
   return sameValidity && (!defValid || def.sameDefinition(old, 
project));
   }
   
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-01-27 Thread mbenson
mbenson 2005/01/27 13:53:27

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  -2 characters
  
  Revision  ChangesPath
  1.47  +1 -1  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.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- ComponentHelper.java  26 Jan 2005 20:12:51 -  1.46
  +++ ComponentHelper.java  27 Jan 2005 21:53:27 -  1.47
  @@ -583,7 +583,7 @@
   private boolean sameDefinition(
   AntTypeDefinition def, AntTypeDefinition old) {
   boolean defValid = validDefinition(def);
  -boolean sameValidity = !(defValid ^ validDefinition(old));
  +boolean sameValidity = defValid ^ !validDefinition(old);
   return sameValidity && (!defValid || def.sameDefinition(old, 
project));
   }
   
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-01-26 Thread mbenson
mbenson 2005/01/26 12:14:58

  Modified:src/main/org/apache/tools/ant Tag: ANT_16_BRANCH
ComponentHelper.java
  Log:
  Sync with HEAD
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.28.2.8  +77 -120   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.28.2.7
  retrieving revision 1.28.2.8
  diff -u -r1.28.2.7 -r1.28.2.8
  --- ComponentHelper.java  14 Apr 2004 15:42:40 -  1.28.2.7
  +++ ComponentHelper.java  26 Jan 2005 20:14:58 -  1.28.2.8
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2003-2004 The Apache Software Foundation
  + * Copyright  2003-2005 The Apache Software Foundation
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
  @@ -85,10 +85,10 @@
   private Project project;
   
   /**
  - * find a project component for a specific project, creating
  - * it if it does not exist
  - * @param project the project
  - * @return the project component for a specific project
  + * Find a project component for a specific project, creating
  + * it if it does not exist.
  + * @param project the project.
  + * @return the project component for a specific project.
*/
   public static ComponentHelper getComponentHelper(Project project) {
   // Singleton for now, it may change ( per/classloader )
  @@ -111,27 +111,27 @@
   }
   
   /**
  - * Set the next chained component helper
  + * Set the next chained component helper.
*
  - * @param next the next chained component helper
  + * @param next the next chained component helper.
*/
   public void setNext(ComponentHelper next) {
   this.next = next;
   }
   
   /**
  - * Get the next chained component helper
  + * Get the next chained component helper.
*
  - * @return the next chained component helper
  + * @return the next chained component helper.
*/
   public ComponentHelper getNext() {
   return next;
   }
   
   /**
  - * Sets the project for this component helper
  + * Sets the project for this component helper.
*
  - * @param project the project for this helper
  + * @param project the project for this helper.
*/
   public void setProject(Project project) {
   this.project = project;
  @@ -142,7 +142,7 @@
* Used with creating child projects. Each child
* project inherits the component definitions
* from its parent.
  - * @param helper the component helper of the parent project
  + * @param helper the component helper of the parent project.
*/
   public void initSubProject(ComponentHelper helper) {
   // add the types of the parent project
  @@ -157,26 +157,23 @@
   }
   }
   
  -/** Factory method to create the components.
  +/**
  + * Factory method to create the components.
*
* This should be called by UnknownElement.
*
  - * @param ue The Unknown Element creating this component
  - * @param ns Namespace URI. Also available as ue.getNamespace()
  + * @param ue The Unknown Element creating this component.
  + * @param ns Namespace URI. Also available as ue.getNamespace().
* @param componentType The component type,
  - *   Also available as ue.getComponentName()
  - * @return the created component
  - * @throws BuildException if an error occurs
  + *   Also available as ue.getComponentName().
  + * @return the created component.
  + * @throws BuildException if an error occurs.
*/
   public Object createComponent(UnknownElement ue,
 String ns,
 String componentType)
   throws BuildException {
   Object component = createComponent(componentType);
  -if (component == null) {
  -return null;
  -}
  -
   if (component instanceof Task) {
   Task task = (Task) component;
   task.setLocation(ue.getLocation());
  @@ -186,7 +183,6 @@
   task.init();
   addCreatedTask(componentType, task);
   }
  -
   return component;
   }
   
  @@ -195,15 +191,12 @@
*
* @param componentName the name of the component, if
*  the component is in a namespace, the
  - *  name is prefixed with the namespace uri and ":"
  + *  name is prefixed with the namespace uri and ":".
* @return the class

cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-01-26 Thread mbenson
mbenson 2005/01/26 12:12:52

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  Oops, got | and ^ confused... :(
  
  Revision  ChangesPath
  1.46  +1 -1  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.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- ComponentHelper.java  20 Jan 2005 16:58:56 -  1.45
  +++ ComponentHelper.java  26 Jan 2005 20:12:51 -  1.46
  @@ -583,7 +583,7 @@
   private boolean sameDefinition(
   AntTypeDefinition def, AntTypeDefinition old) {
   boolean defValid = validDefinition(def);
  -boolean sameValidity = !(defValid | validDefinition(old));
  +boolean sameValidity = !(defValid ^ validDefinition(old));
   return sameValidity && (!defValid || def.sameDefinition(old, 
project));
   }
   
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2005-01-20 Thread peterreilly
peterreilly2005/01/20 08:54:54

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  trailing space
  
  Revision  ChangesPath
  1.44  +1 -1  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.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- ComponentHelper.java  16 Dec 2004 18:13:18 -  1.43
  +++ ComponentHelper.java  20 Jan 2005 16:54:54 -  1.44
  @@ -605,7 +605,7 @@
   Class oldClass = antTypeTable.getExposedClass(name);
   boolean isTask =
   (oldClass != null && 
Task.class.isAssignableFrom(oldClass));
  -project.log( "Trying to override old definition of "
  +project.log("Trying to override old definition of "
   + (isTask ? "task " : "datatype ") + name,
   (def.similarDefinition(old, project))
   ? Project.MSG_VERBOSE : Project.MSG_WARN);
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2004-12-16 Thread mbenson
mbenson 2004/12/16 10:13:18

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  Yet more bumming & javadoc.  You'd think I'd have stopped by now...
  
  Revision  ChangesPath
  1.43  +27 -34ant/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.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- ComponentHelper.java  16 Dec 2004 16:51:11 -  1.42
  +++ ComponentHelper.java  16 Dec 2004 18:13:18 -  1.43
  @@ -85,10 +85,10 @@
   private Project project;
   
   /**
  - * find a project component for a specific project, creating
  - * it if it does not exist
  - * @param project the project
  - * @return the project component for a specific project
  + * Find a project component for a specific project, creating
  + * it if it does not exist.
  + * @param project the project.
  + * @return the project component for a specific project.
*/
   public static ComponentHelper getComponentHelper(Project project) {
   // Singleton for now, it may change ( per/classloader )
  @@ -111,27 +111,27 @@
   }
   
   /**
  - * Set the next chained component helper
  + * Set the next chained component helper.
*
  - * @param next the next chained component helper
  + * @param next the next chained component helper.
*/
   public void setNext(ComponentHelper next) {
   this.next = next;
   }
   
   /**
  - * Get the next chained component helper
  + * Get the next chained component helper.
*
  - * @return the next chained component helper
  + * @return the next chained component helper.
*/
   public ComponentHelper getNext() {
   return next;
   }
   
   /**
  - * Sets the project for this component helper
  + * Sets the project for this component helper.
*
  - * @param project the project for this helper
  + * @param project the project for this helper.
*/
   public void setProject(Project project) {
   this.project = project;
  @@ -142,7 +142,7 @@
* Used with creating child projects. Each child
* project inherits the component definitions
* from its parent.
  - * @param helper the component helper of the parent project
  + * @param helper the component helper of the parent project.
*/
   public void initSubProject(ComponentHelper helper) {
   // add the types of the parent project
  @@ -162,12 +162,12 @@
*
* This should be called by UnknownElement.
*
  - * @param ue The Unknown Element creating this component
  - * @param ns Namespace URI. Also available as ue.getNamespace()
  + * @param ue The Unknown Element creating this component.
  + * @param ns Namespace URI. Also available as ue.getNamespace().
* @param componentType The component type,
  - *   Also available as ue.getComponentName()
  - * @return the created component
  - * @throws BuildException if an error occurs
  + *   Also available as ue.getComponentName().
  + * @return the created component.
  + * @throws BuildException if an error occurs.
*/
   public Object createComponent(UnknownElement ue,
 String ns,
  @@ -191,7 +191,7 @@
*
* @param componentName the name of the component, if
*  the component is in a namespace, the
  - *  name is prefixed with the namespace uri and ":"
  + *  name is prefixed with the namespace uri and ":".
* @return the class if found or null if not.
*/
   public Object createComponent(String componentName) {
  @@ -204,7 +204,7 @@
*
* @param componentName the name of the component, if
*  the component is in a namespace, the
  - *  name is prefixed with the namespace uri and ":"
  + *  name is prefixed with the namespace uri and ":".
* @return the class if found or null if not.
*/
   public Class getComponentClass(String componentName) {
  @@ -213,9 +213,9 @@
   }
   
   /**
  - * Return the antTypeDefinition for a componentName
  - * @param componentName the name of the component
  - * @return the ant definition or null if not present
  + * Return the antTypeDefinition for a componentName.
  + * @param componentName the name of the component.
  + * @return the ant definition or null if not present.
*/
   public AntTypeDefinition getDefinition(String componentName) {
   checkNames

cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2004-12-16 Thread mbenson
mbenson 2004/12/16 08:51:11

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  Same LOC count, minus 2 method calls, cute implementation.  ;)
  
  Revision  ChangesPath
  1.42  +3 -3  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.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- ComponentHelper.java  16 Dec 2004 14:57:10 -  1.41
  +++ ComponentHelper.java  16 Dec 2004 16:51:11 -  1.42
  @@ -585,9 +585,9 @@
*/
   private boolean sameDefinition(
   AntTypeDefinition def, AntTypeDefinition old) {
  -return ((validDefinition(def) && validDefinition(old)
  -&& def.sameDefinition(old, project))
  -|| !(validDefinition(def) | validDefinition(old)));
  +boolean defValid = validDefinition(def);
  +boolean sameValidity = !(defValid | validDefinition(old));
  +return sameValidity && (!defValid || def.sameDefinition(old, 
project));
   }
   
   /**
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2004-12-16 Thread peterreilly
peterreilly2004/12/16 06:57:10

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  Checkstyle
  
  Revision  ChangesPath
  1.41  +1 -1  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.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- ComponentHelper.java  15 Dec 2004 23:44:05 -  1.40
  +++ ComponentHelper.java  16 Dec 2004 14:57:10 -  1.41
  @@ -648,7 +648,7 @@
   public void exitAntLib() {
   antLibStack.pop();
   antLibCurrentUri = (antLibStack.size() == 0)
  -? null : (String)antLibStack.peek();
  +? null : (String) antLibStack.peek();
   }
   
   /**
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2004-06-16 Thread mbenson
mbenson 2004/06/16 08:41:51

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  Code cleanup.
  
  Revision  ChangesPath
  1.37  +12 -27ant/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.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- ComponentHelper.java  14 Apr 2004 15:42:06 -  1.36
  +++ ComponentHelper.java  16 Jun 2004 15:41:51 -  1.37
  @@ -200,10 +200,7 @@
*/
   public Object createComponent(String componentName) {
   AntTypeDefinition def = getDefinition(componentName);
  -if (def == null) {
  -return null;
  -}
  -return def.create(project);
  +return (def == null) ? null : def.create(project);
   }
   
   /**
  @@ -229,9 +226,7 @@
*/
   public AntTypeDefinition getDefinition(String componentName) {
   checkNamespace(componentName);
  -AntTypeDefinition ret = null;
  -ret = antTypeTable.getDefinition(componentName);
  -return ret;
  +return antTypeTable.getDefinition(componentName);
   }
   
   /**
  @@ -803,8 +798,7 @@
   }
   
   public AntTypeDefinition getDefinition(String key) {
  -AntTypeDefinition ret = (AntTypeDefinition) super.get(key);
  -return ret;
  +return (AntTypeDefinition)(super.get(key));
   }
   
   /** Equivalent to getTypeType */
  @@ -814,37 +808,28 @@
   
   public Object create(String name) {
   AntTypeDefinition def = getDefinition(name);
  -if (def == null) {
  -return null;
  -}
  -return def.create(project);
  +return (def == null) ? null : def.create(project);
   }
   
   public Class getTypeClass(String name) {
   AntTypeDefinition def = getDefinition(name);
  -if (def == null) {
  -return null;
  -}
  -return def.getTypeClass(project);
  +return (def == null) ? null : def.getTypeClass(project);
   }
   
   public Class getExposedClass(String name) {
   AntTypeDefinition def = getDefinition(name);
  -if (def == null) {
  -return null;
  -}
  -return def.getExposedClass(project);
  +return (def == null) ? null : def.getExposedClass(project);
   }
   
   public boolean contains(Object clazz) {
  -for (Iterator i = values().iterator(); i.hasNext();) {
  -AntTypeDefinition def = (AntTypeDefinition) i.next();
  -Class c = def.getExposedClass(project);
  -if (c == clazz) {
  -return true;
  +boolean found = false;
  +if (clazz instanceof Class) {
  +for (Iterator i = values().iterator(); i.hasNext() && 
!found;) {
  +found |= 
(((AntTypeDefinition)(i.next())).getExposedClass(
  +project) == clazz);
   }
   }
  -return false;
  +return found;
   }
   
   public boolean containsValue(Object value) {
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2004-02-23 Thread peterreilly
peterreilly2004/02/23 01:40:13

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  Autoload of antlib.xml from default namespace
  
  Revision  ChangesPath
  1.34  +3 -4  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.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- ComponentHelper.java  9 Feb 2004 21:05:16 -   1.33
  +++ ComponentHelper.java  23 Feb 2004 09:40:13 -  1.34
  @@ -772,11 +772,10 @@
* associated URI has been examined for antlibs.
*/
   private synchronized void checkNamespace(String componentName) {
  -if (componentName.indexOf(':') == -1) {
  -return; // not a namespaced name
  -}
  -
   String uri = 
ProjectHelper.extractUriFromComponentName(componentName);
  +if ("".equals(uri)) {
  +uri = ProjectHelper.ANT_CORE_URI;
  +}
   if (!uri.startsWith(ProjectHelper.ANTLIB_URI)) {
   return; // namespace that does not contain antlib
   }
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2003-12-24 Thread peterreilly
peterreilly2003/12/24 02:52:42

  Modified:src/main/org/apache/tools/ant Tag: ANT_16_BRANCH
ComponentHelper.java
  Log:
  Sync with head
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.28.2.2  +3 -1  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.28.2.1
  retrieving revision 1.28.2.2
  diff -u -r1.28.2.1 -r1.28.2.2
  --- ComponentHelper.java  17 Oct 2003 08:13:03 -  1.28.2.1
  +++ ComponentHelper.java  24 Dec 2003 10:52:42 -  1.28.2.2
  @@ -192,7 +192,9 @@
   antTypeTable.put(def.getName(), def);
   }
   // add the parsed namespaces of the parent project
  -checkedNamespaces.add(helper.checkedNamespaces);
  +for (Iterator i = helper.checkedNamespaces.iterator(); i.hasNext();) 
{
  +checkedNamespaces.add(i.next());
  +}
   }
   
   /** Factory method to create the components.
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2003-12-24 Thread peterreilly
peterreilly2003/12/24 02:52:03

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  ComponentHelper.
  Logic for copying the checked namespaces to new projects was broken.
  
  Revision  ChangesPath
  1.30  +3 -1  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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- ComponentHelper.java  17 Oct 2003 08:09:46 -  1.29
  +++ ComponentHelper.java  24 Dec 2003 10:52:03 -  1.30
  @@ -192,7 +192,9 @@
   antTypeTable.put(def.getName(), def);
   }
   // add the parsed namespaces of the parent project
  -checkedNamespaces.add(helper.checkedNamespaces);
  +for (Iterator i = helper.checkedNamespaces.iterator(); i.hasNext();) 
{
  +checkedNamespaces.add(i.next());
  +}
   }
   
   /** Factory method to create the components.
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2003-10-17 Thread peterreilly
peterreilly2003/10/17 01:13:03

  Modified:src/main/org/apache/tools/ant Tag: ANT_16_BRANCH
ComponentHelper.java
  Log:
  Merge with HEAD
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.28.2.1  +1 -1  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.28
  retrieving revision 1.28.2.1
  diff -u -r1.28 -r1.28.2.1
  --- ComponentHelper.java  10 Sep 2003 10:37:13 -  1.28
  +++ ComponentHelper.java  17 Oct 2003 08:13:03 -  1.28.2.1
  @@ -806,7 +806,7 @@
* called for each component name, check if the
* associated URI has been examined for antlibs.
*/
  -private void checkNamespace(String componentName) {
  +private synchronized void checkNamespace(String componentName) {
   if (componentName.indexOf(':') == -1) {
   return; // not a namespaced name
   }
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2003-10-17 Thread peterreilly
peterreilly2003/10/17 01:09:46

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  synchonize ComponentHelper#checkNamespace()
  This fixes a bug with use of  and xmlns:prefix="antlib:package
  

  
echo hello
echo hello
  

  
  - need a unit test for this
  
  Revision  ChangesPath
  1.29  +1 -1  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.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- ComponentHelper.java  10 Sep 2003 10:37:13 -  1.28
  +++ ComponentHelper.java  17 Oct 2003 08:09:46 -  1.29
  @@ -806,7 +806,7 @@
* called for each component name, check if the
* associated URI has been examined for antlibs.
*/
  -private void checkNamespace(String componentName) {
  +private synchronized void checkNamespace(String componentName) {
   if (componentName.indexOf(':') == -1) {
   return; // not a namespaced name
   }
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java AntTypeDefinition.java

2003-08-15 Thread peterreilly
peterreilly2003/08/15 01:40:37

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
AntTypeDefinition.java
  Log:
  move same definition to AntTypeDefinition
  
  Revision  ChangesPath
  1.24  +1 -9  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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- ComponentHelper.java  13 Aug 2003 14:46:15 -  1.23
  +++ ComponentHelper.java  15 Aug 2003 08:40:37 -  1.24
  @@ -651,15 +651,7 @@
   if (!validDefinition(def) || !validDefinition(old)) {
   return validDefinition(def) == validDefinition(old);
   }
  -
  -if (!(old.getTypeClass(project).equals(def.getTypeClass(project {
  -return false;
  -}
  -if (!(old.getExposedClass(project).equals(
  -  def.getExposedClass(project {
  -return false;
  -}
  -return true;
  +return def.sameDefinition(old, project);
   }
   
   
  
  
  
  1.5   +22 -2 ant/src/main/org/apache/tools/ant/AntTypeDefinition.java
  
  Index: AntTypeDefinition.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/AntTypeDefinition.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AntTypeDefinition.java13 Aug 2003 12:45:41 -  1.4
  +++ AntTypeDefinition.java15 Aug 2003 08:40:37 -  1.5
  @@ -54,6 +54,7 @@
   
   package org.apache.tools.ant;
   
  +
   /**
* This class contains all the information
* on a particular ant type,
  @@ -217,7 +218,7 @@
* @return the created object
*/
   public Object create(Project project) {
  -return  icreate(project);
  +return icreate(project);
   }
   
   /**
  @@ -326,5 +327,24 @@
   "Could not create type " + name + " due to " + t, t);
   }
   }
  -}
   
  +/**
  + * Equality method for this definition
  + *
  + * @param other another definition
  + * @param project the project the definition
  + * @return true if the definitions are the same
  + */
  +public boolean sameDefinition(AntTypeDefinition other, Project project) {
  +if (other == null) {
  +return false;
  +}
  +if (other.getClass() != this.getClass()) {
  +return false;
  +}
  +if (!(other.getTypeClass(project).equals(getTypeClass(project {
  +return false;
  +}
  +return 
other.getExposedClass(project).equals(getExposedClass(project));
  +}
  +}
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2003-07-04 Thread peterreilly
peterreilly2003/07/04 10:00:14

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  changed for checkstyle
  
  Revision  ChangesPath
  1.17  +82 -53ant/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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ComponentHelper.java  4 Jul 2003 14:04:52 -   1.16
  +++ ComponentHelper.java  4 Jul 2003 17:00:11 -   1.17
  @@ -109,29 +109,54 @@
   protected Project project;
   
   /**
  + * find a project component for a specific project, creating
  + * it if it does not exist
  + * @param project the project
  + * @return the project component for a specific project
*/
   public static ComponentHelper getComponentHelper(Project project) {
   // Singleton for now, it may change ( per/classloader )
  -ComponentHelper ph=(ComponentHelper)project.getReference( 
"ant.ComponentHelper" );
  -if( ph!=null ) return ph;
  -ph=new ComponentHelper();
  -ph.setProject( project );
  +ComponentHelper ph = (ComponentHelper) project.getReference(
  +"ant.ComponentHelper");
  +if (ph != null) {
  +return ph;
  +}
  +ph = new ComponentHelper();
  +ph.setProject(project);
   
  -project.addReference( "ant.ComponentHelper",ph );
  +project.addReference("ant.ComponentHelper", ph);
   return ph;
   }
   
  +/**
  + * Creates a new ComponentHelper instance.
  + */
   protected ComponentHelper() {
   }
   
  -public void setNext( ComponentHelper next ) {
  -this.next=next;
  +/**
  + * Set the next chained component helper
  + *
  + * @param next the next chained component helper
  + */
  +public void setNext(ComponentHelper next) {
  +this.next = next;
   }
   
  +/**
  + * Get the next chained component helper
  + *
  + * @return the next chained component helper
  + */
   public ComponentHelper getNext() {
   return next;
   }
   
  +/**
  + * Sets the project for this component helper
  + *
  + * @param project the project for this helper
  + */
   public void setProject(Project project) {
   this.project = project;
   antTypeTable = new AntTypeTable(project);
  @@ -141,6 +166,7 @@
* Used with creating child projects. Each child
* project inherites the component definitions
* from its parent.
  + * @param helper the component helper of the parent project
*/
   public void initSubProject(ComponentHelper helper) {
   // add the types of the parent project
  @@ -158,14 +184,13 @@
* @param ue The component helper has access via ue to the entire XML 
tree.
* @param ns Namespace. Also available as ue.getNamespace()
* @param taskName The element name. Also available as ue.getTag()
  - * @return
  - * @throws BuildException
  + * @return the created component
  + * @throws BuildException if an error occuries
*/
  -public Object createComponent( UnknownElement ue,
  -   String ns,
  -   String taskName )
  -throws BuildException
  -{
  +public Object createComponent(UnknownElement ue,
  +  String ns,
  +  String taskName)
  +throws BuildException {
   Object component = createComponent(taskName);
   if (component == null) {
   return null;
  @@ -189,9 +214,7 @@
*  name is prefixed withe the namespace uri and ":"
* @return the class if found or null if not.
*/
  -   public Object createComponent(String componentName)
  -throws BuildException
  -{
  +public Object createComponent(String componentName) {
   return antTypeTable.create(componentName);
   }
   
  @@ -209,18 +232,19 @@
   
   /**
* Return the antTypeDefinition for a componentName
  + * @param componentName the name of the component
  + * @return the ant definition or null if not present
*/
   public AntTypeDefinition getDefinition(String componentName) {
   return antTypeTable.getDefinition(componentName);
   }
   
  -/** Initialization code - implementing the original ant component
  +/**
  + * Initialization code - implementing the original ant component
* loading from /org/apache/tools/ant/taskdefs/default.properties
* and .../types/default.properties
  - *
  - * @throws BuildException
*/
  -public void initDef

cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2003-06-27 Thread peterreilly
peterreilly2003/06/27 11:16:59

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  quick fix for Ant.java use of property in Ant#reinit
  
  Revision  ChangesPath
  1.14  +9 -1  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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ComponentHelper.java  27 Jun 2003 09:24:10 -  1.13
  +++ ComponentHelper.java  27 Jun 2003 18:16:59 -  1.14
  @@ -434,7 +434,15 @@
*/
   public Task createTask(String taskType) throws BuildException {
   Task task=createNewTask(taskType);
  -if(task!=null) {
  +if (task == null && taskType.equals("property")) {
  +// quick fix for Ant.java use of property before
  +// initializeing the project
  +addTaskDefinition("property",
  +  org.apache.tools.ant.taskdefs.Property.class);
  +task = createNewTask(taskType);
  +}
  +
  +if (task != null) {
   addCreatedTask(taskType, task);
   }
   return task;
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2003-05-05 Thread costin
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  ChangesPath
  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 -   1.8
  +++ ComponentHelper.java  5 May 2003 13:59:24 -   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;
   }
   
  
  
  


cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2003-05-05 Thread costin
costin  2003/05/04 19:17:28

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  Remove one method - it wasn't used, and it seems it's not powerfull enough for
  all cases discussed. The method that takes UnknownElement, ns, tag should
  be able to cover everything ( by having access to UE you get access to parent
  and all the tree - so any kind of policy can be implemented )
  
  Of course - nothing calls this method yet. Switching UnknwonElement and the
  normal component creation is easy - but there are many pieces of code that
  call the old method.
  
  Revision  ChangesPath
  1.8   +24 -26ant/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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ComponentHelper.java  3 May 2003 06:27:00 -   1.7
  +++ ComponentHelper.java  5 May 2003 02:17:28 -   1.8
  @@ -124,28 +124,16 @@
   taskClassDefinitions= new AntTaskTable(project, true);
   }
   
  -
  -/** Creates an ant component..
  - *
  - * A factory may have knowledge about the tasks it creates. It can return
  - * an object extending TaskAdapter that emulates Task/DataType. If null 
is returned,
  - * the next helper is tried.
  - *
  - * @param ns namespace if a SAX2 parser is used, null for 'classical' ant
  - * @param taskName the (local) name of the task.
  - */
  -public Object createComponent( String ns,
  -   String taskName )
  -throws BuildException
  -{
  -if( getNext() != null ) {
  -return getNext().createComponent( ns, taskName);
  -}
  -return null;
  -// XXX class loader ? Can use the ns, but additional hints may be 
available in taskdef
  -//
  -}
  -
  +/** Factory method to create the components.
  + * 
  + * This should be called by UnknownElement.
  + * 
  + * @param ue The component helper has access via ue to the entire XML 
tree.
  + * @param ns Namespace. Also available as ue.getNamespace()
  + * @param taskName The element name. Also available as ue.getTag()
  + * @return
  + * @throws BuildException
  + */ 
   public Object createComponent( UnknownElement ue,
  String ns,
  String taskName )
  @@ -162,17 +150,23 @@
   // This is the original policy in ProjectHelper. The 1.5 version 
of UnkwnonwElement
   // used to try first to create a task, and if it failed tried a 
type. In 1.6 the diff
   // should disapear.
  -component = project.createDataType(taskName);
  +component = this.createDataType(taskName);
   if( component!=null ) return component;
   }
   
   // from UnkwnonwElement.createTask. The 'top level' case is removed, 
we're
   // allways lazy
  -component = project.createTask(taskName);
  +component = this.createTask(taskName);
   
   return component;
   }
   
  +/** Initialization code - implementing the original ant component
  + * loading from /org/apache/tools/ant/taskdefs/default.properties 
  + * and .../types/default.properties
  + * 
  + * @throws BuildException
  + */ 
   public void initDefaultDefinitions() throws BuildException {
   String defs = "/org/apache/tools/ant/taskdefs/defaults.properties";
   
  @@ -229,8 +223,8 @@
*   this exception is thrown.
*
* @see #checkTaskClass(Class)
  - - */
  -public void addTaskDefinition(String taskName, Class taskClass)
  + */
  +public void addTaskDefinition(String taskName, Class taskClass)   
   throws BuildException {
   Class old = (Class) taskClassDefinitions.get(taskName);
   if (null != old) {
  @@ -368,6 +362,10 @@
* Creates a new instance of a task, adding it to a list of
* created tasks for later invalidation. This causes all tasks
* to be remembered until the containing project is removed
  + *
  + *  Called from Project.createTask(), which can be called by tasks.
  + *  The method should be deprecated, as it doesn't support ns and libs.
  + *
* @param taskType The name of the task to create an instance of.
* Must not be null.
*
  
  
  


cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2003-05-03 Thread costin
costin  2003/05/02 23:27:00

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  The ctor takes Project as param.
  
  Revision  ChangesPath
  1.7   +1 -1  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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ComponentHelper.java  3 May 2003 05:59:35 -   1.6
  +++ ComponentHelper.java  3 May 2003 06:27:00 -   1.7
  @@ -524,7 +524,7 @@
   if (noArg) {
   o = ctor.newInstance(new Object[0]);
   } else {
  -o = ctor.newInstance(new Object[] {this});
  +o = ctor.newInstance(new Object[] {project});
   }
   if ( project != null ) {
   project.setProjectReference( o );
  
  
  


cvs commit: ant/src/main/org/apache/tools/ant ComponentHelper.java

2003-05-03 Thread costin
costin  2003/05/02 22:59:35

  Modified:src/main/org/apache/tools/ant ComponentHelper.java
  Log:
  Update with the changes in Project.
  
  This makes ComponentHelper the almost exact duplication of the task creation
  code in Project.
  
  Revision  ChangesPath
  1.6   +12 -4 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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ComponentHelper.java  15 Apr 2003 17:23:15 -  1.5
  +++ ComponentHelper.java  3 May 2003 05:59:35 -   1.6
  @@ -423,6 +423,7 @@
   }
   task = taskA;
   }
  +task.setProject( project );
   task.setTaskType(taskType);
   
   // set default value, can be changed by the user
  @@ -631,7 +632,9 @@
   project.log("Loading with the core loader " + value,
   Project.MSG_DEBUG);
   taskClass=project.getCoreLoader().loadClass(value);
  -if( taskClass != null ) return taskClass;
  +if( taskClass != null ) {
  +return taskClass;
  +}
   } catch( Exception ex ) {
   }
   }
  @@ -650,12 +653,17 @@
   // Hashtable implementation
   public Object get( Object key ) {
   Object orig=super.get( key );
  -if( orig!= null ) return orig;
  -if( ! (key instanceof String) ) return null;
  +if( orig!= null ) {
  +return orig;
  +}
  +if( ! (key instanceof String) ) {
  +return null;
  +}
   project.log("Get task " + key, Project.MSG_DEBUG );
   Object taskClass=getTask( (String) key);
  -if( taskClass != null)
  +if( taskClass != null) {
   super.put( key, taskClass );
  +}
   return taskClass;
   }