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

NullPointerException when using escapeSql function

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.1, 4.0
    • Fix Version/s: 4.1, 6.0
    • Labels:
      None
    • Environment:

      openjdk 1.6.0 b12

      Description

      I have two entities defined, nested in each other..

      <entity name="article" query="select category, subcategory from articles">
      <entity name="other" query="select other from othertable where category='${dataimporter.functions.escapeSql(article.category)}'
      AND subcategory='${dataimporter.functions.escapeSql(article.subcategory)}'">
      </entity>
      </entity>

      Now, when I run that it bombs on any article where subcategory = '' (it's a NOT NULL column so empty string is there) If i do where subcategory!='' in the article query it works fine (aside from not pulling in all of the articles).

      org.apache.solr.handler.dataimport.DataImportHandlerException: java.lang.NullPointerException
      at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:424)
      at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:383)
      at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:242)
      at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:180)
      at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:331)
      at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:389)
      at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:370)
      Caused by: java.lang.NullPointerException
      at org.apache.solr.handler.dataimport.EvaluatorBag$1.evaluate(EvaluatorBag.java:75)
      at org.apache.solr.handler.dataimport.EvaluatorBag$5.get(EvaluatorBag.java:216)
      at org.apache.solr.handler.dataimport.EvaluatorBag$5.get(EvaluatorBag.java:204)
      at org.apache.solr.handler.dataimport.VariableResolverImpl.resolve(VariableResolverImpl.java:107)
      at org.apache.solr.handler.dataimport.TemplateString.fillTokens(TemplateString.java:81)
      at org.apache.solr.handler.dataimport.TemplateString.replaceTokens(TemplateString.java:75)
      at org.apache.solr.handler.dataimport.VariableResolverImpl.replaceTokens(VariableResolverImpl.java:87)
      at org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:71)
      at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:237)
      at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:357)
      ... 6 more

        Attachments

        1. SOLR-2141.patch
          13 kB
          James Dyer
        2. SOLR-2141.patch
          13 kB
          James Dyer
        3. SOLR-2141.patch
          13 kB
          James Dyer
        4. SOLR-2141.patch
          12 kB
          James Dyer
        5. SOLR-2141.patch
          5 kB
          Dominik Siebel
        6. SOLR-2141.patch
          5 kB
          Dominik Siebel
        7. SOLR-2141.b341f5b.patch
          3 kB
          Dominik Siebel
        8. SOLR-2141-test.patch
          1 kB
          Vadim Kirilchuk
        9. dih-file.xml
          0.1 kB
          Vadim Kirilchuk
        10. dih-config.xml
          0.4 kB
          Vadim Kirilchuk
        11. SOLR-2141-sample.patch
          68 kB
          Koji Sekiguchi

          Issue Links

            Activity

              People

              • Assignee:
                jdyer James Dyer
                Reporter:
                urkle Edward Rudd
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: