mbenson     2004/12/15 08:40:22

  Modified:    src/main/org/apache/tools/ant PropertyHelper.java
  Log:
  For non-debug (verbose) log messages, enclose property names in double quotes
  for clarity.  Fix cases where "property name" is logged as '${property name}'
  as that notation more appropriately refers to the property's value.
  
  Revision  Changes    Path
  1.18      +10 -19    ant/src/main/org/apache/tools/ant/PropertyHelper.java
  
  Index: PropertyHelper.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/PropertyHelper.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- PropertyHelper.java       10 Sep 2004 17:31:50 -0000      1.17
  +++ PropertyHelper.java       15 Dec 2004 16:40:22 -0000      1.18
  @@ -167,7 +167,6 @@
                   return true;
               }
           }
  -
           return false;
       }
   
  @@ -190,13 +189,8 @@
           if (name.startsWith("toString:")) {
               name = name.substring("toString:".length());
               Object v = project.getReference(name);
  -            if (v == null) {
  -                return null;
  -            }
  -            return v.toString();
  +            return (v == null) ? null : v.toString();
           }
  -
  -
           return null;
       }
   
  @@ -249,13 +243,11 @@
        * @return the original string with the properties replaced, or
        *         <code>null</code> if the original string is <code>null</code>.
        */
  -    public String replaceProperties(String ns, String value,
  -                                    Hashtable keys)
  +    public String replaceProperties(String ns, String value, Hashtable keys)
               throws BuildException {
           if (value == null) {
               return null;
           }
  -
           Vector fragments = new Vector();
           Vector propertyRefs = new Vector();
           parsePropertyString(value, fragments, propertyRefs);
  @@ -280,8 +272,8 @@
                   }
   
                   if (replacement == null) {
  -                    project.log("Property ${" + propertyName
  -                            + "} has not been set", Project.MSG_VERBOSE);
  +                    project.log("Property \"" + propertyName
  +                            + "\" has not been set", Project.MSG_VERBOSE);
                   }
                   fragment = (replacement != null)
                           ? replacement.toString()
  @@ -289,7 +281,6 @@
               }
               sb.append(fragment);
           }
  -
           return sb.toString();
       }
   
  @@ -312,8 +303,8 @@
           // user (CLI) properties take precedence
           if (null != userProperties.get(name)) {
               if (verbose) {
  -                project.log("Override ignored for user property " + name,
  -                        Project.MSG_VERBOSE);
  +                project.log("Override ignored for user property \"" + name
  +                    + "\"", Project.MSG_VERBOSE);
               }
               return false;
           }
  @@ -324,8 +315,8 @@
           }
   
           if (null != properties.get(name) && verbose) {
  -            project.log("Overriding previous definition of property " + name,
  -                    Project.MSG_VERBOSE);
  +            project.log("Overriding previous definition of property \"" + 
name
  +                + "\"", Project.MSG_VERBOSE);
           }
   
           if (verbose) {
  @@ -351,8 +342,8 @@
       public synchronized void setNewProperty(String ns, String name,
                                               Object value) {
           if (null != properties.get(name)) {
  -            project.log("Override ignored for property " + name,
  -                    Project.MSG_VERBOSE);
  +            project.log("Override ignored for property \"" + name
  +                + "\"", Project.MSG_VERBOSE);
               return;
           }
   
  
  
  

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

Reply via email to