ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Echo.java Property.java
Date Wed, 06 Dec 2000 14:12:44 GMT
conor       00/12/06 06:12:39

  Modified:    src/main/org/apache/tools/ant ProjectHelper.java
               src/main/org/apache/tools/ant/taskdefs Echo.java
                        Property.java
  Log:
  Change behaviour to log a warning rather than throwing an exception. I had
  to pass in the project object to get access to logging, unfortunately.
  
  Revision  Changes    Path
  1.41      +4 -4      jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.java
  
  Index: ProjectHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- ProjectHelper.java	2000/12/06 12:12:40	1.40
  +++ ProjectHelper.java	2000/12/06 14:12:25	1.41
  @@ -563,7 +563,7 @@
   
           for (int i = 0; i < attrs.getLength(); i++) {
               // reflect these into the target
  -            String value=replaceProperties(attrs.getValue(i), 
  +            String value=replaceProperties(project, attrs.getValue(i), 
                                              project.getProperties() );
               try {
                   ih.setAttribute(project, target, 
  @@ -605,7 +605,7 @@
   
       /** Replace ${NAME} with the property value
        */
  -    public static String replaceProperties( String value, Hashtable keys )
  +    public static String replaceProperties(Project project, String value, Hashtable keys
)
           throws BuildException
       {
           // XXX use Map instead of proj, it's too heavy
  @@ -635,10 +635,10 @@
                   }
                   String n=value.substring( pos+2, endName );
                   if (!keys.containsKey(n)) {
  -                    throw new BuildException("Property ${" + n + "} has not been set");
  +                    project.log("Property ${" + n + "} has not been set", Project.MSG_WARN);
                   }
                   
  -                String v = (String) keys.get(n);
  +                String v = (keys.containsKey(n)) ? (String) keys.get(n) : "${"+n+"}"; 
                   
                   //System.out.println("N: " + n + " " + " V:" + v);
                   sb.append( v );
  
  
  
  1.6       +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Echo.java
  
  Index: Echo.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Echo.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Echo.java	2000/11/17 15:03:50	1.5
  +++ Echo.java	2000/12/06 14:12:30	1.6
  @@ -123,7 +123,7 @@
        */
       public void addText(String msg) {
           message += 
  -            ProjectHelper.replaceProperties(msg, project.getProperties());
  +            ProjectHelper.replaceProperties(project, msg, project.getProperties());
       }
   
       /**
  
  
  
  1.22      +3 -3      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Property.java
  
  Index: Property.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Property.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- Property.java	2000/11/30 11:19:11	1.21
  +++ Property.java	2000/12/06 14:12:33	1.22
  @@ -204,7 +204,7 @@
           while (e.hasMoreElements()) {
               String name = (String) e.nextElement();
               String value = (String) props.getProperty(name);
  -            String v = ProjectHelper.replaceProperties(value, project.getProperties());
  +            String v = ProjectHelper.replaceProperties(project, value, project.getProperties());
               addProperty(name, value);
           }
       }
  @@ -261,9 +261,9 @@
                   }
       
                   if (!resolved) {
  -                    value = ProjectHelper.replaceProperties(value,
  +                    value = ProjectHelper.replaceProperties(project, value,
                                                                  project.getProperties());
  -                    value = ProjectHelper.replaceProperties(value, props);
  +                    value = ProjectHelper.replaceProperties(project, value, props);
                       props.put(name, value);
                   }    
               }
  
  
  

Mime
View raw message