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

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -45,14 +45,12 @@
         return -1;
     }
     nread = IO_Read(fd, &ret, 1);
     if (nread == 0) { /* EOF */
         return -1;
-    } else if (nread == JVM_IO_ERR) { /* error */
+    } else if (nread == -1) { /* error */
         JNU_ThrowIOExceptionWithLastError(env, "Read error");
-    } else if (nread == JVM_IO_INTR) {
-        JNU_ThrowByName(env, "java/io/InterruptedIOException", NULL);
     }
     return ret & 0xFF;
 }
 
 /* The maximum size of a stack-allocated buffer.

@@ -109,14 +107,12 @@
         nread = -1;
     } else {
         nread = IO_Read(fd, buf, len);
         if (nread > 0) {
             (*env)->SetByteArrayRegion(env, bytes, off, nread, (jbyte *)buf);
-        } else if (nread == JVM_IO_ERR) {
+        } else if (nread == -1) {
             JNU_ThrowIOExceptionWithLastError(env, "Read error");
-        } else if (nread == JVM_IO_INTR) {
-            JNU_ThrowByName(env, "java/io/InterruptedIOException", NULL);
         } else { /* EOF */
             nread = -1;
         }
     }
 

@@ -139,14 +135,12 @@
     if (append == JNI_TRUE) {
         n = IO_Append(fd, &c, 1);
     } else {
         n = IO_Write(fd, &c, 1);
     }
-    if (n == JVM_IO_ERR) {
+    if (n == -1) {
         JNU_ThrowIOExceptionWithLastError(env, "Write error");
-    } else if (n == JVM_IO_INTR) {
-        JNU_ThrowByName(env, "java/io/InterruptedIOException", NULL);
     }
 }
 
 void
 writeBytes(JNIEnv *env, jobject this, jbyteArray bytes,

@@ -192,16 +186,13 @@
             if (append == JNI_TRUE) {
                 n = IO_Append(fd, buf+off, len);
             } else {
                 n = IO_Write(fd, buf+off, len);
             }
-            if (n == JVM_IO_ERR) {
+            if (n == -1) {
                 JNU_ThrowIOExceptionWithLastError(env, "Write error");
                 break;
-            } else if (n == JVM_IO_INTR) {
-                JNU_ThrowByName(env, "java/io/InterruptedIOException", NULL);
-                break;
             }
             off += n;
             len -= n;
         }
     }

@@ -212,15 +203,15 @@
 
 void
 throwFileNotFoundException(JNIEnv *env, jstring path)
 {
     char buf[256];
-    jint n;
+    size_t n;
     jobject x;
     jstring why = NULL;
 
-    n = JVM_GetLastErrorString(buf, sizeof(buf));
+    n = getLastErrorString(buf, sizeof(buf));
     if (n > 0) {
         why = JNU_NewStringPlatform(env, buf);
     }
     x = JNU_NewObjectByName(env,
                             "java/io/FileNotFoundException",