Index: C:/harmony/trunk_0427/modules/luni/src/main/java/java/lang/String.java =================================================================== --- C:/harmony/trunk_0427/modules/luni/src/main/java/java/lang/String.java (revision 417114) +++ C:/harmony/trunk_0427/modules/luni/src/main/java/java/lang/String.java (working copy) @@ -835,11 +835,15 @@ * @see UnsupportedEncodingException */ public byte[] getBytes(String encoding) throws UnsupportedEncodingException { - ByteBuffer buffer = getCharset(encoding).encode( + try { + ByteBuffer buffer = getCharset(encoding).encode( CharBuffer.wrap(this.value, this.offset, this.count)); - byte[] bytes = new byte[buffer.limit()]; - buffer.get(bytes); - return bytes; + byte[] bytes = new byte[buffer.limit()]; + buffer.get(bytes); + return bytes; + } catch (IllegalCharsetNameException ich) { + throw new UnsupportedEncodingException(ich.getMessage()); + } } private Charset getCharset(final String encoding)