[ 
https://issues.apache.org/jira/browse/SOLR-4920?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14188359#comment-14188359
 ] 

Mikhail Khludnev commented on SOLR-4920:
----------------------------------------

I face usability issue with  

{code:title=JdbcDataSource.java}
141     try {
142     c = DriverManager.getConnection(url, initProps);
143     } catch (SQLException e) {
144     // DriverManager does not allow you to use a driver which is not loaded 
through
145     // the class loader of the class which is trying to make the connection.
146     // This is a workaround for cases where the user puts the driver jar in 
the
147     // solr.home/lib or solr.home/core/lib directories.
148     Driver d = (Driver) DocBuilder.loadClass(driver, 
context.getSolrCore()).newInstance();
149     c = d.connect(url, initProps);
150     }
{code}

if I supply weird url, I've got SQLException, it's caught, then it calls c = 
d.connect(url, initProps); which returns null (which is pretty valid giving the 
javadoc). Then I have NPE where the connection is hit. There is no anything 
about SQLException reasons in the log. Isn't it worth to raise an issue? 


> DIH JdbcDataSource exception handling
> -------------------------------------
>
>                 Key: SOLR-4920
>                 URL: https://issues.apache.org/jira/browse/SOLR-4920
>             Project: Solr
>          Issue Type: Bug
>          Components: contrib - DataImportHandler
>    Affects Versions: 4.3, Trunk
>            Reporter: Chris Eldredge
>            Assignee: Shalin Shekhar Mangar
>            Priority: Minor
>             Fix For: 4.4
>
>         Attachments: patch.diff
>
>
> JdbcDataSource will incorrectly suppress exceptions when retrieving a 
> connection from a JNDI context and fall back to trying to use DriverManager 
> to obtain a connection. This makes it impossible to troubleshoot 
> misconfigured JNDI DataSource.
> Additionally, when a SQLException is thrown while initializing a connection, 
> such as in setAutoCommit(), the connection will not be closed. This can cause 
> a resource leak.
> A patch will be attached with unit tests that addresses both issues.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to