/**
* @test
* @bug 6359397
* @summary Test if FileInputStream methods will check if the stream
* has been closed.
*/
public enum OpsAfterClose {
try {
r.read();
} catch (IOException io) {
return true;
}
return false;
} },
try {
byte buf[] = new byte[2];
} catch (IOException io) {
return true;
}
return false;
} },
try {
byte buf[] = new byte[2];
int len = 1;
} catch (IOException io) {
return true;
}
return false;
} },
r.getChannel();
return true;
} },
try {
r.getFD();
return true;
} catch (IOException io) {
return false;
}
} },
try {
r.skip(1);
} catch (IOException io) {
return true;
}
return false;
} },
try {
r.close();
return true; // No Exception thrown on windows
} catch (IOException io) {
return true; // Exception thrown on solaris and linux
}
} };
boolean failed = false;
"f.txt");
f.createNewFile();
f.deleteOnExit();
if (testFileInputStream(fis)) {
throw new Exception("Test failed for some of the operation{s}" +
" on FileInputStream, check the messages");
}
}
throws Exception {
r.close();
boolean failed = false;
boolean result;
if (!result) {
failed = true;
}
}
if (failed) {
" above for the FileInputStream:" + r);
}
return failed;
}
}