Hi,
At the moment it looks like this:
if (value instanceof String)
{
return (String) value;
}
else if (value == null)
// some more code
I tried this and it seems to work for me:
if (value instanceof String)
{
return (String) value;
}
else if (value instanceof List)
{
String strValue = value.toString();
return strValue.substring (1,strValue.length()-1);
}
else if (value == null)
// some more code
~ Leon
----- Original Message -----
From: "Jon Stevens" <[EMAIL PROTECTED]>
To: "Turbine" <[EMAIL PROTECTED]>
Sent: Thursday, February 15, 2001 8:23 PM
Subject: Re: Configurations.java and getString()
> on 2/15/01 7:15 AM, "Leon Messerschmidt" <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> >
> > I ran into a little problem. If I add a string to the TR.properties
that
> > contains "," Configurations parses it as a Vector and I get a
> > ClassCastException if I call getString().
> >
> > Any objects to modify getString() to so that it returns strings with
","?
> >
> > I'm thinking about parsing the Vector.toString(). Something like this:
> >
> > String s = value.toString();
> > return s.substring (1,s.length()-1);
> >
> > ~ Leon
>
> Yea, I just noticed this as well the other day...the problem with doing
that
> is that there could be a case where you would want that Exception to be
> thrown...therefore, write your code like this:
>
> try
> {
> return getString()
> }
> catch (ClassCastException cce)
> {
> String s = getVector().toString();
> return s.substring (1,s.length()-1);
> }
>
> -jon
>
> --
> If you come from a Perl or PHP background, JSP is a way to take
> your pain to new levels. --Anonymous
> <http://jakarta.apache.org/velocity/> && <http://java.apache.org/turbine/>
>
>
>
> ------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
> Problems?: [EMAIL PROTECTED]
>
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]