throw FileNotFoundException from doOpen when appropriate

This commit is contained in:
Joel Dice 2009-08-21 09:23:03 -06:00
parent a56c1d8765
commit c14bb5768e

View File

@ -67,7 +67,11 @@ doOpen(JNIEnv* e, const char* path, int mask)
{
int fd = OPEN(path, mask | OPEN_MASK, S_IRUSR | S_IWUSR);
if (fd == -1) {
throwNew(e, "java/io/IOException", strerror(errno));
if (errno == ENOENT) {
throwNew(e, "java/io/FileNotFoundException", strerror(errno));
} else {
throwNew(e, "java/io/IOException", strerror(errno));
}
}
return fd;
}