ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peterrei...@apache.org>
Subject Re: cvs commit: ant/src/main/org/apache/tools/ant/types CommandlineJava.java PropertySet.java
Date Thu, 28 Oct 2004 09:54:59 GMT
Stefan Bodewig wrote:

>On Thu, 28 Oct 2004, Peter Reilly <peterreilly@apache.org> 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: dev-unsubscribe@ant.apache.org
>For additional commands, e-mail: dev-help@ant.apache.org
>
>
>
>  
>


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


Mime
View raw message