tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Barnes <mark.bar...@coat.com>
Subject Re: Source for Packages org.apache.tomcat.dbcp and below?
Date Wed, 13 Sep 2006 12:04:21 GMT
Yoav Shapira wrote:
> Hi,
> One more thing:
> 
> 
> On 9/12/06, Mark Barnes <mark.barnes@coat.com> wrote:
>> I look at the current (1.2.1) DBCP source, and it looks like it cannot 
>> possibly
>> be what tomcat 5.5.17 is using.  If my code were to call the 1.2.1 
>> version of
>> method...
>>
>>      BasicDataSource.getConnection(String username, String password)
>>
>> ...I would expect to get an UnsupportedOperationException from class
>> PoolingDataSource.  It's not the outcome I would have hoped for, but 
>> at least it
>> makes it seem someone has at least noted the problem I am having and 
>> has written
>> a "fix" for it, of sorts, making the method unsupported.
> 
> No, you're misreading something here.  The JavaDocs on the web site
> are for the 1.2.2 (or 1.3, whatever the DBCP committers decided to
> call it) release.  They reflect changes made in SVN to throw these
> exceptions, probably in response to JIRA issue DBCP-36 which sounds
> similar to yours.  In DBCP 1.2.1, these methods do not throw
> UnsupportedOperationExceptions, nor are they documented to throw these
> exceptions.


Hi, Yoav -


I guess I really *am* confused now.

Below is the code from PoolingDataSource.java from the 1.2.1 source tree I 
downloaded.  I read the code for BasicDataSource method createDataSource(), and 
I can see that BasicDataSource delegates to a PoolingDataSource, whose method 
does indeed throw UnsupportedOperationException, as seen in the JavaDocs and in 
the code below:

     /**
      * Throws {@link UnsupportedOperationException}
      * @throws UnsupportedOperationException
      */
     public Connection getConnection(String uname, String passwd) throws 
SQLException {
         throw new UnsupportedOperationException();
     }


Here's the code for geConnection(String,String) from BasicDataSource.java:

     public Connection getConnection(String username, String password) throws 
SQLException {
         return createDataSource().getConnection(username, password);
     }



Here's the code for createDataSource() from BasicDataSource.java, where the 
delegate is created:

         // Create and return the pooling data source to manage the connections
         dataSource = new PoolingDataSource(connectionPool);


Maybe I'm missing somewhere in the DBCP source where the 
UnsupportedOperationException is caught and silently ignored???  I can't see it.

Or is it possible that the source I downloaded isn't really for release 1.2.1 
even though the download page says it is, and even though the name of the 
directory created when un-zipping has "1.2.1" in it.


---Mark

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


Mime
View raw message