You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by dl...@apache.org on 2001/04/10 01:38:15 UTC
cvs commit: jakarta-turbine/src/java/org/apache/turbine/services TurbineServices.java
dlr 01/04/09 16:38:15
Modified: src/java/org/apache/turbine/services TurbineServices.java
Log:
Don't go spraying ClassCastExceptions every which where. Conformed
getProperties(String) to documented behavior, and suggested the
currently recommended alternative.
Revision Changes Path
1.26 +18 -9 jakarta-turbine/src/java/org/apache/turbine/services/TurbineServices.java
Index: TurbineServices.java
===================================================================
RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/TurbineServices.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- TurbineServices.java 2001/03/25 23:04:53 1.25
+++ TurbineServices.java 2001/04/09 23:38:14 1.26
@@ -75,7 +75,7 @@
* @author <a href="mailto:burton@apache.org">Kevin Burton</a>
* @author <a href="mailto:krzewski@e-point.pl">Rafal Krzewski</a>
* @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
- * @version $Id: TurbineServices.java,v 1.25 2001/03/25 23:04:53 jvanzyl Exp $
+ * @version $Id: TurbineServices.java,v 1.26 2001/04/09 23:38:14 dlr Exp $
*/
public class TurbineServices
extends BaseServiceBroker
@@ -252,7 +252,7 @@
*
* <br>
*
- * services.MyService.greeting=Hello, I'm Jan B.
+ * services.MyService.greeting=Hello\, I'm Jan B.
*
* <br>
*
@@ -264,12 +264,11 @@
* "greeting" = "Hello, I'm Jan B." and "defaultAction" = "beep".
*
* <p> Note that this way you will receive a 'collapsed' version
- * of your resouruces - multiple entries with the same key will
- * be sqished into one entry and all but one values will be lost.
- * You should use {@link #getResources} method to take advantage
- * of the capabilities of
- * {@link org.apache.turbine.services.resources.TurbineResources}
- * class <br>
+ * of your resources - multiple entries with the same key will
+ * have only one value stored. Use the {@link #getConfiguration}
+ * or {@link #getResources} method to take advantage of the capabilities
+ * of the {@link org.apache.turbine.services.resources.TurbineResources}
+ * class.
*
* @param name The name of the service.
* @return Properties of requested Service.
@@ -283,7 +282,17 @@
while(keys.hasNext())
{
String key = (String)keys.next();
- properties.put(key.substring(pref), TurbineResources.getString(key));
+ String value;
+ try
+ {
+ value = TurbineResources.getString(key);
+ }
+ catch (ClassCastException propIsArray)
+ {
+ String[] values = TurbineResources.getStringArray(key);
+ value = values[values.length - 1];
+ }
+ properties.setProperty(key.substring(pref), value);
}
return properties;
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org