author | duke |
Wed, 05 Jul 2017 17:52:05 +0200 | |
changeset 10620 | 9df40a1578ef |
parent 5506 | 202f599c92aa |
child 31448 | 1066345d2a8a |
permissions | -rw-r--r-- |
4199
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
1 |
/* |
5506 | 2 |
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. |
4199
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
4 |
* |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
8 |
* |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
13 |
* accompanied this code). |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
14 |
* |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
18 |
* |
5506 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
4199
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
22 |
*/ |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
23 |
|
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
24 |
/* |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
25 |
* @test |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
26 |
* @bug 6657026 |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
27 |
* @summary Tests shared UIManager in different application contexts |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
28 |
* @author Sergey Malenkov |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
29 |
*/ |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
30 |
|
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
31 |
import sun.awt.SunToolkit; |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
32 |
|
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
33 |
import javax.swing.UIManager; |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
34 |
import javax.swing.UIManager.LookAndFeelInfo; |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
35 |
|
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
36 |
public class Test6657026 implements Runnable { |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
37 |
|
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
38 |
public static void main(String[] args) throws Exception { |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
39 |
if (UIManager.getInstalledLookAndFeels().length == 0) { |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
40 |
throw new Error("unexpected amount of look&feels"); |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
41 |
} |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
42 |
UIManager.setInstalledLookAndFeels(new LookAndFeelInfo[0]); |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
43 |
if (UIManager.getInstalledLookAndFeels().length != 0) { |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
44 |
throw new Error("unexpected amount of look&feels"); |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
45 |
} |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
46 |
|
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
47 |
ThreadGroup group = new ThreadGroup("$$$"); |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
48 |
Thread thread = new Thread(group, new Test6657026()); |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
49 |
thread.start(); |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
50 |
thread.join(); |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
51 |
} |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
52 |
|
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
53 |
public void run() { |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
54 |
SunToolkit.createNewAppContext(); |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
55 |
if (UIManager.getInstalledLookAndFeels().length == 0) { |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
56 |
throw new Error("shared look&feels"); |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
57 |
} |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
58 |
} |
151e13fd2df1
6657026: Numerous static security flaws in Swing (findbugs)
malenkov
parents:
diff
changeset
|
59 |
} |