8198342: Test FileSystemViewListenerLeak.java is unstable

Reviewed-by: jdv, kaddepalli, psadhukhan
This commit is contained in:
Sergey Bylokhov 2018-04-26 17:03:34 -07:00
parent d5987fe58f
commit a6ea22e736
2 changed files with 4 additions and 13 deletions

View File

@ -672,7 +672,6 @@ javax/swing/JComboBox/8182031/ComboPopupTest.java 8196465 linux-all,macosx-all
javax/swing/JFileChooser/6738668/bug6738668.java 8194946 generic-all
javax/swing/JFileChooser/8021253/bug8021253.java 8169954 windows-all,linux-all,macosx-all
javax/swing/JFileChooser/8062561/bug8062561.java 8196466 linux-all,macosx-all
javax/swing/JFileChooser/FileSystemView/FileSystemViewListenerLeak.java 8198342 generic-all
javax/swing/JInternalFrame/Test6325652.java 8196467 linux-all,macosx-all
javax/swing/JInternalFrame/8145896/TestJInternalFrameMaximize.java 8194944 macosx-all
javax/swing/JLabel/6596966/bug6596966.java 8040914 macosx-all

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -23,14 +23,14 @@
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.swing.UIManager;
import javax.swing.filechooser.FileSystemView;
/**
* @test
* @bug 8175968
* @bug 8175968 8198342
* @summary FileSystemView should clean listeners in UIManager before removal
* @library /javax/swing/regtesthelpers
* @build Util
* @run main/othervm -Xmx8m -Djava.awt.headless=true FileSystemViewListenerLeak
@ -39,19 +39,11 @@ public final class FileSystemViewListenerLeak {
public static void main(final String[] args) {
checkListenersCount();
test();
new CustomFileSystemView();
Util.generateOOME();
checkListenersCount();
}
private static void test() {
// Will run the test no more than 30 seconds
long endtime = System.nanoTime() + TimeUnit.SECONDS.toNanos(30);
while (!(endtime - System.nanoTime() < 0)) {
new CustomFileSystemView();
}
}
private static void checkListenersCount() {
int length = UIManager.getPropertyChangeListeners().length;
if (length != 0) {