Commit 9d9cf166 by Tom Tromey Committed by Tom Tromey

String.java: Don't throw UnsupportedEncodingException.

	* java/lang/String.java: Don't throw
	UnsupportedEncodingException.

From-SVN: r26577
parent b323effe
1999-04-21 Tom Tromey <tromey@cygnus.com>
* java/lang/String.java: Don't throw
UnsupportedEncodingException.
* java/lang/natString.cc (getBytes): Correctly size result
buffer. From Bryce McKinlay <bryce@albatross.co.nz>.
......
......@@ -132,9 +132,27 @@ public final class String
public native void getChars (int srcBegin, int srcEnd,
char[] dst, int dstBegin);
public byte[] getBytes () throws UnsupportedEncodingException
public byte[] getBytes ()
{
return getBytes (System.getProperty("file.encoding", "8859_1"));
try
{
return getBytes (System.getProperty("file.encoding", "8859_1"));
}
catch (UnsupportedEncodingException x)
{
// This probably shouldn't happen, but could if file.encoding
// is somehow changed to a value we don't understand.
try
{
return getBytes ("8859_1");
}
catch (UnsupportedEncodingException x2)
{
// This really shouldn't happen, because the 8859_1
// encoding should always be available.
throw new InternalError ("couldn't find 8859_1 encoder");
}
}
}
public native byte[] getBytes (String enc)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment