You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2008/11/26 08:25:57 UTC

DO NOT REPLY [Bug 46298] New: JDBCRealm.open() throws NullPointerException if the specified driver doesn't handle the specified JDBC URL

https://issues.apache.org/bugzilla/show_bug.cgi?id=46298

           Summary: JDBCRealm.open() throws NullPointerException if the
                    specified driver doesn't handle the specified JDBC URL
           Product: Tomcat 6
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: owen.jacobson@grimoire.ca


Created an attachment (id=22949)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22949)
Check returned connection for null in JDBCRealm.open()

Per the Driver.connect(String, Properties) docs:

> The driver should return "null" if it realizes it is the wrong kind of driver to connect to the given URL.

I ran into this when I fat-fingered the JDBC URL's prefix (jdbc:msql: instead
of jdbc:mysql: with the MySQL driver).  The offending code calls Driver.connect
and immediately calls setAutoCommit(false) on the resulting driver without
checking that the connect returned a connection.

I've attached a patch based from TOMCAT_6_0_18 that addresses the issue.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 46298] JDBCRealm.open() throws NullPointerException if the specified driver doesn't handle the specified JDBC URL

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46298





--- Comment #2 from Owen Jacobson <ow...@grimoire.ca>  2008-12-28 17:06:48 PST ---
Thanks for catching the typo in the patch! Clearly, I fat-finger a lot of
things.  I18n is also a nice touch.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 46298] JDBCRealm.open() throws NullPointerException if the specified driver doesn't handle the specified JDBC URL

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46298


Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #3 from Mark Thomas <ma...@apache.org>  2009-01-14 15:58:50 PST ---
This has been fixed in 6.0.x and will be included in 6.0.19 onwards.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 46298] JDBCRealm.open() throws NullPointerException if the specified driver doesn't handle the specified JDBC URL

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46298





--- Comment #1 from Mark Thomas <ma...@apache.org>  2008-12-28 15:49:35 PST ---
Thanks for the patch. I have applied a variation to trunk and will propose it
for 6.0.x
The changes I made were:
- test dbConnection for null rather than driver (which is always non-null)
- use the StringManager to provide i18n for the exception message


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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