< prev index next >

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

Print this page
rev 1551 : 8057530: (process) Runtime.exec throws garbled message in jp locale
8016579: (process) IOException thrown by ProcessBuilder.start() method is incorrectly encoded
Reviewed-by: alanb


 189             if (n == JVM_IO_ERR) {
 190                 JNU_ThrowIOExceptionWithLastError(env, "Write error");
 191                 break;
 192             } else if (n == JVM_IO_INTR) {
 193                 JNU_ThrowByName(env, "java/io/InterruptedIOException", NULL);
 194                 break;
 195             }
 196             off += n;
 197             len -= n;
 198         }
 199     }
 200     if (buf != stackBuf) {
 201         free(buf);
 202     }
 203 }
 204 
 205 void
 206 throwFileNotFoundException(JNIEnv *env, jstring path)
 207 {
 208     char buf[256];
 209     jint n;
 210     jobject x;
 211     jstring why = NULL;
 212 
 213     n = JVM_GetLastErrorString(buf, sizeof(buf));
 214     if (n > 0) {



 215         why = JNU_NewStringPlatform(env, buf);

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


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