|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
|
21 | 21 | * questions.
|
22 | 22 | */
|
23 | 23 |
|
24 |
| -import java.io.*; |
25 |
| -import java.awt.*; |
| 24 | +import java.io.ByteArrayInputStream; |
| 25 | +import java.io.FileInputStream; |
| 26 | +import java.io.InputStream; |
| 27 | +import java.io.IOException; |
| 28 | +import java.awt.Font; |
26 | 29 |
|
27 | 30 | public class DeleteFont {
|
28 | 31 |
|
@@ -55,19 +58,22 @@ public int read() {
|
55 | 58 | if (!gotException) {
|
56 | 59 | throw new RuntimeException("No expected IOException");
|
57 | 60 | }
|
58 |
| - badRead(-2, Font.TRUETYPE_FONT); |
59 |
| - badRead(8193, Font.TRUETYPE_FONT); |
60 | 61 |
|
61 |
| - badRead(-2, Font.TYPE1_FONT); |
62 |
| - badRead(8193, Font.TYPE1_FONT); |
| 62 | + badRead(-2, 16, Font.TYPE1_FONT); |
| 63 | + badRead(8193, 14, Font.TYPE1_FONT); |
| 64 | + |
| 65 | + badRead(-2, 12, Font.TRUETYPE_FONT); |
| 66 | + badRead(8193, 10, Font.TRUETYPE_FONT); |
63 | 67 |
|
64 | 68 | // Make sure GC has a chance to clean up before we exit.
|
65 | 69 | System.gc(); System.gc();
|
| 70 | + Thread.sleep(5000); |
| 71 | + System.gc(); System.gc(); |
66 | 72 | }
|
67 | 73 |
|
68 |
| - static void badRead(final int retval, int fontType) { |
| 74 | + static void badRead(final int retval, final int multiple, int fontType) { |
69 | 75 | int num = 2;
|
70 |
| - byte[] buff = new byte[16*8192]; // Multiple of 8192 is important. |
| 76 | + byte[] buff = new byte[multiple*8192]; // Multiple of 8192 is important. |
71 | 77 | for (int ct=0; ct<num; ++ct) {
|
72 | 78 | try {
|
73 | 79 | Font.createFont(
|
|
0 commit comments