public void testNullStoredField() throws Exception {
  Directory dir=newDirectory();
  Analyzer analyzer=new MockAnalyzer(random());
  IndexWriter iw=new IndexWriter(dir,new IndexWriterConfig(analyzer));
  Document doc=new Document();
  iw.addDocument(doc);
  expectThrows(IllegalArgumentException.class,null);
  assertNull(iw.getTragicException());
  iw.close();
  DirectoryReader r=DirectoryReader.open(dir);
  assertEquals(1,r.numDocs());
  r.close();
  dir.close();
}

public void testNullStoredField ( ) throws Exception { Directory dir = newDirectory ( ) ; Analyzer analyzer = new MockAnalyzer ( random ( ) ) ; IndexWriter iw = new IndexWriter ( dir , new IndexWriterConfig ( analyzer ) ) ; Document doc = new Document ( ) ; iw . addDocument ( doc ) ; expectThrows ( IllegalArgumentException . class , null ) ; assertNull ( iw . getTragicException ( ) ) ; iw . close ( ) ; DirectoryReader r = DirectoryReader . open ( dir ) ; assertEquals ( 1 , r . numDocs ( ) ) ; r . close ( ) ; dir . close ( ) ; }
test a null string value doesn ' t abort the entire segment
