equal
deleted
inserted
replaced
20 * or visit www.oracle.com if you need additional information or have any |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /* @test |
24 /* @test |
25 * @bug 4260284 8219196 |
25 * @bug 4260284 8219196 8223254 |
26 * @summary Test if DataOutputStream will overcount written field. |
26 * @summary Test if DataOutputStream will overcount written field. |
27 * @requires (sun.arch.data.model == "64" & os.maxMemory >= 3g) |
27 * @requires (sun.arch.data.model == "64" & os.maxMemory >= 4g) |
28 * @run testng/othervm -Xmx3g WriteUTF |
28 * @run testng/othervm -Xmx4g WriteUTF |
29 */ |
29 */ |
30 |
30 |
31 import java.io.ByteArrayOutputStream; |
31 import java.io.ByteArrayOutputStream; |
32 import java.io.DataOutputStream; |
32 import java.io.DataOutputStream; |
33 import java.io.IOException; |
33 import java.io.IOException; |
58 public void utfDataFormatException() throws IOException { |
58 public void utfDataFormatException() throws IOException { |
59 writeUTF(1 << 16); |
59 writeUTF(1 << 16); |
60 } |
60 } |
61 |
61 |
62 // Without 8219196 fix, throws ArrayIndexOutOfBoundsException instead of |
62 // Without 8219196 fix, throws ArrayIndexOutOfBoundsException instead of |
63 // expected UTFDataFormatException. Requires 3GB of heap (-Xmx3g) to run |
63 // expected UTFDataFormatException. Requires 4GB of heap (-Xmx4g) to run |
64 // without throwing an OutOfMemoryError. |
64 // without throwing an OutOfMemoryError. |
65 @Test(expectedExceptions = UTFDataFormatException.class) |
65 @Test(expectedExceptions = UTFDataFormatException.class) |
66 public void arrayIndexOutOfBoundsException() throws IOException { |
66 public void arrayIndexOutOfBoundsException() throws IOException { |
67 writeUTF(Integer.MAX_VALUE / 3 + 1); |
67 writeUTF(Integer.MAX_VALUE / 3 + 1); |
68 } |
68 } |