[PATCH] Fix PR libgcj/36252, OutOfMemoryError in String constructor.
David Daney
ddaney@avtrex.com
Sun May 18 06:00:00 GMT 2008
Drat, only after pressing 'send' are problems noticed.
David Daney wrote:
> Index: testsuite/libjava.lang/PR36252.java
> ===================================================================
> --- testsuite/libjava.lang/PR36252.java (revision 0)
> +++ testsuite/libjava.lang/PR36252.java (revision 0)
> @@ -0,0 +1,16 @@
> +import java.io.UnsupportedEncodingException;
> +
> +public class PR36252
> +{
> + public static void main(String[] args)
> + {
> + try {
> + byte[] txt = new byte[] {-55, 87, -55, -42, -55, -20};
> + // This new String(...) should not throw an OutOfMemoryError.
> + String s = new String(txt, 0, 6, "MS932");
> + } catch (UnsupportedEncodingException e) {
> + e.printStackTrace();
This exception should be ignored, it is valid to not support "MS932".
If approved, I would remove the printStackTrace and simply ignore the exception.
> + }
> + System.out.println("ok");
> + }
> +}
More information about the Java-patches
mailing list