Strange class cast exception

Folk, the following code, at the store =() method call, is giving a ClassCastException. What could be wrong?

java.io.FileOutputStream out =new java.io.FileOutputStream("MyProps.properties");

java.util.Properties prop =new java.util.Properties();

//copy Hashtable to properties instance...

prop.putAll(MQMessenger.config);// it is a static hastable contaning some configuration options already loaded from the app load

prop.store(out,null);//store - the application raises the exception here

[750 byte] By [HenriqueSa] at [2007-11-27 9:48:32]
# 1
Are all the keys and values in that hash table of type String?
BigDaddyLoveHandlesa at 2007-7-13 0:17:03 > top of Java-index,Java Essentials,Java Programming...
# 2

I checked the constants and they seem to resolve to Strings but you can see clearly that there are two values of Integer....is this the problem? How can I work around this?

config.put(MQC.HOST_NAME_PROPERTY, defaults.getString("mqhost"));

config.put(MQC.CHANNEL_PROPERTY, defaults.getString("mqchannel"));

config.put(MQC.PORT_PROPERTY, new Integer(defaults.getString("mqport")));

config.put("mqcharset", new Integer(defaults.getString("mqcharset")));

config.put("mqcharlength", new Integer(defaults.getString("mqcharlength")));

config.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES);

HenriqueSa at 2007-7-13 0:17:03 > top of Java-index,Java Essentials,Java Programming...
# 3

void putAll(Properties p, Map < Object, Object > map) {

for( Map.Entry < Object, Object > e : map.entrySet()) {

p.setProperty(e.getKey().toString(), e.getValue().toString());

}

}

Or rewrite your map to be of type Map < String, String> and don't store integers!

BigDaddyLoveHandlesa at 2007-7-13 0:17:03 > top of Java-index,Java Essentials,Java Programming...
# 4
> Or rewrite your map to be of type Map < String,> String> and don't store integers!This is a better solution. Storing mixed types in a Map or Collection is almost always a bad idea.
jverda at 2007-7-13 0:17:03 > top of Java-index,Java Essentials,Java Programming...