diff options
| author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-07-13 05:41:28 +0000 |
|---|---|---|
| committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-07-13 05:41:28 +0000 |
| commit | eedb76d3bdbf92cbadbbd11160701058449ceb26 (patch) | |
| tree | 4aff078d910dc63cd6e5522da1dc415bc661bb0c /libjava/gnu | |
| parent | 8924a5ed499bc0df8876681adb119cd420eacb92 (diff) | |
| download | ppe42-gcc-eedb76d3bdbf92cbadbbd11160701058449ceb26.tar.gz ppe42-gcc-eedb76d3bdbf92cbadbbd11160701058449ceb26.zip | |
Fix for PR libgcj/3426:
* gnu/gcj/convert/natIconv.cc: Include CharConversionException.h,
errno.h.
(read): Throw exception if character conversion fails.
* java/io/BufferedInputStream.java (refill): Now package-private.
* java/io/InputStreamReader.java (ready): Simplified.
(refill): New method.
(read): Use it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@43975 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu')
| -rw-r--r-- | libjava/gnu/gcj/convert/natIconv.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libjava/gnu/gcj/convert/natIconv.cc b/libjava/gnu/gcj/convert/natIconv.cc index d346b1488f2..3c5f52ec4d6 100644 --- a/libjava/gnu/gcj/convert/natIconv.cc +++ b/libjava/gnu/gcj/convert/natIconv.cc @@ -1,6 +1,6 @@ // Input_iconv.java -- Java side of iconv() reader. -/* Copyright (C) 2000 Free Software Foundation +/* Copyright (C) 2000, 2001 Free Software Foundation This file is part of libgcj. @@ -17,8 +17,11 @@ details. */ #include <gnu/gcj/convert/Input_iconv.h> #include <gnu/gcj/convert/Output_iconv.h> +#include <java/io/CharConversionException.h> #include <java/io/UnsupportedEncodingException.h> +#include <errno.h> + #ifdef HAVE_ICONV #include <iconv.h> @@ -84,7 +87,14 @@ gnu::gcj::convert::Input_iconv::read (jcharArray outbuffer, size_t r = iconv_adapter (iconv, (iconv_t) handle, &inbuf, &inavail, &outbuf, &outavail); - // FIXME: what if R==-1? + + if (r == (size_t) -1) + { + // Incomplete character. + if (errno == EINVAL) + return 0; + throw new java::io::CharConversionException (); + } if (iconv_byte_swap) { |

