Properties.list( ) Regression in 3.3
Ranjit Mathew
rmathew@hotmail.com
Wed Feb 12 20:27:00 GMT 2003
Hi,
The following simple program no longer prints the expected
output with GCJ 3.3, though it works with both GCJ 3.2 as well as
Sun's JDK 1.4.1.01:
----------------------------- 8< -------------------------------
public class HelloWorld {
public static void main( String[] args) {
System.getProperties( ).list( System.out);
}
}
----------------------------- 8< -------------------------------
I could trace it to the fact that in GCJ 3.3, System.getProperties( )
is returning in (essentially):
new Properties( Runtime.defaultProperties);
which creates a Properties object with the given default values.
Now Properties.list( ) refuses to print out the default values
of properties the way Properties.store( ) refuses to write out
default values of properties.
However, while the latter is specified by Sun's JDK docs, the former
is not. To remedy this problem we can either:
a. Use Runtime.defaultProperties.clone( ) to create the Properties
object returned by System.getProperties( ).
b. Remove the restriction in Properties.list( ) about printing out
default values of properties.
Which of the alternatives is preferable? Should I post a patch for
the same?
Ranjit.
--
Ranjit Mathew Email: rmathew AT hotmail DOT com
Bangalore,
INDIA. Web: http://ranjitmathew.tripod.com/
More information about the Java
mailing list