You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Ken Geis (JIRA)" <ji...@apache.org> on 2013/02/12 08:11:13 UTC
[jira] [Created] (SOLR-4446) exception swallowed, NPE created upon
trouble getting JNDI connection
Ken Geis created SOLR-4446:
------------------------------
Summary: exception swallowed, NPE created upon trouble getting JNDI connection
Key: SOLR-4446
URL: https://issues.apache.org/jira/browse/SOLR-4446
Project: Solr
Issue Type: Bug
Components: contrib - DataImportHandler
Affects Versions: 4.1
Reporter: Ken Geis
I am trying to use a JNDI connection, but an error occurs getting the connection. The error is swallowed and obscured by a NullPointerException. See comments inline below.
{code:title=JdbcDataSource.java}
protected Callable<Connection> createConnectionFactory(final Context context,
final Properties initProps) {
...
final String jndiName = initProps.getProperty(JNDI_NAME);
final String url = initProps.getProperty(URL); /* is null */
final String driver = initProps.getProperty(DRIVER); /* is null */
...
return factory = new Callable<Connection>() {
@Override
public Connection call() throws Exception {
...
try {
if(url != null){
c = DriverManager.getConnection(url, initProps);
} else if(jndiName != null){
...
/* error occurs */
...
}
} catch (SQLException e) {
/* exception handler assumes that try block followed "url != null" path; in the JNDI case, driver is null, and DocBuilder.loadClass(..) throws a NPE */
Driver d = (Driver) DocBuilder.loadClass(driver, context.getSolrCore()).newInstance();
c = d.connect(url, initProps);
}
...
}
};
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org