aboutsummaryrefslogtreecommitdiffstats
path: root/tests/reproducers/custom/JNLPClassLoaderDeadlock/srcs/JNLPClassLoaderDeadlock_2.java
blob: a3c0788a9b88e00c602bb8622dc973f412e03322 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import java.applet.Applet;
import java.awt.*;

import java.security.*;
import java.util.PropertyPermission;

public class JNLPClassLoaderDeadlock_2 extends Applet implements Runnable {

    private static final String propertyNames[] = {
        "java.version",
        "java.vendor",
        "java.vendor.url",
        "java.home",
        "java.vm.specification.version",
        "java.vm.specification.vendor",
        "java.vm.specification.name",
        "java.vm.version",
        "java.vm.name",
        "java.vm.home",
        "java.specification.version",
        "java.specification.vendor",
        "java.specification.name",
        "java.class.version",
        "java.class.path",
        "os.name",
        "os.arch",
        "os.version",
        "file.separator",
        "path.separator",
        "line.separator",
        "user.home",
        "user.name",
        "user.dir",
    };

    private Label[] propertyValues;

    @Override
    public void init() {
        System.out.println("JNLPClassLoaderDeadlock_2 applet initialized");
        GridBagLayout gridbaglayout = new GridBagLayout();
        setLayout(gridbaglayout);

        GridBagConstraints leftColumn = new GridBagConstraints();
        leftColumn.anchor = 20;
        leftColumn.ipadx = 16;

        GridBagConstraints rightColumn = new GridBagConstraints();
        rightColumn.fill = 2;
        rightColumn.gridwidth = 0;
        rightColumn.weightx = 1.0D;

        Label labels[] = new Label[propertyNames.length];
        propertyValues = new Label[propertyNames.length];
        final String preloadText = "...";

        for (int i = 0; i < propertyNames.length; ++i) {
            labels[i] = new Label(propertyNames[i]);
            gridbaglayout.setConstraints(labels[i], leftColumn);
            add(labels[i]);

            propertyValues[i] = new Label(preloadText);
            gridbaglayout.setConstraints(propertyValues[i], rightColumn);
            add(propertyValues[i]);
        }

        Thread t = new Thread(this);
        t.start();
    }

    @Override
    public void run() {
        for (int i = 0; i < propertyNames.length; ++i) {
            try {
                final String propertyValue = System.getProperty(propertyNames[i]);
                propertyValues[i].setText(propertyValue);
            } catch (SecurityException securityexception) {
            }
        }
        System.out.println("JNLPClassLoaderDeadlock_2 applet finished");
    }
}