ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 27261] New: - Properties.propertyNames() instead of .keys()
Date Thu, 26 Feb 2004 16:00:57 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27261>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27261

Properties.propertyNames() instead of .keys()

           Summary: Properties.propertyNames() instead of .keys()
           Product: Ant
           Version: 1.6.1
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: mbm@ptc.com


Project.setSystemProperties(), so that it uses Properties.keys() instead of
propertyNames(), which excludes properties that have moved into the default
bucket.  Also, getProperty() needs to be used instead of getKey().

There are other places throughout Ant where this misuse occurs.  See this
(http://marc.theaimsgroup.com/?l=ant-user&m=107289321531422&w=2) mail list
posting for additional information.

The method recoded like this, solves the problem for my scenario:

public void setSystemProperties() {
        Properties systemP = System.getProperties();  // changed from keys()
        Enumeration e = systemP.propertyNames();
        while (e.hasMoreElements()) {
            Object name = e.nextElement();
            String value = systemP.getProperty(name.toString()).toString();  //
changed from get()
            this.setPropertyInternal(name.toString(), value);
        }
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message