Okay, i will change String to StringBuilder in String s. On Tue, Sep 6, 2011 at 3:06 PM, Shawn Jiang <[email protected]> wrote:
> Hi Viola, > > a quick comment. > > On Tue, Sep 6, 2011 at 2:48 PM, <[email protected]> wrote: > >> Author: violalu >> Date: Tue Sep 6 06:48:50 2011 >> New Revision: 1165512 >> >> URL: http://svn.apache.org/viewvc?rev=1165512&view=rev >> Log: >> GERONIMO-6146 fix classcast exception when creating oracle rac datasource >> >> Modified: >> >> >> geronimo/server/branches/2.1/plugins/connector/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java >> >> Modified: >> geronimo/server/branches/2.1/plugins/connector/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java >> URL: >> http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/connector/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java?rev=1165512&r1=1165511&r2=1165512&view=diff >> >> ============================================================================== >> --- >> geronimo/server/branches/2.1/plugins/connector/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java >> (original) >> +++ >> geronimo/server/branches/2.1/plugins/connector/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java >> Tue Sep 6 06:48:50 2011 >> @@ -21,6 +21,7 @@ import java.lang.reflect.Constructor; >> import java.util.HashMap; >> import java.util.LinkedHashSet; >> import java.util.Map; >> +import java.util.Properties; >> >> import javax.resource.ResourceException; >> import javax.resource.spi.ManagedConnectionFactory; >> @@ -190,7 +191,24 @@ public class ManagedConnectionFactoryWra >> ClassLoader oldTCL = thread.getContextClassLoader(); >> thread.setContextClassLoader(classLoader); >> try { >> - delegate.setAttribute(name, value); >> + //Convert java.util.Properties to java.lang.String >> + if(value != null && value instanceof Properties){ >> + Properties ps = (Properties) value; >> + if (!ps.isEmpty()) { >> + String s = null; >> + for (Object o : ps.keySet()) { >> + String k = (String) o; >> + String v = >> ps.getProperty(k); >> + s = k + "=" + v + ","; >> > > You might want to use StringBuffer/StringBuilder here. > > >> + log.debug("Setting " + k + >> "=" + value); >> > > Above line could be deleted becuase you added a full string log message > below. > > + } >> + delegate.setAttribute(name, s); >> + log.debug("Setting " + name + " >> value " + s); >> + } >> + } else { >> + delegate.setAttribute(name, value); >> + log.debug("Setting " + name + " value " + value); >> + } >> } finally { >> thread.setContextClassLoader(oldTCL); >> } >> >> >> > > > -- > Shawn > -- viola Apache Geronimo
