lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ken Geis (JIRA)" <j...@apache.org>
Subject [jira] [Created] (SOLR-4446) exception swallowed, NPE created upon trouble getting JNDI connection
Date Tue, 12 Feb 2013 07:11:13 GMT
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


Mime
View raw message