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

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1994, 2011, 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 --- 1,7 ---- /* ! * 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,58 **** return -1; } nread = IO_Read(fd, &ret, 1); if (nread == 0) { /* EOF */ return -1; ! } else if (nread == JVM_IO_ERR) { /* 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. --- 45,56 ---- return -1; } nread = IO_Read(fd, &ret, 1); if (nread == 0) { /* EOF */ return -1; ! } else if (nread == -1) { /* error */ JNU_ThrowIOExceptionWithLastError(env, "Read error"); } return ret & 0xFF; } /* The maximum size of a stack-allocated buffer.
*** 109,122 **** 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) { JNU_ThrowIOExceptionWithLastError(env, "Read error"); - } else if (nread == JVM_IO_INTR) { - JNU_ThrowByName(env, "java/io/InterruptedIOException", NULL); } else { /* EOF */ nread = -1; } } --- 107,118 ---- nread = -1; } else { nread = IO_Read(fd, buf, len); if (nread > 0) { (*env)->SetByteArrayRegion(env, bytes, off, nread, (jbyte *)buf); ! } else if (nread == -1) { JNU_ThrowIOExceptionWithLastError(env, "Read error"); } else { /* EOF */ nread = -1; } }
*** 139,152 **** if (append == JNI_TRUE) { n = IO_Append(fd, &c, 1); } else { n = IO_Write(fd, &c, 1); } ! if (n == JVM_IO_ERR) { 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, --- 135,146 ---- if (append == JNI_TRUE) { n = IO_Append(fd, &c, 1); } else { n = IO_Write(fd, &c, 1); } ! if (n == -1) { JNU_ThrowIOExceptionWithLastError(env, "Write error"); } } void writeBytes(JNIEnv *env, jobject this, jbyteArray bytes,
*** 192,207 **** if (append == JNI_TRUE) { n = IO_Append(fd, buf+off, len); } else { n = IO_Write(fd, buf+off, len); } ! if (n == JVM_IO_ERR) { JNU_ThrowIOExceptionWithLastError(env, "Write error"); break; - } else if (n == JVM_IO_INTR) { - JNU_ThrowByName(env, "java/io/InterruptedIOException", NULL); - break; } off += n; len -= n; } } --- 186,198 ---- if (append == JNI_TRUE) { n = IO_Append(fd, buf+off, len); } else { n = IO_Write(fd, buf+off, len); } ! if (n == -1) { JNU_ThrowIOExceptionWithLastError(env, "Write error"); break; } off += n; len -= n; } }
*** 212,226 **** void throwFileNotFoundException(JNIEnv *env, jstring path) { char buf[256]; ! jint n; jobject x; jstring why = NULL; ! n = JVM_GetLastErrorString(buf, sizeof(buf)); if (n > 0) { why = JNU_NewStringPlatform(env, buf); } x = JNU_NewObjectByName(env, "java/io/FileNotFoundException", --- 203,217 ---- void throwFileNotFoundException(JNIEnv *env, jstring path) { char buf[256]; ! size_t n; jobject x; jstring why = NULL; ! n = getLastErrorString(buf, sizeof(buf)); if (n > 0) { why = JNU_NewStringPlatform(env, buf); } x = JNU_NewObjectByName(env, "java/io/FileNotFoundException",