Win a copy of Securing DevOps this week in the Security forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to use getStringArray of ResourceBundle  RSS feed

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to get the array of string from a property file using the
getStringArray of ResourceBundle class. But it is giving class cast Exception.
My property file looks like:

NVFORMS="GSLTW1NV","GSLTW1NV","GSLTW1NV","GSLTW1NV","GSLTW1NV","GSLTW1NV"
I also tried following formats. None of them worked.

NVFORMS= GSLTW1NV1 GSLTW1NV2 GSLTW1NV3
NVFORMS={"GSLTW1NV1", "GSLTW1NV2", "GSLTW1NV3"}

So if you have worked on this before successfully, please let me know.
(No speculations please )
Thanks in advance.
 
Ranch Hand
Posts: 118
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been looking around... I can't find much information on it. You can use this for now though:

[ July 09, 2004: Message edited by: Darin Niard ]
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Darin Niard wrote:I've been looking around... I can't find much information on it. You can use this for now though:

[ July 09, 2004: Message edited by: Darin Niard ]



thanks but did you try it , i mean where is your reference
 
Ranch Hand
Posts: 48
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

shareeef hiasat wrote:

Darin Niard wrote:I've been looking around... I can't find much information on it. You can use this for now though:

[ July 09, 2004: Message edited by: Darin Niard ]



thanks but did you try it , i mean where is your reference



This should work.
This is a general code.
rb.getString("NVFORMS").split(":"); is valid code.
But need to do the null check.

String[] s=null;
if(rb.getString("NVFORMS") !=null){
s = rb.getString("NVFORMS").split(":");
}


 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!