Hi
I' am writing some code to keep authorization and authentication in LDAP
server.
In order to do this, I user TurbineDirectoryService to obtaint JNDI
context.
To create such context I need some parameters to read from INI file
The same problem was found by Mr. Youngho Cho
( Subject: Question on Configurations.java in turbine package ,
Date: Wed, 15 Mar 2000 19:21:55 -0800 )
What we need is to put the following values like bellow in INI file
************
services.TurbineNamingService.classname=org.apache.turbine.services.naming.T
urbineNamingService
context.ldap.java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
context.ldap.java.naming.provider.url=ldap://winnie:389
context.ldap.java.naming.security.principal=CN=Administrator, CN=Users,
DC=dev, DC=interdesign, DC=com, DC=pl
************
^ ^ the "," char cause problem !!!
The problem is in last line.
When we try to use TurbineNamingService then init() method is called and the
Exception is rised in
line 121: contextProps.put(key.substring(end + 1),
line 122: TurbineResources.getString(key));
Simpy stated, TurbineResources.getString(key) not work because it found
Vector object in collection.
The identical code is found in InitContextsAction.java.
There are two solution.
1. Modify both places to check types of object in Turbine resources
collection ( I think it is not a way for a future )
2. Change TurbineResources.getString to perform a conversion to a string
Bellow is a new version of org.apache.java.util.getString() ( called from
TurbineResources.getString )
***************************************************************
public String getString(String key, String defaultValue) {
Object value = repository.get(key);
if (value instanceof String) {
return (String) value;
// >> new code
} else if (value instanceof Vector) {
String sv = value.toString();
// remove array parenthesis
return sv.substring(1, sv.length() - 1);
// << end of new code
} else if (value == null) {
if (defaults != null) {
return defaults.getString(key, defaultValue);
} else {
return defaultValue;
}
} else {
throw new ClassCastException(key
+ " doesn't map to a String object"); // here shoud be
...... to a String/Vector ...............
}
}
**************************************************************
Nearly identical conversion is performed in
org.apache.java.util.getStringArray(String key)
When we request StringArray and there is only string inside, we change it to
a one element array.
I don't have rights to perform necessary changes.
Could someone do it, please.
Best regards
Grzegorz Czuba
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]