Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-3791

SortedMapBackedCache.java throws NullPointerException

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 3.6.1, 4.0-BETA
    • 3.6.2, 4.0
    • None
    • Debian

    Description

      As datasource is a mysql via jdbc configured in the DIH. There are some sql statements in entities, that delivers NULL values in some fields.
      When this entities do have processor="CachedSqlEntityProcessor", a NullPointerException will be thrown. I Tried it on different machines, with different copies of the index.

      e.g.:
      <entity processor="CachedSqlEntityProcessor"
      name="locator_ids"
      query="
      SELECT l1.id AS l1id, l2.id AS l2id, l3.id AS l3id, l4.id AS l4id, l5.id AS l5id, l6.id AS l6id, l7.id AS l7id FROM locators l1
      LEFT JOIN locators l2 ON l1.parent_id = l2.id

      .... and so on delivers a result like:

      -------------------------------

      l1id l2id l3id l4id l5id l6id l7id

      -------------------------------

      21843 855 223 66 12 1 NULL

      -------------------------------

      The SortedMapBackedCache throws the NullPointer.
      Staktrace:
      java.lang.NullPointerException
      at java.util.TreeMap.getEntry(TreeMap.java:341)
      at java.util.TreeMap.get(TreeMap.java:272)
      at org.apache.solr.handler.dataimport.SortedMapBackedCache.add(SortedMapBackedCache.java:57)
      at org.apache.solr.handler.dataimport.DIHCacheSupport.populateCache(DIHCacheSupport.java:124)
      at org.apache.solr.handler.dataimport.DIHCacheSupport.getSimpleCacheData(DIHCacheSupport.java:199)
      at org.apache.solr.handler.dataimport.DIHCacheSupport.getCacheData(DIHCacheSupport.java:147)
      at org.apache.solr.handler.dataimport.EntityProcessorBase.getNext(EntityProcessorBase.java:132)
      at org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:75)
      at org.apache.solr.handler.dataimport.EntityProcessorWrapper.pullRow(EntityProcessorWrapper.java:330)
      at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:296)
      at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:683)

      I had to give an onError="continue" to the entity, in order to get the proper stacktrace. Leaving out the onError property (default=Abort) suppresses the stacktrace in EntityProcessorWrapper.java line 332

      The DIH version 3.5.0 is not affected, works fine for me

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            jdyer James Dyer
            steffenm Steffen Moelter
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment