src/share/native/java/io/io_util.c

Print this page




 194             }
 195             off += n;
 196             len -= n;
 197         }
 198     }
 199     if (buf != stackBuf) {
 200         free(buf);
 201     }
 202 }
 203 
 204 void
 205 throwFileNotFoundException(JNIEnv *env, jstring path)
 206 {
 207     char buf[256];
 208     size_t n;
 209     jobject x;
 210     jstring why = NULL;
 211 
 212     n = getLastErrorString(buf, sizeof(buf));
 213     if (n > 0) {



 214         why = JNU_NewStringPlatform(env, buf);

 215     }
 216     x = JNU_NewObjectByName(env,
 217                             "java/io/FileNotFoundException",
 218                             "(Ljava/lang/String;Ljava/lang/String;)V",
 219                             path, why);
 220     if (x != NULL) {
 221         (*env)->Throw(env, x);
 222     }
 223 }


 194             }
 195             off += n;
 196             len -= n;
 197         }
 198     }
 199     if (buf != stackBuf) {
 200         free(buf);
 201     }
 202 }
 203 
 204 void
 205 throwFileNotFoundException(JNIEnv *env, jstring path)
 206 {
 207     char buf[256];
 208     size_t n;
 209     jobject x;
 210     jstring why = NULL;
 211 
 212     n = getLastErrorString(buf, sizeof(buf));
 213     if (n > 0) {
 214 #ifdef WIN32 
 215         why = (*env)->NewStringUTF(env, buf);
 216 #else
 217         why = JNU_NewStringPlatform(env, buf);
 218 #endif
 219     }
 220     x = JNU_NewObjectByName(env,
 221                             "java/io/FileNotFoundException",
 222                             "(Ljava/lang/String;Ljava/lang/String;)V",
 223                             path, why);
 224     if (x != NULL) {
 225         (*env)->Throw(env, x);
 226     }
 227 }