Skip to content

Commit d27835b

Browse files
committedSep 19, 2020
8249142: java/awt/FontClass/CreateFont/DeleteFont.sh is unstable
Reviewed-by: serb
1 parent 1438ce0 commit d27835b

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed
 

‎test/jdk/java/awt/FontClass/CreateFont/DeleteFont.java

+15-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
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.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -21,8 +21,11 @@
2121
* questions.
2222
*/
2323

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;
2629

2730
public class DeleteFont {
2831

@@ -55,19 +58,22 @@ public int read() {
5558
if (!gotException) {
5659
throw new RuntimeException("No expected IOException");
5760
}
58-
badRead(-2, Font.TRUETYPE_FONT);
59-
badRead(8193, Font.TRUETYPE_FONT);
6061

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);
6367

6468
// Make sure GC has a chance to clean up before we exit.
6569
System.gc(); System.gc();
70+
Thread.sleep(5000);
71+
System.gc(); System.gc();
6672
}
6773

68-
static void badRead(final int retval, int fontType) {
74+
static void badRead(final int retval, final int multiple, int fontType) {
6975
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.
7177
for (int ct=0; ct<num; ++ct) {
7278
try {
7379
Font.createFont(

‎test/jdk/java/awt/FontClass/CreateFont/DeleteFont.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
# questions.
2121

2222
# @test
23-
# @bug 6189812 6380357 6632886
23+
# @bug 6189812 6380357 6632886 8249142
24+
# @key intermittent
2425
# @summary Verify that temporary font files are deleted on exit.
2526

2627
if [ -z "${TESTSRC}" ]; then

0 commit comments

Comments
 (0)