henning 2002/07/22 13:04:35
Modified: src/java/org/apache/turbine/services TurbineServices.java
Log:
...that check for class properties wasn't exactly the best possible
solution. Fixed so that only services.<servicename>.classname = <xxx>
is matched. (Also helps infiltrating the code with more commons stuff.)
Fixed a checkstyle error that Martin didn't see (Hah! :-) )
Revision Changes Path
1.6 +9 -3
jakarta-turbine-2/src/java/org/apache/turbine/services/TurbineServices.java
Index: TurbineServices.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/TurbineServices.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TurbineServices.java 11 Jul 2002 16:53:28 -0000 1.5
+++ TurbineServices.java 22 Jul 2002 20:04:35 -0000 1.6
@@ -61,6 +61,7 @@
import java.util.Vector;
import javax.servlet.ServletConfig;
import org.apache.commons.configuration.Configuration;
+import org.apache.commons.lang.StringUtils;
import org.apache.turbine.services.logging.LoggingService;
import org.apache.turbine.services.resources.ResourceService;
import org.apache.turbine.services.resources.TurbineResources;
@@ -260,13 +261,18 @@
while(keys.hasNext())
{
String key = (String)keys.next();
- if (key.startsWith(SERVICE_PREFIX) && key.endsWith(CLASSNAME_SUFFIX))
+ String [] keyParts = StringUtils.split(key, ".");
+ if ((keyParts.length == 3)
+ && keyParts[0].equals(SERVICE_PREFIX)
+ && keyParts[2].equals(CLASSNAME_SUFFIX))
{
- String serviceKey = key.substring(pref, key.length() - suff);
+ String serviceKey = keyParts[1];
notice ("Added Mapping for Service: " + serviceKey);
if (!mapping.containsKey(serviceKey))
+ {
mapping.setProperty(serviceKey,
TurbineResources.getString(key));
+ }
}
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>