ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Murray, Mike" <...@ptc.com>
Subject RE: InheritAll=false Leaves Java System Properties Undefined
Date Wed, 31 Dec 2003 17:53:29 GMT
I finally spent the time to look into this again...

You are right, all values are not returned via keys(), because the built-in properties (eg
file.separator) have been moved into the default set.  In order to include the default values
when iterating the Properties object returned by System.getProperties(), the propertyNames()
method of Properties needs to be used instead of keys().

I searched the 1.6.0 source code and found two obvious misuses of System.getProperties().keys():

	apache-ant-1.6.0\src\main\org\apache\tools\ant\Diagnostics.java (Text):
	00307:	for (Enumeration keys = System.getProperties().keys();
 
	apache-ant-1.6.0\src\main\org\apache\tools\ant\types\PropertySet.java (Text):
	00272:	         e2 = System.getProperties().keys();

Searching for properties().keys, properties.keys & props.keys() turned up additional potential
misuses of the method in classes such as Main, Diagnostics, PropertySet, Property, & PropertyHelper.

Mike

-----Original Message-----
From: Stefan Bodewig [mailto:bodewig@apache.org]
Sent: Thursday, August 07, 2003 1:50 AM
To: user@ant.apache.org
Subject: Re: InheritAll=false Leaves Java System Properties Undefined

On Wed, 6 Aug 2003, Mike Murray <mbm@ptc.com> wrote:

> The interaction is that I am defining a custom task, which does a
> System.setProperties() as part of its static initialization.  As the
> output below shows, file.separator is still available via
> System.getProperty() after the antcall, but it is no longer
> available via ${file.separator}.

I guess that "file.separator" is not part of the keys() collection of
System.getProperties() after your code.

Ant iterates over the keys when copying system properties to Ant
properties (that are used to do the ${} expansion).

Stefan

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


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


Mime
View raw message