ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Haley <...@redhat.com>
Subject Patch to org/apache/tools/ant/Project.java
Date Wed, 12 Feb 2003 15:29:02 GMT
This is my forst time posting to the list.  If I should submit this
patch in some other way, please let me know.

I think this is a bug in Ant.  

What happens is that Ant accesses the system properties list not by
using the standard well-defined interface but by accessing its
underlying hash table.  The Java Language spec is ambiguous about what
happens in this case: it says that every property list can contain
another property list as its "defaults", but what it does not say is
whether accessing the underlying hash table gives access to the
defaults.

It seems to me that if you have a Properties object then you should be
using the Properties interface.  The spec doesn't guarantee anything
about the internal structure of the system properties.

Andrew.


*** Project.java~	Thu Oct 11 14:58:28 2001
--- Project.java	Tue Feb 11 21:00:57 2003
*************** public class Project {
*** 393,401 ****
      public void setSystemProperties() {
          Properties systemP = System.getProperties();
!         Enumeration e = systemP.keys();
          while (e.hasMoreElements()) {
!             Object name = e.nextElement();
!             String value = systemP.get(name).toString();
!             this.setProperty(name.toString(), value);
          }
      }
--- 393,401 ----
      public void setSystemProperties() {
          Properties systemP = System.getProperties();
!         Enumeration e = systemP.propertyNames();
          while (e.hasMoreElements()) {
!             String name = e.nextElement().toString();
!             String value = systemP.getProperty(name).toString();
!             this.setProperty(name, value);
          }
      }

Mime
View raw message