Browse Source

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.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277212 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 20 years ago
parent
commit
8e9a25e46f
1 changed files with 10 additions and 19 deletions
  1. +10
    -19
      src/main/org/apache/tools/ant/PropertyHelper.java

+ 10
- 19
src/main/org/apache/tools/ant/PropertyHelper.java View File

@@ -167,7 +167,6 @@ public class PropertyHelper {
return true; return true;
} }
} }

return false; return false;
} }


@@ -190,13 +189,8 @@ public class PropertyHelper {
if (name.startsWith("toString:")) { if (name.startsWith("toString:")) {
name = name.substring("toString:".length()); name = name.substring("toString:".length());
Object v = project.getReference(name); Object v = project.getReference(name);
if (v == null) {
return null;
}
return v.toString();
return (v == null) ? null : v.toString();
} }


return null; return null;
} }


@@ -249,13 +243,11 @@ public class PropertyHelper {
* @return the original string with the properties replaced, or * @return the original string with the properties replaced, or
* <code>null</code> if the original string is <code>null</code>. * <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 { throws BuildException {
if (value == null) { if (value == null) {
return null; return null;
} }

Vector fragments = new Vector(); Vector fragments = new Vector();
Vector propertyRefs = new Vector(); Vector propertyRefs = new Vector();
parsePropertyString(value, fragments, propertyRefs); parsePropertyString(value, fragments, propertyRefs);
@@ -280,8 +272,8 @@ public class PropertyHelper {
} }


if (replacement == null) { 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) fragment = (replacement != null)
? replacement.toString() ? replacement.toString()
@@ -289,7 +281,6 @@ public class PropertyHelper {
} }
sb.append(fragment); sb.append(fragment);
} }

return sb.toString(); return sb.toString();
} }


@@ -312,8 +303,8 @@ public class PropertyHelper {
// user (CLI) properties take precedence // user (CLI) properties take precedence
if (null != userProperties.get(name)) { if (null != userProperties.get(name)) {
if (verbose) { 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; return false;
} }
@@ -324,8 +315,8 @@ public class PropertyHelper {
} }


if (null != properties.get(name) && verbose) { 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) { if (verbose) {
@@ -351,8 +342,8 @@ public class PropertyHelper {
public synchronized void setNewProperty(String ns, String name, public synchronized void setNewProperty(String ns, String name,
Object value) { Object value) {
if (null != properties.get(name)) { 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; return;
} }




Loading…
Cancel
Save