This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes PropertyResourceBundle.getStringArray() doesn't quite work as expected... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "PropertyResourceBundle.getStringArray() doesn Watch "PropertyResourceBundle.getStringArray() doesn New topic
Author

PropertyResourceBundle.getStringArray() doesn't quite work as expected...

SAFROLE YUTANI
Ranch Hand

Joined: Jul 06, 2001
Posts: 257
I have a property file that I read into a PropertyResourceBundle object like this....
PropertyResourceBundle resource = (PropertyResourceBundle)ResourceBundle.getBundle( "db");
I have an entry in the "db" property file that contains values which are comma delimited, like this...
arr=1,2,3
but when I call resource.getStringArray("arr"), I get a ClassCastException.
I want to get back a String array, which is the return type of getStringArray() anyway! I dont see what the problem is.
Any help would be appreciated!
SAF
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Is arr an array of Strings?

JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
SAFROLE YUTANI
Ranch Hand

Joined: Jul 06, 2001
Posts: 257
No. "arr" is an entry in the properties file. It doesn't matter at this point anyway because I managed to find a work around for it.
thanks
SAF
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: PropertyResourceBundle.getStringArray() doesn't quite work as expected...