[kaffe] [PATCH] String constructor wraps UnsupportedEncodingException in Error
Noa Resare
noa at resare.com
Sat Oct 9 00:40:08 PDT 2004
I get the feeling that I'm missing something obvious here but to me the
code in libraries/javalib/java/lang/String.java:128 just seems strangely
broken:
public String(byte[] data, int offset, int count, String encoding)
throws UnsupportedEncodingException
{
if (offset < 0 || count < 0 || offset + count > data.length)
throw new StringIndexOutOfBoundsException();
try
{
// XXX Consider using java.nio here.
value = EncodingManager.getDecoder(encoding)
.convertToChars(data, offset, count);
}
catch (UnsupportedEncodingException uee)
{
throw new Error(uee);
}
catch (CharConversionException cce)
{
throw new Error(cce);
}
this.offset = 0;
this.count = value.length;
}
Why catch the UnsupportedEncodingException at all? The attached patch
removes the wrapping. It fixes two mauve regressions.
cheers/noa
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kaffe-stringinit.patch
Type: text/x-patch
Size: 1218 bytes
Desc: not available
Url : http://kaffe.org/pipermail/kaffe/attachments/20041009/5ddf1497/attachment-0002.bin
More information about the kaffe
mailing list