dmitrys 2003/09/25 14:50:11 Modified: src/java/org/apache/lucene/store FSDirectory.java Log: Added a method used in test cases to determine if a file descriptor is closed. Added troubleshooting code (commented out) to help diagnose problems around openning and closing files. Revision Changes Path 1.21 +31 -0 jakarta-lucene/src/java/org/apache/lucene/store/FSDirectory.java Index: FSDirectory.java =================================================================== RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/store/FSDirectory.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- FSDirectory.java 29 May 2003 20:18:18 -0000 1.20 +++ FSDirectory.java 25 Sep 2003 21:50:11 -0000 1.21 @@ -381,10 +381,34 @@ final class FSInputStream extends InputStream { private class Descriptor extends RandomAccessFile { + /* DEBUG */ + //private String name; + /* DEBUG */ public long position; public Descriptor(File file, String mode) throws IOException { super(file, mode); + /* DEBUG */ + //name = file.toString(); + //debug_printInfo("OPEN"); + /* DEBUG */ } + + /* DEBUG */ + //public void close() throws IOException { + // debug_printInfo("CLOSE"); + // super.close(); + //} + // + //private void debug_printInfo(String op) { + // try { throw new Exception(op + " <" + name + ">"); + // } catch (Exception e) { + // java.io.StringWriter sw = new java.io.StringWriter(); + // java.io.PrintWriter pw = new java.io.PrintWriter(sw); + // e.printStackTrace(pw); + // System.out.println(sw.getBuffer().toString()); + // } + //} + /* DEBUG */ } Descriptor file = null; @@ -432,6 +456,13 @@ FSInputStream clone = (FSInputStream)super.clone(); clone.isClone = true; return clone; + } + + /** Method used for testing. Returns true if the underlying + * file descriptor is valid. + */ + boolean isFDValid() throws IOException { + return file.getFD().valid(); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]