tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: svn commit: r1131263 - in /tomcat/trunk: java/org/apache/catalina/session/JDBCStore.java java/org/apache/catalina/session/LocalStrings.properties webapps/docs/changelog.xml webapps/docs/config/manager.xml
Date Fri, 03 Jun 2011 22:44:08 GMT
On 03/06/2011 23:41, Tim Funk wrote:
> If NamingExceptionOccurs - should this instead rethrow a SqlException
> instead of letting the logic keep going? Otherwise wouldn't a SqlException
> be thrown later in the method?

Don't think so. If the lookup is invalid dataSource will be null so it
should fall back to using the non-pooled settings (which may also fail)

Mark

> 
> -Tim
> 
> On Fri, Jun 3, 2011 at 6:13 PM, <markt@apache.org> wrote:
> 
>> Author: markt
>> Date: Fri Jun  3 22:13:09 2011
>> New Revision: 1131263
>>
>> URL: http://svn.apache.org/viewvc?rev=1131263&view=rev
>> Log:
>> Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51264
>> Allow the JDBC persistent session store to use a JNDI datasource to define
>> the database in which sessions are persisted.
>> Patch provided by Felix Schumacher.
>>
>> Modified:
>>    tomcat/trunk/java/org/apache/catalina/session/JDBCStore.java
>>    tomcat/trunk/java/org/apache/catalina/session/LocalStrings.properties
>>    tomcat/trunk/webapps/docs/changelog.xml
>>    tomcat/trunk/webapps/docs/config/manager.xml
>>
>> Modified: tomcat/trunk/java/org/apache/catalina/session/JDBCStore.java
>> URL:
>> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/JDBCStore.java?rev=1131263&r1=1131262&r2=1131263&view=diff
>>
>> ==============================================================================
>> --- tomcat/trunk/java/org/apache/catalina/session/JDBCStore.java (original)
>> +++ tomcat/trunk/java/org/apache/catalina/session/JDBCStore.java Fri Jun  3
>> 22:13:09 2011
>> @@ -866,6 +902,24 @@ public class JDBCStore extends StoreBase
>>         if (dbConnection != null)
>>             return (dbConnection);
>>
>> +        if (dataSourceName != null && dataSource == null) {
>> +            Context initCtx;
>> +            try {
>> +                initCtx = new InitialContext();
>> +                Context envCtx = (Context)
>> initCtx.lookup("java:comp/env");
>> +                this.dataSource = (DataSource)
>> envCtx.lookup(this.dataSourceName);
>> +            } catch (NamingException e) {
>> +                manager.getContainer().getLogger().error(
>> +                        sm.getString(getStoreName() + ".wrongDataSource",
>> +                                this.dataSourceName), e);
>> +           }
>> +        }
>> +
>> +        if (dataSource != null) {
>> +            dbConnection = dataSource.getConnection();
>> +            return dbConnection;
>> +        }
>> +
>>
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message