8198342: Test FileSystemViewListenerLeak.java is unstable
Reviewed-by: jdv, kaddepalli, psadhukhan
--- a/test/jdk/ProblemList.txt Thu Apr 26 13:33:11 2018 -0700
+++ b/test/jdk/ProblemList.txt Thu Apr 26 17:03:34 2018 -0700
@@ -672,7 +672,6 @@
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
--- a/test/jdk/javax/swing/JFileChooser/FileSystemView/FileSystemViewListenerLeak.java Thu Apr 26 13:33:11 2018 -0700
+++ b/test/jdk/javax/swing/JFileChooser/FileSystemView/FileSystemViewListenerLeak.java Thu Apr 26 17:03:34 2018 -0700
@@ -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 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) {