You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Jim Ferenczi (JIRA)" <ji...@apache.org> on 2018/08/01 08:14:00 UTC
[jira] [Commented] (LUCENE-8441) Wrong index sort field type throws
unexpected NullPointerException
[ https://issues.apache.org/jira/browse/LUCENE-8441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16564933#comment-16564933 ]
Jim Ferenczi commented on LUCENE-8441:
--------------------------------------
Ouch, thanks [~mikemccand] ! I attached a patch that fixes the NPE on abort (a null check was missing) and validates the doc value type for the sort field when a document is added. Adding a doc value of the wrong type will now throw an exception when the document is indexed instead of failing at commit time.
> Wrong index sort field type throws unexpected NullPointerException
> ------------------------------------------------------------------
>
> Key: LUCENE-8441
> URL: https://issues.apache.org/jira/browse/LUCENE-8441
> Project: Lucene - Core
> Issue Type: Bug
> Components: core/index
> Reporter: Michael McCandless
> Assignee: Michael McCandless
> Priority: Minor
> Attachments: LUCENE-8441.patch, LUCENE-8441.patch
>
>
> I came across this scary exception if you pass the wrong {{SortField.Type}} for a field; I'll attach patch w/ small test case:
> {noformat}
> 1) testWrongSortFieldType(org.apache.lucene.index.TestIndexSorting)
> java.lang.NullPointerException
> at __randomizedtesting.SeedInfo.seed([995FF58C7B184E8F:B0CC507647B2ED95]:0)
> at org.apache.lucene.index.SortingTermVectorsConsumer.abort(SortingTermVectorsConsumer.java:87)
> at org.apache.lucene.index.TermsHash.abort(TermsHash.java:68)
> at org.apache.lucene.index.DefaultIndexingChain.abort(DefaultIndexingChain.java:332)
> at org.apache.lucene.index.DocumentsWriterPerThread.abort(DocumentsWriterPerThread.java:138)
> at org.apache.lucene.index.DocumentsWriterPerThread.maybeAbort(DocumentsWriterPerThread.java:532)
> at org.apache.lucene.index.DocumentsWriterPerThread.flush(DocumentsWriterPerThread.java:524)
> at org.apache.lucene.index.DocumentsWriter.doFlush(DocumentsWriter.java:554)
> at org.apache.lucene.index.DocumentsWriter.flushAllThreads(DocumentsWriter.java:719)
> at org.apache.lucene.index.IndexWriter.prepareCommitInternal(IndexWriter.java:3201)
> at org.apache.lucene.index.IndexWriter.commitInternal(IndexWriter.java:3446)
> at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:3411)
> at org.apache.lucene.index.TestIndexSorting.testWrongSortFieldType(TestIndexSorting.java:2489)
> {noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org