Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-3616

Illegal Field Configurations should throw exceptions

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 4.0-ALPHA
    • None
    • None
    • None
    • New

    Description

      When working on LUCENE-3615, I came across:

      java.lang.IllegalArgumentException: field field is stored but does not have binaryValue, stringValue nor numericValue
      at org.apache.lucene.index.codecs.DefaultStoredFieldsWriter.writeField(DefaultStoredFieldsWriter.java:177)
      at org.apache.lucene.index.StoredFieldsConsumer.finishDocument(StoredFieldsConsumer.java:119)
      at org.apache.lucene.index.DocFieldProcessor.finishDocument(DocFieldProcessor.java:295)
      at org.apache.lucene.index.DocumentsWriterPerThread.updateDocument(DocumentsWriterPerThread.java:255)
      at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:380)
      at org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:1480)
      at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1242)
      at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1223)
      at org.apache.lucene.index.Test2BTerms.test2BTerms(Test2BTerms.java:194)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
      at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:48)
      at org.apache.lucene.util.LuceneTestCase$3$1.evaluate(LuceneTestCase.java:525)
      at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
      at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
      at org.apache.lucene.util.LuceneTestCaseRunner.runChild(LuceneTestCaseRunner.java:168)
      at org.apache.lucene.util.LuceneTestCaseRunner.runChild(LuceneTestCaseRunner.java:47)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
      at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
      at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
      at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
      at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:71)
      at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:199)
      at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:62)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

      which is due to the using Textfield.TYPE_STORED when using a TokenStream. Since this is an illegal combination, we should throw an exception upon construction of the Field, not later when actually trying to do the indexing.

      Attachments

        1. LUCENE-3616.patch
          35 kB
          Robert Muir

        Activity

          People

            mikemccand Michael McCandless
            gsingers Grant Ingersoll
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: