# HG changeset patch # User prr # Date 1600536972 0 # Node ID 51233f24cf436f216e10b2dd414203c1ddd3cdca # Parent 7fb344096b3bc3ebaa7f36c3940795bae3178e1b 8249142: java/awt/FontClass/CreateFont/DeleteFont.sh is unstable Reviewed-by: serb diff -r 7fb344096b3b -r 51233f24cf43 test/java/awt/FontClass/CreateFont/DeleteFont.java --- a/test/java/awt/FontClass/CreateFont/DeleteFont.java Thu Aug 13 16:26:17 2015 +0300 +++ b/test/java/awt/FontClass/CreateFont/DeleteFont.java Sat Sep 19 17:36:12 2020 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,8 +21,11 @@ * questions. */ -import java.io.*; -import java.awt.*; +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.InputStream; +import java.io.IOException; +import java.awt.Font; public class DeleteFont { @@ -55,19 +58,22 @@ if (!gotException) { throw new RuntimeException("No expected IOException"); } - badRead(-2, Font.TRUETYPE_FONT); - badRead(8193, Font.TRUETYPE_FONT); - badRead(-2, Font.TYPE1_FONT); - badRead(8193, Font.TYPE1_FONT); + badRead(-2, 16, Font.TYPE1_FONT); + badRead(8193, 14, Font.TYPE1_FONT); + + badRead(-2, 12, Font.TRUETYPE_FONT); + badRead(8193, 10, Font.TRUETYPE_FONT); // Make sure GC has a chance to clean up before we exit. System.gc(); System.gc(); + Thread.sleep(5000); + System.gc(); System.gc(); } - static void badRead(final int retval, int fontType) { + static void badRead(final int retval, final int multiple, int fontType) { int num = 2; - byte[] buff = new byte[16*8192]; // Multiple of 8192 is important. + byte[] buff = new byte[multiple*8192]; // Multiple of 8192 is important. for (int ct=0; ct