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.


git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150066 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dmitry Serebrennikov 2003-09-25 21:50:11 +00:00
parent 250f13e99c
commit 4e84ddc3f5
1 changed files with 31 additions and 0 deletions

View File

@ -381,10 +381,34 @@ public final class FSDirectory extends Directory {
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;
@ -433,6 +457,13 @@ final class FSInputStream extends InputStream {
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();
}
}