Stefan Bodewig wrote:

On Thu, 28 Oct 2004, Peter Reilly <[EMAIL PROTECTED]> wrote:


Stefan Bodewig wrote:


What if the keys/values are not Strings?




In this case, the "properties" are from System.getProperties() and
not from Project.getProperties().... so they are strings.



Who is going to prevent System.getProperties().put(Object, Class)?


Nothing...
However, it is breaking the usage of properties, for example:
public class Test {
   public static void main(String[] args) {
       Integer i = new Integer(10);
       System.getProperties().put(i, "10");
       System.getProperties().list(System.out);
   }
}
gets an exception:
Caused by: java.lang.ClassCastException: java.lang.Integer
   at java.util.Properties.enumerate(Properties.java:869)
   at java.util.Properties.list(Properties.java:823)
   at Test.main(Unknown Source)

We could put a check in, but as it is not in the jdk for (is it 10 years??), it
may not be vital...


Peter

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to