exception.cc (java_eh_info): Make value type jthrowable.
* exception.cc (java_eh_info): Make value type jthrowable. (_Jv_type_matcher): Remove now unneeded cast. (_Jv_Throw): Make argument type jthrowable. Munge name for SJLJ_EXCEPTIONS here ... * gcj/cni.h: ... not here. (JvThrow): Remove. * gcj/javaprims.h (_Jv_Throw, _Jv_Sjlj_Throw): Update declarations. * defineclass.cc, interpret.cc, jni.cc, posix-threads.cc, prims.cc, resolve.cc, gnu/gcj/runtime/natFirstThread.cc, gnu/gcj/xlib/natDrawable.cc, gnu/gcj/xlib/natFont.cc, gnu/gcj/xlib/natWMSizeHints.cc, gnu/gcj/xlib/natWindowAttributes.cc, gnu/gcj/xlib/natXImage.cc, java/io/natFile.cc, java/io/natFileDescriptorEcos.cc, java/io/natFileDescriptorPosix.cc, java/io/natFileDescriptorWin32.cc, java/io/natFileWin32.cc, java/lang/natClass.cc, java/lang/natClassLoader.cc, java/lang/natDouble.cc, java/lang/natObject.cc, java/lang/natPosixProcess.cc, java/lang/natRuntime.cc, java/lang/natString.cc, java/lang/natSystem.cc, java/lang/natThread.cc, java/lang/reflect/natArray.cc, java/lang/reflect/natConstructor.cc, java/lang/reflect/natField.cc, java/lang/reflect/natMethod.cc, java/util/zip/natDeflater.cc, java/util/zip/natInflater.cc: Use throw, not JvThrow or _Jv_Throw. From-SVN: r40838
This commit is contained in:
parent
56b8908481
commit
b3208f56cb
36 changed files with 294 additions and 284 deletions
|
@ -118,7 +118,7 @@ java::io::File::getCanonicalPath (void)
|
|||
|
||||
#ifdef HAVE_REALPATH
|
||||
if (realpath (buf, buf2) == NULL)
|
||||
_Jv_Throw (new IOException (JvNewStringLatin1 (strerror (errno))));
|
||||
throw new IOException (JvNewStringLatin1 (strerror (errno)));
|
||||
|
||||
// FIXME: what encoding to assume for file names? This affects many
|
||||
// calls.
|
||||
|
|
|
@ -54,7 +54,7 @@ java::io::FileDescriptor::sync (void)
|
|||
// as errors.
|
||||
#ifdef HAVE_FSYNC
|
||||
#else
|
||||
JvThrow (new SyncFailedException (JvNewStringLatin1 (NO_FSYNC_MESSAGE)));
|
||||
throw new SyncFailedException (JvNewStringLatin1 (NO_FSYNC_MESSAGE));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -75,9 +75,9 @@ void
|
|||
java::io::FileDescriptor::write (jbyteArray b, jint offset, jint len)
|
||||
{
|
||||
if (! b)
|
||||
JvThrow (new java::lang::NullPointerException);
|
||||
throw new java::lang::NullPointerException;
|
||||
if (offset < 0 || len < 0 || offset + len > JvGetArrayLength (b))
|
||||
JvThrow (new java::lang::ArrayIndexOutOfBoundsException);
|
||||
throw new java::lang::ArrayIndexOutOfBoundsException;
|
||||
char *bytes = (char *)elements (b) + offset;
|
||||
::diag_write (bytes, len);
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ java::io::FileDescriptor::seek (jlong pos, jint whence)
|
|||
jlong here = getFilePointer ();
|
||||
|
||||
if ((whence == SET && pos > len) || (whence == CUR && here + pos > len))
|
||||
JvThrow (new EOFException);
|
||||
throw new EOFException;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -59,9 +59,9 @@ java::io::FileDescriptor::sync (void)
|
|||
// as errors.
|
||||
#ifdef HAVE_FSYNC
|
||||
if (::fsync (fd) && errno != EROFS && errno != EINVAL)
|
||||
JvThrow (new SyncFailedException (JvNewStringLatin1 (strerror (errno))));
|
||||
throw new SyncFailedException (JvNewStringLatin1 (strerror (errno)));
|
||||
#else
|
||||
JvThrow (new SyncFailedException (JvNewStringLatin1 (NO_FSYNC_MESSAGE)));
|
||||
throw new SyncFailedException (JvNewStringLatin1 (NO_FSYNC_MESSAGE));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ java::io::FileDescriptor::open (jstring path, jint jflags)
|
|||
{
|
||||
char msg[MAXPATHLEN + 200];
|
||||
sprintf (msg, "%s: %s", buf, strerror (errno));
|
||||
JvThrow (new FileNotFoundException (JvNewStringLatin1 (msg)));
|
||||
throw new FileNotFoundException (JvNewStringLatin1 (msg));
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
@ -127,10 +127,10 @@ java::io::FileDescriptor::write (jint b)
|
|||
InterruptedIOException *iioe
|
||||
= new InterruptedIOException (JvNewStringLatin1 ("write interrupted"));
|
||||
iioe->bytesTransferred = r == -1 ? 0 : r;
|
||||
JvThrow (iioe);
|
||||
throw iioe;
|
||||
}
|
||||
else if (r == -1)
|
||||
JvThrow (new IOException (JvNewStringLatin1 (strerror (errno))));
|
||||
throw new IOException (JvNewStringLatin1 (strerror (errno)));
|
||||
// FIXME: loop if r != 1.
|
||||
}
|
||||
|
||||
|
@ -138,9 +138,9 @@ void
|
|||
java::io::FileDescriptor::write (jbyteArray b, jint offset, jint len)
|
||||
{
|
||||
if (! b)
|
||||
JvThrow (new java::lang::NullPointerException);
|
||||
throw new java::lang::NullPointerException;
|
||||
if (offset < 0 || len < 0 || offset + len > JvGetArrayLength (b))
|
||||
JvThrow (new java::lang::ArrayIndexOutOfBoundsException);
|
||||
throw new java::lang::ArrayIndexOutOfBoundsException;
|
||||
jbyte *bytes = elements (b) + offset;
|
||||
int r = ::write (fd, bytes, len);
|
||||
if (java::lang::Thread::interrupted())
|
||||
|
@ -148,10 +148,10 @@ java::io::FileDescriptor::write (jbyteArray b, jint offset, jint len)
|
|||
InterruptedIOException *iioe
|
||||
= new InterruptedIOException (JvNewStringLatin1 ("write interrupted"));
|
||||
iioe->bytesTransferred = r == -1 ? 0 : r;
|
||||
JvThrow (iioe);
|
||||
throw iioe;
|
||||
}
|
||||
else if (r == -1)
|
||||
JvThrow (new IOException (JvNewStringLatin1 (strerror (errno))));
|
||||
throw new IOException (JvNewStringLatin1 (strerror (errno)));
|
||||
// FIXME: loop if r != len.
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ java::io::FileDescriptor::close (void)
|
|||
jint save = fd;
|
||||
fd = -1;
|
||||
if (::close (save))
|
||||
JvThrow (new IOException (JvNewStringLatin1 (strerror (errno))));
|
||||
throw new IOException (JvNewStringLatin1 (strerror (errno)));
|
||||
}
|
||||
|
||||
jint
|
||||
|
@ -173,11 +173,11 @@ java::io::FileDescriptor::seek (jlong pos, jint whence)
|
|||
jlong here = getFilePointer ();
|
||||
|
||||
if ((whence == SET && pos > len) || (whence == CUR && here + pos > len))
|
||||
JvThrow (new EOFException);
|
||||
throw new EOFException;
|
||||
|
||||
off_t r = ::lseek (fd, (off_t) pos, whence == SET ? SEEK_SET : SEEK_CUR);
|
||||
if (r == -1)
|
||||
JvThrow (new IOException (JvNewStringLatin1 (strerror (errno))));
|
||||
throw new IOException (JvNewStringLatin1 (strerror (errno)));
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ java::io::FileDescriptor::length (void)
|
|||
{
|
||||
struct stat sb;
|
||||
if (::fstat (fd, &sb))
|
||||
JvThrow (new IOException (JvNewStringLatin1 (strerror (errno))));
|
||||
throw new IOException (JvNewStringLatin1 (strerror (errno)));
|
||||
return sb.st_size;
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,7 @@ java::io::FileDescriptor::getFilePointer (void)
|
|||
{
|
||||
off_t r = ::lseek (fd, 0, SEEK_CUR);
|
||||
if (r == -1)
|
||||
JvThrow (new IOException (JvNewStringLatin1 (strerror (errno))));
|
||||
throw new IOException (JvNewStringLatin1 (strerror (errno)));
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -211,10 +211,10 @@ java::io::FileDescriptor::read (void)
|
|||
InterruptedIOException *iioe
|
||||
= new InterruptedIOException (JvNewStringLatin1 ("read interrupted"));
|
||||
iioe->bytesTransferred = r == -1 ? 0 : r;
|
||||
JvThrow (iioe);
|
||||
throw iioe;
|
||||
}
|
||||
else if (r == -1)
|
||||
JvThrow (new IOException (JvNewStringLatin1 (strerror (errno))));
|
||||
throw new IOException (JvNewStringLatin1 (strerror (errno)));
|
||||
return b & 0xFF;
|
||||
}
|
||||
|
||||
|
@ -222,10 +222,10 @@ jint
|
|||
java::io::FileDescriptor::read (jbyteArray buffer, jint offset, jint count)
|
||||
{
|
||||
if (! buffer)
|
||||
JvThrow (new java::lang::NullPointerException);
|
||||
throw new java::lang::NullPointerException;
|
||||
jsize bsize = JvGetArrayLength (buffer);
|
||||
if (offset < 0 || count < 0 || offset + count > bsize)
|
||||
JvThrow (new java::lang::ArrayIndexOutOfBoundsException);
|
||||
throw new java::lang::ArrayIndexOutOfBoundsException;
|
||||
jbyte *bytes = elements (buffer) + offset;
|
||||
int r = ::read (fd, bytes, count);
|
||||
if (r == 0)
|
||||
|
@ -235,10 +235,10 @@ java::io::FileDescriptor::read (jbyteArray buffer, jint offset, jint count)
|
|||
InterruptedIOException *iioe
|
||||
= new InterruptedIOException (JvNewStringLatin1 ("read interrupted"));
|
||||
iioe->bytesTransferred = r == -1 ? 0 : r;
|
||||
JvThrow (iioe);
|
||||
throw iioe;
|
||||
}
|
||||
else if (r == -1)
|
||||
JvThrow (new IOException (JvNewStringLatin1 (strerror (errno))));
|
||||
throw new IOException (JvNewStringLatin1 (strerror (errno)));
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -271,7 +271,7 @@ java::io::FileDescriptor::available (void)
|
|||
if (r == -1)
|
||||
{
|
||||
posix_error:
|
||||
JvThrow (new IOException (JvNewStringLatin1 (strerror (errno))));
|
||||
throw new IOException (JvNewStringLatin1 (strerror (errno)));
|
||||
}
|
||||
|
||||
// If we didn't get anything, and we have fstat, then see if see if
|
||||
|
@ -313,6 +313,6 @@ java::io::FileDescriptor::available (void)
|
|||
|
||||
return (jint) num;
|
||||
#else
|
||||
JvThrow (new IOException (JvNewStringLatin1 ("unimplemented")));
|
||||
throw new IOException (JvNewStringLatin1 ("unimplemented"));
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ java::io::FileDescriptor::valid (void) {
|
|||
void
|
||||
java::io::FileDescriptor::sync (void) {
|
||||
if (! FlushFileBuffers ((HANDLE)fd))
|
||||
JvThrow (new SyncFailedException (JvNewStringLatin1 (winerr ())));
|
||||
throw new SyncFailedException (JvNewStringLatin1 (winerr ()));
|
||||
}
|
||||
|
||||
jint
|
||||
|
@ -109,7 +109,7 @@ java::io::FileDescriptor::open (jstring path, jint jflags) {
|
|||
{
|
||||
char msg[MAX_PATH + 1000];
|
||||
sprintf (msg, "%s: %s", buf, winerr ());
|
||||
JvThrow (new FileNotFoundException (JvNewStringLatin1 (msg)));
|
||||
throw new FileNotFoundException (JvNewStringLatin1 (msg));
|
||||
}
|
||||
|
||||
return (jint)handle;
|
||||
|
@ -127,13 +127,13 @@ java::io::FileDescriptor::write (jint b)
|
|||
{
|
||||
InterruptedIOException *iioe = new InterruptedIOException (JvNewStringLatin1 ("write interrupted"));
|
||||
iioe->bytesTransferred = bytesWritten;
|
||||
JvThrow (iioe);
|
||||
throw iioe;
|
||||
}
|
||||
if (bytesWritten != 1)
|
||||
JvThrow (new IOException (JvNewStringLatin1 (winerr ())));
|
||||
throw new IOException (JvNewStringLatin1 (winerr ()));
|
||||
}
|
||||
else
|
||||
JvThrow (new IOException (JvNewStringLatin1 (winerr ())));
|
||||
throw new IOException (JvNewStringLatin1 (winerr ()));
|
||||
// FIXME: loop until bytesWritten == 1
|
||||
}
|
||||
|
||||
|
@ -141,9 +141,9 @@ void
|
|||
java::io::FileDescriptor::write(jbyteArray b, jint offset, jint len)
|
||||
{
|
||||
if (! b)
|
||||
JvThrow (new java::lang::NullPointerException);
|
||||
throw new java::lang::NullPointerException;
|
||||
if(offset < 0 || len < 0 || offset + len > JvGetArrayLength (b))
|
||||
JvThrow (new java::lang::ArrayIndexOutOfBoundsException);
|
||||
throw new java::lang::ArrayIndexOutOfBoundsException;
|
||||
|
||||
jbyte *buf = elements (b) + offset;
|
||||
DWORD bytesWritten;
|
||||
|
@ -153,11 +153,11 @@ java::io::FileDescriptor::write(jbyteArray b, jint offset, jint len)
|
|||
{
|
||||
InterruptedIOException *iioe = new InterruptedIOException (JvNewStringLatin1 ("write interrupted"));
|
||||
iioe->bytesTransferred = bytesWritten;
|
||||
JvThrow (iioe);
|
||||
throw iioe;
|
||||
}
|
||||
}
|
||||
else
|
||||
JvThrow(new IOException (JvNewStringLatin1 (winerr ())));
|
||||
throw new IOException (JvNewStringLatin1 (winerr ()));
|
||||
// FIXME: loop until bytesWritten == len
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ java::io::FileDescriptor::close (void)
|
|||
HANDLE save = (HANDLE)fd;
|
||||
fd = (jint)INVALID_HANDLE_VALUE;
|
||||
if (! CloseHandle (save))
|
||||
JvThrow (new IOException (JvNewStringLatin1 (winerr ())));
|
||||
throw new IOException (JvNewStringLatin1 (winerr ()));
|
||||
}
|
||||
|
||||
jint
|
||||
|
@ -179,12 +179,12 @@ java::io::FileDescriptor::seek (jlong pos, jint whence)
|
|||
jlong here = getFilePointer();
|
||||
|
||||
if ((whence == SET && pos > len) || (whence == CUR && here + pos > len))
|
||||
JvThrow (new EOFException);
|
||||
throw new EOFException;
|
||||
|
||||
LONG high = pos >> 32;
|
||||
DWORD low = SetFilePointer ((HANDLE)fd, (DWORD)(0xffffffff & pos), &high, whence == SET ? FILE_BEGIN : FILE_CURRENT);
|
||||
if ((low == 0xffffffff) && (GetLastError () != NO_ERROR))
|
||||
JvThrow (new IOException (JvNewStringLatin1 (winerr ())));
|
||||
throw new IOException (JvNewStringLatin1 (winerr ()));
|
||||
return low;
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ java::io::FileDescriptor::getFilePointer(void)
|
|||
LONG high = 0;
|
||||
DWORD low = SetFilePointer ((HANDLE)fd, 0, &high, FILE_CURRENT);
|
||||
if ((low == 0xffffffff) && (GetLastError() != NO_ERROR))
|
||||
JvThrow(new IOException (JvNewStringLatin1 (winerr ())));
|
||||
throw new IOException (JvNewStringLatin1 (winerr ()));
|
||||
return (((jlong)high) << 32L) | (jlong)low;
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ java::io::FileDescriptor::read(void)
|
|||
DWORD read;
|
||||
|
||||
if (! ReadFile ((HANDLE)fd, &buf, 1, &read, NULL))
|
||||
JvThrow (new IOException (JvNewStringLatin1 (winerr ())));
|
||||
throw new IOException (JvNewStringLatin1 (winerr ()));
|
||||
if (! read)
|
||||
return -1;
|
||||
else
|
||||
|
@ -227,17 +227,17 @@ jint
|
|||
java::io::FileDescriptor::read(jbyteArray buffer, jint offset, jint count)
|
||||
{
|
||||
if (! buffer)
|
||||
JvThrow(new java::lang::NullPointerException);
|
||||
throw new java::lang::NullPointerException;
|
||||
|
||||
jsize bsize = JvGetArrayLength (buffer);
|
||||
if (offset < 0 || count < 0 || offset + count > bsize)
|
||||
JvThrow (new java::lang::ArrayIndexOutOfBoundsException);
|
||||
throw new java::lang::ArrayIndexOutOfBoundsException;
|
||||
|
||||
jbyte *bytes = elements (buffer) + offset;
|
||||
|
||||
DWORD read;
|
||||
if (! ReadFile((HANDLE)fd, bytes, count, &read, NULL))
|
||||
JvThrow (new IOException (JvNewStringLatin1 (winerr ())));
|
||||
throw new IOException (JvNewStringLatin1 (winerr ()));
|
||||
|
||||
return (jint)read;
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ java::io::File::getCanonicalPath (void)
|
|||
|
||||
LPTSTR unused;
|
||||
if(!GetFullPathName(buf, MAX_PATH, buf2, &unused))
|
||||
_Jv_Throw (new IOException (JvNewStringLatin1 ("GetFullPathName failed")));
|
||||
throw new IOException (JvNewStringLatin1 ("GetFullPathName failed"));
|
||||
|
||||
// FIXME: what encoding to assume for file names? This affects many
|
||||
// calls.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue