Thomas SZADEL created SOLR-5123:
-----------------------------------

             Summary: NullPointerException on JdbcDataSource
                 Key: SOLR-5123
                 URL: https://issues.apache.org/jira/browse/SOLR-5123
             Project: Solr
          Issue Type: Bug
          Components: search
    Affects Versions: 4.3
         Environment: Linux
            Reporter: Thomas SZADEL
            Priority: Minor


We got an NPE with Solr 4.3 when getting a database connection (and JBoss fails 
to get connection)

Solr runs on an JBoss 7.1 et gets their connections from a JNDI call 
(connection is provided by JBoss).


Processing Document # 1
        at 
org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:71)
        at 
org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:253)
        at 
org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:210)
        at 
org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:38)
        at 
org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:59)
        at 
org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:73)
        at 
org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:243)
        at 
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:465)
        at 
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:404)
        ... 5 more
Caused by: java.lang.NullPointerException
        at 
org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:241)
        ... 12 more


In the code, the possible null value is not checked :
239      try {
240        Connection c = getConnection();
241        stmt = c.createStatement(ResultSet.TYPE_FORWARD_ONLY, 
ResultSet.CONCUR_READ_ONLY);

... maybe a check may be more safe :
if(c == null){
   throw new XXXException();
}

--
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-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to