https://bugs.openjdk.java.net/browse/JDK-8221568
Require 64-bit arch and increase heap size to 3 GB [0]. Without this patch, the test failed on macosx-x64 and solaris-sparcv9. With the patch, it passed on those systems as well as linux-x64 and windows-x64. Thanks, Brian [0] Patch --- a/test/jdk/java/io/DataOutputStream/WriteUTF.java +++ b/test/jdk/java/io/DataOutputStream/WriteUTF.java @@ -24,7 +24,8 @@ /* @test * @bug 4260284 8219196 * @summary Test if DataOutputStream will overcount written field. - * @run testng/othervm -Xmx2g WriteUTF + * @requires (sun.arch.data.model == "64" & os.maxMemory >= 3g) + * @run testng/othervm -Xmx3g WriteUTF */ import java.io.ByteArrayOutputStream; @@ -59,7 +60,7 @@ } // Without 8219196 fix, throws ArrayIndexOutOfBoundsException instead of - // expected UTFDataFormatException. Requires 2GB of heap (-Xmx2g) to run + // expected UTFDataFormatException. Requires 3GB of heap (-Xmx3g) to run // without throwing an OutOfMemoryError. @Test(expectedExceptions = UTFDataFormatException.class) public void arrayIndexOutOfBoundsException() throws IOException {