tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Funk <funk...@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:41:23 GMT
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?

-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;
> +        }
> +
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message