java.io.IOException when trying to list terms in index (IndexReader)

2009-08-01 Thread ohaya
Hi, I'm starting to work on an app to list all of the terms in the "path" field. I'm including the beginning of my code below. When I run this, pointing it to a directory named "index" containing the Lucene indexes, I am getting a java.io.IOException. Here's the output when I run: Index in d

Re: java.io.IOException when trying to list terms in index (IndexReader)

2009-08-01 Thread Phil Whelan
Hi Jim, I cannot see anything obvious, but both open() and terms() throw IOException's. You could try putting these in separate try..catch blocks to see which one it's coming from. Or using e.printStackTrace() in the catch block will give more info to help you debug what's happening. On Sat, Aug

Re: java.io.IOException when trying to list terms in index (IndexReader)

2009-08-01 Thread ohaya
Phil, Yes, that exception is not very helpful :)!! I'll try your suggestions and post back. Thanks, Jim Phil Whelan wrote: > Hi Jim, > > I cannot see anything obvious, but both open() and terms() throw > IOException's. You could try putting these in separate try..catch > blocks to see

Re: java.io.IOException when trying to list terms in index (IndexReader)

2009-08-01 Thread ohaya
Phil, I posted in haste. Actually, from the output that I posted, doesn't it it look like the .next() itself is throwing the exception? That is what has been puzzling me. It looks like it got through the open() and terms() with no problem, then it blew up when calling the next()? Jim

Re: java.io.IOException when trying to list terms in index (IndexReader)

2009-08-01 Thread ohaya
Hi, BTW, the next() method is an abstract method in the Javadocs. Does that mean that I'm suppose to have my own implementation? Jim oh...@cox.net wrote: > Phil, > > I posted in haste. Actually, from the output that I posted, doesn't it it > look like the .next() itself is throwing t

Re: java.io.IOException when trying to list terms in index (IndexReader)

2009-08-01 Thread ohaya
Hi, I changed the beginning of the try to: try { System.out.println("About to call .next()..."); boolean foo = termsEnumerator.next(); System.out.println("Finished calling first .next()");

Re: java.io.IOException when trying to list terms in index (IndexReader)

2009-08-01 Thread ohaya
Hi, I don't know what happened, but all of a sudden, it started working :(... Jim oh...@cox.net wrote: > Hi, > > I changed the beginning of the try to: > > try { > System.out.println("About to call .next()..."); > boolean foo = t

Re: java.io.IOException when trying to list terms in index (IndexReader)

2009-08-02 Thread se3g2011
hi,as you the error messages you listed below,pls put the 'reader.close()' block to the bottom of method. i think,if you invoke it first,the infrastructure stream is closed ,so exceptions is encountered. ohaya wrote: > > Hi, > > I changed the beginning of the try to: > > try { >

Re: java.io.IOException when trying to list terms in index (IndexReader)

2009-08-02 Thread ohaya
Hi, I thought that, in the code that I posted, there was a close() in the finally? Or, are you saying that when an IndexReader is opened, that that somehow persists in the system, even past my Java app terminating? FYI, I'm doing this testing on Windows, under Eclipse... Jim se3g2011

Re: java.io.IOException when trying to list terms in index (IndexReader)

2009-08-02 Thread Erick Erickson
I've seen Eclipse get into weird states, but I don't think that's your problem. You open the IndexReader and set up a TermEnum on it. Then, no matter what you close the underlying IndexReader in the finally block. Then later you use the TermEnum *even though the underlying reader has been closed*.

Re: java.io.IOException when trying to list terms in index (IndexReader)

2009-08-02 Thread ohaya
Erick, It's working now (I removed the finally, and put the close() elsewhere). Thanks for the explanation. Jim Erick Erickson wrote: > I've seen Eclipse get into weird states, but I don't think that's your > problem. > > You open the IndexReader and set up a TermEnum on it. Then, no