gcc/libjava/testsuite/libjava.lang/PR36252.java
David Daney 32723ea0f9 re PR libgcj/36252 (OutOfMemoryError on simple text conversion.)
2008-05-20  David Daney  <ddaney@avtrex.com>

	PR libgcj/36252
	* java/lang/natString.ccn: Add
	#include <java/io/CharConversionException.h>.
	(init (byte[], int, int, String)): Catch and ignore
	CharConversionException.  Break out of conversion loop
	on incomplete input.
	* testsuite/libjava.lang/PR36252.java: New test.
	* testsuite/libjava.lang/PR36252.out: New file, its expected output.
	* testsuite/libjava.lang/PR36252.jar: New file, its pre-compiled
	jar file.

From-SVN: r135705
2008-05-21 03:49:03 +00:00

17 lines
417 B
Java

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) {
// Silently ignore.
}
System.out.println("ok");
}
}