lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject RE: New "Stream closed" exception with Java 6
Date Tue, 15 Sep 2009 17:37:27 GMT
: "it's possibly you just have a simple bug where you are  closing the reader before you pass
it to Lucene, 
: 
:       or maybe you are mistakenly adding the same field twice
: 
: (or in two different documents)"
: 
: Are you saying that if I were attempting to delete a doc and then add it 
: again (e.g. update), but for some reason the delete didn't work, I would 
: get a "Stream closed" exception?

Uh... no.  I didn't say anything about delets, or updates.  I'm talking 
about the java.io.Reader class.  AS i recall (not looking at it right now) 
Your stack trace showed that when lucene tried to access a an 
InputStreamReader from a Field in your document it was already closed.  
that could happen if you did something like this...

   File myFileOnDisk = new File(path);
   Reader fileContents = new InputStreamReader(new FileInputStream(myFileOnDisk));
   fileContents.close();
   doc.addField(new Field("field name", fileContents));

...but there are lots of other ways it could happen too, it's impossible 
to list all the ways it might happen without knowing where exactly that 
InputStreamReader is coming from, and where the underlying INputStream 
is coming from, and what code has refrences to either of them between the 
time it's created and the time Lucene finally attempts to read from it.

: careful about your assumptions ... you could get this same type of 
: exception even with only one thread, the stream that's being closed isn't 
: internal to Lucene, it's the InputStreamReader you supplied as the value 
: of some Field.  it's possibly you just have a simple bug where you are 
: closing hte reader before you pass it to Lucene, or maybe you are 
: mistakenly adding the saame field twice (or in two different documents)



-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message