This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Properties.list( ) Regression in 3.3
- From: Ranjit Mathew <rmathew at hotmail dot com>
- To: java at gcc dot gnu dot org
- Date: Thu, 13 Feb 2003 01:25:14 +0530
- Subject: Properties.list( ) Regression in 3.3
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/