Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8249142: java/awt/FontClass/CreateFont/DeleteFont.sh is unstable #256

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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 @@ public int read() {
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<num; ++ct) {
try {
Font.createFont(
@@ -20,7 +20,8 @@
# questions.

# @test
# @bug 6189812 6380357 6632886
# @bug 6189812 6380357 6632886 8249142
# @key intermittent
# @summary Verify that temporary font files are deleted on exit.

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