Hi Glenn - No, my version is not very new at all. So my personal properties include in TR.p must be before the include of JR.p?
Josh Hone >From: Glenn Golden <[EMAIL PROTECTED]> >Reply-To: "Jetspeed Users List" <[EMAIL PROTECTED]> >To: 'Jetspeed Users List' <[EMAIL PROTECTED]> >Subject: RE: JR.prop duplicate booleans break... >Date: Wed, 18 Sep 2002 08:25:24 -0400 > >Josh - > >I just recently fixed this for Jetspeed properties (properties aimed at >Turbine may not be done in this way), so that you can override the jr.p >values in your own resources.properties. Make sure your values come >*first*. The first setting will be used. > >Are you using the latest code from cvs? > >If you are running with this fix already in, let me know and I'll look into >it further. > >Thanks! > >Here's the cvs message from that checkin: > >* * * * * * * * * * * * * * * > >ggolden 2002/09/09 19:01:27 > > Modified: src/java/org/apache/jetspeed/services/resources > JetspeedResources.java > Log: > When overriding settings in the JetspeedResources.properties (and >TurbineResources.properties), we might want to set a value with our > site's setting, a value that is also set in the standard jr.p and tr.p >distribution files. It's nice to be able to use these files unchanged so >we >can keep up easily > with Jetspeed development. > > If the value we are setting is a string, this already works - the first >value set to > the property is used, so we can just do our settings before the standard >files > are read in. > > If the value we are setting is a boolean, long, float, double, or int, >this doesn't work - we get class cast exceptions. > > JetspeedSecurity, which is used by Jetspeed code to access the >configuration values, now catches these class cast exceptions, and also >takes the calls to getString. If there's an array of values, it will use >the first one (it's the combination of the array of values that mess up the >reading without this). > > Note: this only works for Jetspeed properties - turbine properties don't >use this > code. Only string properties can be overridden by setting your site >values first > for turbine properties. > > Note: This code would be best deep inside turbine, but can live here >till >Turbine > handles these cases. > > Revision Changes Path > 1.13 +322 -2 >jakarta-jetspeed/src/java/org/apache/jetspeed/services/resources/JetspeedRes >ources.java > > Index: JetspeedResources.java > =================================================================== > RCS file: >/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/resources/J >etspeedResources.java,v > retrieving revision 1.12 > retrieving revision 1.13 > diff -u -r1.12 -r1.13 > --- JetspeedResources.java 26 Jul 2002 01:47:21 -0000 1.12 > +++ JetspeedResources.java 10 Sep 2002 02:01:27 -0000 1.13 > @@ -55,16 +55,22 @@ > package org.apache.jetspeed.services.resources; > > import org.apache.turbine.services.resources.TurbineResources; > +import org.apache.turbine.util.Log; > > /** > * This class defines the Jetspeed properties keys. > * All properties can be retrieved using TurbineResources or >JetspeedResources > - * directly > + * directly. > + * > + * This class also overrides the covers for many of the get routines. >It >handles the cases > + * where we want a single value, perhaps as a boolean or float, but the >configuration may have > + * an array of values. In these cases, we let the first value override >all the others and use it. > * > * @author <a href="mailto:[EMAIL PROTECTED]">Kevin A. Burton</a> > * @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a> > * @author <a href="mailto:[EMAIL PROTECTED]">Tom Adams</a> > * @author <a href="mailto:[EMAIL PROTECTED]">Chris Kimpton</a> > + * @author <a href="mailto:[EMAIL PROTECTED]">Glenn R. Golden</a> > * @version $Id$ > */ > public class JetspeedResources extends TurbineResources { > @@ -156,7 +162,321 @@ > */ > public static final String PATH_PANEL_KEY = "select-panel"; > > + /** > + * The purpose of this method is to get the configuration resource > + * with the given name as a boolean value. > + * > + * @param name The resource name. > + * @return The value of the named resource as a boolean. > + */ > + public static boolean getBoolean(String name) > + { > + try > + { > + return TurbineResources.getBoolean (name); > + } > + catch (ClassCastException e) > + { > + // get the possible list > + String[] values = getStringArray(name); > + > + // try again with the first > + if ((values != null) && (values.length > 0)) > + return new Boolean(values[0]).booleanValue(); > + > + // otherwise, just throw the exception > + throw e; > + } > + } > + > + /** > + * The purppose of this method is to get the configuration > + * resource with the given name as a boolean value, or a default > + * value. > + * > + * @param name The resource name. > + * @param def The default value of the resource. > + * @return The value of the named resource as a boolean. > + */ > + public static boolean getBoolean(String name, > + boolean def) > + { > + try > + { > + return TurbineResources.getBoolean(name, def); > + } > + catch (ClassCastException e) > + { > + // get the possible list > + String[] values = getStringArray(name); > + > + // try again with the first > + if ((values != null) && (values.length > 0)) > + return new Boolean(values[0]).booleanValue(); > + > + // otherwise, just throw the exception > + throw e; > + } > + } > + > + /** > + * The purpose of this method is to get the configuration resource > + * with the given name as a double. > + * > + * @param name The resoource name. > + * @return The value of the named resource as double. > + */ > + public static double getDouble(String name) > + { > + try > + { > + return TurbineResources.getDouble(name); > + } > + catch (ClassCastException e) > + { > + // get the possible list > + String[] values = getStringArray(name); > + > + // try again with the first > + if ((values != null) && (values.length > 0)) > + return Double.parseDouble(values[0]); > + > + // otherwise, just throw the exception > + throw e; > + } > + } > + > + /** > + * The purpose of this method is to get the configuration resource > + * with the given name as a double, or a default value. > + * > + * @param name The resource name. > + * @param def The default value of the resource. > + * @return The value of the named resource as a double. > + */ > + public static double getDouble(String name, > + double def) > + { > + try > + { > + return TurbineResources.getDouble(name, def); > + } > + catch (ClassCastException e) > + { > + // get the possible list > + String[] values = getStringArray(name); > + > + // try again with the first > + if ((values != null) && (values.length > 0)) > + return Double.parseDouble(values[0]); > + > + // otherwise, just throw the exception > + throw e; > + } > + } > + > + /** > + * The purpose of this method is to get the configuration resource > + * with the given name as a float. > + * > + * @param name The resource name. > + * @return The value of the resource as a float. > + */ > + public static float getFloat(String name) > + { > + try > + { > + return TurbineResources.getFloat(name); > + } > + catch (ClassCastException e) > + { > + // get the possible list > + String[] values = getStringArray(name); > + > + // try again with the first > + if ((values != null) && (values.length > 0)) > + return Float.parseFloat(values[0]); > + > + // otherwise, just throw the exception > + throw e; > + } > + } > + > + /** > + * The purpose of this method is to get the configuration resource > + * with the given name as a float, or a default value. > + * > + * @param name The resource name. > + * @param def The default value of the resource. > + * @return The value of the resource as a float. > + */ > + public static float getFloat(String name, > + float def) > + { > + try > + { > + return TurbineResources.getFloat(name, def); > + } > + catch (ClassCastException e) > + { > + // get the possible list > + String[] values = getStringArray(name); > + > + // try again with the first > + if ((values != null) && (values.length > 0)) > + return Float.parseFloat(values[0]); > + > + // otherwise, just throw the exception > + throw e; > + } > + } > + > + /** > + * The purpose of this method is to get the configuration resource > + * with the given name as an integer. > + * > + * @param name The resource name. > + * @return The value of the resource as an integer. > + */ > + public static int getInt(String name) > + { > + try > + { > + return TurbineResources.getInt(name); > + } > + catch (ClassCastException e) > + { > + // get the possible list > + String[] values = getStringArray(name); > + > + // try again with the first > + if ((values != null) && (values.length > 0)) > + return Integer.parseInt(values[0]); > + > + // otherwise, just throw the exception > + throw e; > + } > + } > + > + /** > + * The purpose of this method is to get the configuration resource > + * with the given name as an integer, or a default value. > + * > + * @param name The resource name. > + * @param def The default value of the resource. > + * @return The value of the resource as an integer. > + */ > + public static int getInt(String name, > + int def) > + { > + try > + { > + return TurbineResources.getInt(name, def); > + } > + catch (ClassCastException e) > + { > + // get the possible list > + String[] values = getStringArray(name); > + > + // try again with the first > + if ((values != null) && (values.length > 0)) > + return Integer.parseInt(values[0]); > + > + // otherwise, just throw the exception > + throw e; > + } > + } > + > + /** > + * The purpose of this method is to get the configuration resource > + * with the given name as a long. > + * > + * @param name The resource name. > + * @return The value of the resource as a long. > + */ > + public static long getLong(String name) > + { > + try > + { > + return TurbineResources.getLong(name); > + } > + catch (ClassCastException e) > + { > + // get the possible list > + String[] values = getStringArray(name); > + > + // try again with the first > + if ((values != null) && (values.length > 0)) > + return Long.parseLong(values[0]); > + > + // otherwise, just throw the exception > + throw e; > + } > + } > + > + /** > + * The purpose of this method is to get the configuration resource > + * with the given name as a long, or a default value. > + * > + * @param name The resource name. > + * @param def The default value of the resource. > + * @return The value of the resource as a long. > + */ > + public static long getLong(String name, > + long def) > + { > + try > + { > + return TurbineResources.getLong(name, def); > + } > + catch (ClassCastException e) > + { > + // get the possible list > + String[] values = getStringArray(name); > + > + // try again with the first > + if ((values != null) && (values.length > 0)) > + return Long.parseLong(values[0]); > + > + // otherwise, just throw the exception > + throw e; > + } > + } > > + /** > + * The purpose of this method is to get the configuration resource > + * with the given name as a string. > + * > + * @param name The resource name. > + * @return The value of the resource as a string. > + */ > + public static String getString(String name) > + { > + // get the possible list > + String[] values = getStringArray(name); > + if ((values != null) && (values.length > 0)) > + return values[0]; > > + return TurbineResources.getString(name); > + } > > + /** > + * The purpose of this method is to get the configuration resource > + * with the given name as a string, or a default value. > + * > + * @param name The resource name. > + * @param def The default value of the resource. > + * @return The value of the resource as a string. > + */ > + public static String getString(String name, > + String def) > + { > + // get the possible list > + String[] values = getStringArray(name); > + if ((values != null) && (values.length > 0)) > + return values[0]; > + > + return TurbineResources.getString(name, def); > + } > } > + > > > > >-- >To unsubscribe, e-mail: ><mailto:[EMAIL PROTECTED]> >For additional commands, e-mail: ><mailto:[EMAIL PROTECTED]> > > > > -----Original Message----- > > From: Josh Hone [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, September 17, 2002 9:58 PM > > To: [EMAIL PROTECTED] > > Subject: JR.prop duplicate booleans break... > > > > > > Hi all - > > > > I have noticed that if I have duplicate boolean values for > > some properties > > that the machine gives you a horrible exception and does not > > like it at all. > > It says that the value assigned to the property is not > > boolean. Here is > > what I did: > > > > I copied some properties from JR.p to my own properties > > files. Then I > > edited some (for the email config) and restarted everything. > > Upon opening > > the portal, I encountered the horrible exception for a > > property that was > > duplicated in both properties files. It was the same both places. I > > commented it out and restarted everything. This time I was > > able to log in > > but again received a Horrible Exception, pointing to a > > property that I did > > alter. Both times the error message was the same. > > > > The issue was resolved as I removed the duplicate areas. I > > deleted the ones > > I changed in my personal file from JR.p. I also deleted the > > ones I did not > > change from my personal file. Then the system works fine (I > > just have to > > get out of the firewall...). > > > > Is this a bug? > > > > I am interested in this mainly because for an upgrade of a > > jetspeed system, > > it is much easier to maintain your own properties files. It > > gets much > > harder when you have to manually go into the default files to > > look for > > things to edit. Not harder for me personally, but for > > whoever after me > > looks after this portal. > > > > Josh Hone > > > > _________________________________________________________________ > > Chat with friends online, try MSN Messenger: http://messenger.msn.com > > > > > > -- > > To unsubscribe, e-mail: > > <mailto:jetspeed-user-> [EMAIL PROTECTED]> > > For > > additional commands, > > e-mail: <mailto:[EMAIL PROTECTED]> > > > >-- >To unsubscribe, e-mail: ><mailto:[EMAIL PROTECTED]> >For additional commands, e-mail: ><mailto:[EMAIL PROTECTED]> _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
