author | martin |
Tue, 15 Sep 2015 21:56:04 -0700 | |
changeset 32649 | 2ee9017c7597 |
parent 30046 | cf2c86e1819e |
permissions | -rw-r--r-- |
27754
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
1 |
/* |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
4 |
* |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
8 |
* |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
13 |
* accompanied this code). |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
14 |
* |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
18 |
* |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
21 |
* questions. |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
22 |
*/ |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
23 |
import java.io.ByteArrayInputStream; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
24 |
import java.io.ByteArrayOutputStream; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
25 |
import java.io.FilePermission; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
26 |
import java.io.IOException; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
27 |
import java.lang.ref.Reference; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
28 |
import java.lang.ref.ReferenceQueue; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
29 |
import java.lang.ref.WeakReference; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
30 |
import java.nio.file.Files; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
31 |
import java.nio.file.Paths; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
32 |
import java.security.CodeSource; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
33 |
import java.security.Permission; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
34 |
import java.security.PermissionCollection; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
35 |
import java.security.Permissions; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
36 |
import java.security.Policy; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
37 |
import java.security.ProtectionDomain; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
38 |
import java.util.Arrays; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
39 |
import java.util.Collections; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
40 |
import java.util.Enumeration; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
41 |
import java.util.HashSet; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
42 |
import java.util.List; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
43 |
import java.util.Properties; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
44 |
import java.util.Set; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
45 |
import java.util.UUID; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
46 |
import java.util.concurrent.Callable; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
47 |
import java.util.concurrent.atomic.AtomicBoolean; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
48 |
import java.util.logging.FileHandler; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
49 |
import java.util.logging.Handler; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
50 |
import java.util.logging.LogManager; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
51 |
import java.util.logging.Logger; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
52 |
import java.util.logging.LoggingPermission; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
53 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
54 |
/** |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
55 |
* @test |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
56 |
* @bug 8060132 |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
57 |
* @summary tests that FileHandlers configured on abstract nodes in logging.properties |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
58 |
* will be closed by reset(). |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
59 |
* @run main/othervm ParentLoggerWithHandlerGC UNSECURE |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
60 |
* @run main/othervm ParentLoggerWithHandlerGC SECURE |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
61 |
* @author danielfuchs |
30046 | 62 |
* @key randomness |
27754
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
63 |
*/ |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
64 |
public class ParentLoggerWithHandlerGC { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
65 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
66 |
/** |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
67 |
* We will test the handling of abstract logger nodes with file handlers in |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
68 |
* two configurations: |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
69 |
* UNSECURE: No security manager. |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
70 |
* SECURE: With the security manager present - and the required |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
71 |
* permissions granted. |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
72 |
*/ |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
73 |
public static enum TestCase { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
74 |
UNSECURE, SECURE; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
75 |
public void run(Properties propertyFile) throws Exception { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
76 |
System.out.println("Running test case: " + name()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
77 |
Configure.setUp(this, propertyFile); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
78 |
test(this.name() + " " + propertyFile.getProperty("test.name"), propertyFile); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
79 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
80 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
81 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
82 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
83 |
private static final String PREFIX = |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
84 |
"FileHandler-" + UUID.randomUUID() + ".log"; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
85 |
private static final String userDir = System.getProperty("user.dir", "."); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
86 |
private static final boolean userDirWritable = Files.isWritable(Paths.get(userDir)); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
87 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
88 |
static enum ConfigMode { DEFAULT, ENSURE_CLOSE_ON_RESET_TRUE, ENSURE_CLOSE_ON_RESET_FALSE } |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
89 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
90 |
private static final List<Properties> properties; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
91 |
static { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
92 |
Properties props1 = new Properties(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
93 |
props1.setProperty("test.name", "parent logger with handler"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
94 |
props1.setProperty("test.config.mode", ConfigMode.DEFAULT.name()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
95 |
props1.setProperty(FileHandler.class.getName() + ".pattern", PREFIX); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
96 |
props1.setProperty(FileHandler.class.getName() + ".limit", String.valueOf(Integer.MAX_VALUE)); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
97 |
props1.setProperty(FileHandler.class.getName() + ".level", "ALL"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
98 |
props1.setProperty(FileHandler.class.getName() + ".formatter", "java.util.logging.SimpleFormatter"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
99 |
props1.setProperty("com.foo.handlers", FileHandler.class.getName()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
100 |
props1.setProperty("com.bar.level", "FINEST"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
101 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
102 |
Properties props2 = new Properties(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
103 |
props2.setProperty("test.name", "parent logger with handler"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
104 |
props2.setProperty("test.config.mode", ConfigMode.ENSURE_CLOSE_ON_RESET_TRUE.name()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
105 |
props2.setProperty(FileHandler.class.getName() + ".pattern", PREFIX); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
106 |
props2.setProperty(FileHandler.class.getName() + ".limit", String.valueOf(Integer.MAX_VALUE)); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
107 |
props2.setProperty(FileHandler.class.getName() + ".level", "ALL"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
108 |
props2.setProperty(FileHandler.class.getName() + ".formatter", "java.util.logging.SimpleFormatter"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
109 |
props2.setProperty("com.foo.handlers", FileHandler.class.getName()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
110 |
props2.setProperty("com.foo.handlers.ensureCloseOnReset", "true"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
111 |
props2.setProperty("com.bar.level", "FINEST"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
112 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
113 |
Properties props3 = new Properties(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
114 |
props3.setProperty("test.name", "parent logger with handler"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
115 |
props3.setProperty("test.config.mode", ConfigMode.ENSURE_CLOSE_ON_RESET_FALSE.name()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
116 |
props3.setProperty(FileHandler.class.getName() + ".pattern", PREFIX); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
117 |
props3.setProperty(FileHandler.class.getName() + ".limit", String.valueOf(Integer.MAX_VALUE)); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
118 |
props3.setProperty(FileHandler.class.getName() + ".level", "ALL"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
119 |
props3.setProperty(FileHandler.class.getName() + ".formatter", "java.util.logging.SimpleFormatter"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
120 |
props3.setProperty("com.foo.handlers", FileHandler.class.getName()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
121 |
props3.setProperty("com.foo.handlers.ensureCloseOnReset", "false"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
122 |
props3.setProperty("com.bar.level", "FINEST"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
123 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
124 |
properties = Collections.unmodifiableList(Arrays.asList( |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
125 |
props1, props2, props3)); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
126 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
127 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
128 |
public static void main(String... args) throws Exception { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
129 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
130 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
131 |
if (args == null || args.length == 0) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
132 |
args = new String[] { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
133 |
TestCase.UNSECURE.name(), |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
134 |
TestCase.SECURE.name(), |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
135 |
}; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
136 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
137 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
138 |
try { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
139 |
for (String testName : args) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
140 |
for (Properties propertyFile : properties) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
141 |
TestCase test = TestCase.valueOf(testName); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
142 |
test.run(propertyFile); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
143 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
144 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
145 |
} finally { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
146 |
if (userDirWritable) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
147 |
Configure.doPrivileged(() -> { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
148 |
// cleanup - delete files that have been created |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
149 |
try { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
150 |
Files.list(Paths.get(userDir)) |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
151 |
.filter((f) -> f.toString().contains(PREFIX)) |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
152 |
.forEach((f) -> { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
153 |
try { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
154 |
System.out.println("deleting " + f); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
155 |
Files.delete(f); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
156 |
} catch(Throwable t) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
157 |
System.err.println("Failed to delete " + f + ": " + t); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
158 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
159 |
}); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
160 |
} catch(Throwable t) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
161 |
System.err.println("Cleanup failed to list files: " + t); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
162 |
t.printStackTrace(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
163 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
164 |
}); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
165 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
166 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
167 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
168 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
169 |
static class Configure { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
170 |
static Policy policy = null; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
171 |
static final AtomicBoolean allowAll = new AtomicBoolean(false); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
172 |
static void setUp(TestCase test, Properties propertyFile) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
173 |
switch (test) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
174 |
case SECURE: |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
175 |
if (policy == null && System.getSecurityManager() != null) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
176 |
throw new IllegalStateException("SecurityManager already set"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
177 |
} else if (policy == null) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
178 |
policy = new SimplePolicy(TestCase.SECURE, allowAll); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
179 |
Policy.setPolicy(policy); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
180 |
System.setSecurityManager(new SecurityManager()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
181 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
182 |
if (System.getSecurityManager() == null) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
183 |
throw new IllegalStateException("No SecurityManager."); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
184 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
185 |
if (policy == null) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
186 |
throw new IllegalStateException("policy not configured"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
187 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
188 |
break; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
189 |
case UNSECURE: |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
190 |
if (System.getSecurityManager() != null) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
191 |
throw new IllegalStateException("SecurityManager already set"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
192 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
193 |
break; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
194 |
default: |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
195 |
new InternalError("No such testcase: " + test); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
196 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
197 |
doPrivileged(() -> { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
198 |
try { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
199 |
ByteArrayOutputStream bytes = new ByteArrayOutputStream(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
200 |
propertyFile.store(bytes, propertyFile.getProperty("test.name")); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
201 |
ByteArrayInputStream bais = new ByteArrayInputStream(bytes.toByteArray()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
202 |
LogManager.getLogManager().readConfiguration(bais); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
203 |
} catch (IOException ex) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
204 |
throw new RuntimeException(ex); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
205 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
206 |
}); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
207 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
208 |
static void doPrivileged(Runnable run) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
209 |
allowAll.set(true); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
210 |
try { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
211 |
run.run(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
212 |
} finally { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
213 |
allowAll.set(false); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
214 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
215 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
216 |
static <T> T callPrivileged(Callable<T> call) throws Exception { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
217 |
allowAll.set(true); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
218 |
try { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
219 |
return call.call(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
220 |
} finally { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
221 |
allowAll.set(false); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
222 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
223 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
224 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
225 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
226 |
@FunctionalInterface |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
227 |
public static interface FileHandlerSupplier { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
228 |
public FileHandler test() throws Exception; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
229 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
230 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
231 |
static final class TestAssertException extends RuntimeException { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
232 |
TestAssertException(String msg) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
233 |
super(msg); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
234 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
235 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
236 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
237 |
private static void assertEquals(long expected, long received, String msg) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
238 |
if (expected != received) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
239 |
throw new TestAssertException("Unexpected result for " + msg |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
240 |
+ ".\n\texpected: " + expected |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
241 |
+ "\n\tactual: " + received); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
242 |
} else { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
243 |
System.out.println("Got expected " + msg + ": " + received); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
244 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
245 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
246 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
247 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
248 |
public static void test(String name, Properties props) throws Exception { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
249 |
ConfigMode configMode = ConfigMode.valueOf(props.getProperty("test.config.mode")); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
250 |
System.out.println("\nTesting: " + name + " mode=" + configMode); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
251 |
if (!userDirWritable) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
252 |
throw new RuntimeException("Not writable: "+userDir); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
253 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
254 |
switch(configMode) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
255 |
case DEFAULT: |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
256 |
case ENSURE_CLOSE_ON_RESET_TRUE: |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
257 |
testCloseOnResetTrue(name, props); break; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
258 |
case ENSURE_CLOSE_ON_RESET_FALSE: |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
259 |
testCloseOnResetFalse(name, props); break; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
260 |
default: |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
261 |
throw new RuntimeException("Unknwown mode: " + configMode); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
262 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
263 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
264 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
265 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
266 |
// Test a configuration which has either |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
267 |
// com.foo.handlers.ensureCloseOnReset=true, or where |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
268 |
// com.foo.handlers.ensureCloseOnReset is not specified. |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
269 |
public static void testCloseOnResetTrue(String name, Properties props) |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
270 |
throws Exception { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
271 |
Logger fooChild = Logger.getLogger("com.foo.child"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
272 |
fooChild.info("hello world"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
273 |
Logger barChild = Logger.getLogger("com.bar.child"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
274 |
barChild.info("hello world"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
275 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
276 |
ReferenceQueue<Logger> queue = new ReferenceQueue(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
277 |
WeakReference<Logger> fooRef = new WeakReference<>(Logger.getLogger("com.foo"), queue); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
278 |
if (fooRef.get() != fooChild.getParent()) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
279 |
throw new RuntimeException("Unexpected parent logger: " |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
280 |
+ fooChild.getParent() +"\n\texpected: " + fooRef.get()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
281 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
282 |
WeakReference<Logger> barRef = new WeakReference<>(Logger.getLogger("com.bar"), queue); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
283 |
if (barRef.get() != barChild.getParent()) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
284 |
throw new RuntimeException("Unexpected parent logger: " |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
285 |
+ barChild.getParent() +"\n\texpected: " + barRef.get()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
286 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
287 |
fooChild = barChild = null; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
288 |
Reference<? extends Logger> ref2 = null; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
289 |
while ((ref2 = queue.poll()) == null) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
290 |
System.gc(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
291 |
Thread.sleep(1000); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
292 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
293 |
Throwable failed = null; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
294 |
try { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
295 |
do { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
296 |
if (ref2 != barRef) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
297 |
throw new RuntimeException("Unexpected reference: " |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
298 |
+ ref2 +"\n\texpected: " + barRef); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
299 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
300 |
if (ref2.get() != null) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
301 |
throw new RuntimeException("Referent not cleared: " |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
302 |
+ ref2.get()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
303 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
304 |
System.out.println("Got barRef"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
305 |
System.gc(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
306 |
Thread.sleep(1000); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
307 |
} while( (ref2 = queue.poll()) != null); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
308 |
System.out.println("Parent logger GCed"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
309 |
} catch(Throwable t) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
310 |
failed = t; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
311 |
} finally { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
312 |
final Throwable suppressed = failed; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
313 |
Configure.doPrivileged(() -> LogManager.getLogManager().reset()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
314 |
Configure.doPrivileged(() -> { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
315 |
try { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
316 |
StringBuilder builder = new StringBuilder(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
317 |
Files.list(Paths.get(userDir)) |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
318 |
.filter((f) -> f.toString().contains(PREFIX)) |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
319 |
.filter((f) -> f.toString().endsWith(".lck")) |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
320 |
.forEach((f) -> { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
321 |
builder.append(f.toString()).append('\n'); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
322 |
}); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
323 |
if (!builder.toString().isEmpty()) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
324 |
throw new RuntimeException("Lock files not cleaned:\n" |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
325 |
+ builder.toString()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
326 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
327 |
} catch(RuntimeException | Error x) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
328 |
if (suppressed != null) x.addSuppressed(suppressed); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
329 |
throw x; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
330 |
} catch(Exception x) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
331 |
if (suppressed != null) x.addSuppressed(suppressed); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
332 |
throw new RuntimeException(x); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
333 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
334 |
}); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
335 |
while ((ref2 = queue.poll()) == null) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
336 |
System.gc(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
337 |
Thread.sleep(1000); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
338 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
339 |
if (ref2 != fooRef) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
340 |
throw new RuntimeException("Unexpected reference: " |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
341 |
+ ref2 +"\n\texpected: " + fooRef); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
342 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
343 |
if (ref2.get() != null) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
344 |
throw new RuntimeException("Referent not cleared: " + ref2.get()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
345 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
346 |
System.out.println("Got fooRef after reset()"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
347 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
348 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
349 |
if (failed != null) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
350 |
// should rarely happen... |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
351 |
throw new RuntimeException(failed); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
352 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
353 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
354 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
355 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
356 |
private static Handler getHandlerToClose() throws Exception { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
357 |
return Configure.callPrivileged( |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
358 |
() -> Logger.getLogger("com.foo.child").getParent().getHandlers()[0]); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
359 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
360 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
361 |
// Test a configuration which has com.foo.handlers.ensureCloseOnReset=false |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
362 |
public static void testCloseOnResetFalse(String name, Properties props) |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
363 |
throws Exception { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
364 |
Logger fooChild = Logger.getLogger("com.foo.child"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
365 |
fooChild.info("hello world"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
366 |
Logger barChild = Logger.getLogger("com.bar.child"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
367 |
barChild.info("hello world"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
368 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
369 |
Handler toClose = getHandlerToClose(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
370 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
371 |
ReferenceQueue<Logger> queue = new ReferenceQueue(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
372 |
WeakReference<Logger> fooRef = new WeakReference<>(Logger.getLogger("com.foo"), queue); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
373 |
if (fooRef.get() != fooChild.getParent()) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
374 |
throw new RuntimeException("Unexpected parent logger: " |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
375 |
+ fooChild.getParent() +"\n\texpected: " + fooRef.get()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
376 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
377 |
WeakReference<Logger> barRef = new WeakReference<>(Logger.getLogger("com.bar"), queue); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
378 |
if (barRef.get() != barChild.getParent()) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
379 |
throw new RuntimeException("Unexpected parent logger: " |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
380 |
+ barChild.getParent() +"\n\texpected: " + barRef.get()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
381 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
382 |
fooChild = barChild = null; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
383 |
Reference<? extends Logger> ref2 = null; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
384 |
Set<WeakReference<Logger>> expectedRefs = new HashSet<>(Arrays.asList(fooRef, barRef)); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
385 |
Throwable failed = null; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
386 |
try { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
387 |
int l=0; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
388 |
while (failed == null && !expectedRefs.isEmpty()) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
389 |
int max = 60; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
390 |
while ((ref2 = queue.poll()) == null) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
391 |
if (l > 0 && max-- <= 0) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
392 |
throw new RuntimeException("Logger #2 not GC'ed!" |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
393 |
+ " max too short (max=60) or " |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
394 |
+ "com.foo.handlers.ensureCloseOnReset=false" |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
395 |
+ " does not work"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
396 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
397 |
System.gc(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
398 |
Thread.sleep(1000); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
399 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
400 |
do { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
401 |
if (!expectedRefs.contains(ref2)) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
402 |
throw new RuntimeException("Unexpected reference: " |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
403 |
+ ref2 +"\n\texpected: " + expectedRefs); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
404 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
405 |
if (ref2.get() != null) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
406 |
throw new RuntimeException("Referent not cleared: " |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
407 |
+ ref2.get()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
408 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
409 |
expectedRefs.remove(ref2); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
410 |
System.out.println("Got "+ |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
411 |
(ref2 == barRef ? "barRef" |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
412 |
: (ref2 == fooRef ? "fooRef" |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
413 |
: ref2.toString()))); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
414 |
System.gc(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
415 |
Thread.sleep(1000); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
416 |
System.out.println("Logger #" + (++l) + " GCed"); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
417 |
} while( (ref2 = queue.poll()) != null); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
418 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
419 |
} catch(Throwable t) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
420 |
failed = t; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
421 |
} finally { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
422 |
final Throwable suppressed = failed; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
423 |
Configure.doPrivileged(() -> LogManager.getLogManager().reset()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
424 |
Configure.doPrivileged(() -> { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
425 |
try { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
426 |
toClose.close(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
427 |
StringBuilder builder = new StringBuilder(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
428 |
Files.list(Paths.get(userDir)) |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
429 |
.filter((f) -> f.toString().contains(PREFIX)) |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
430 |
.filter((f) -> f.toString().endsWith(".lck")) |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
431 |
.forEach((f) -> { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
432 |
builder.append(f.toString()).append('\n'); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
433 |
}); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
434 |
if (!builder.toString().isEmpty()) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
435 |
throw new RuntimeException("Lock files not cleaned:\n" + builder.toString()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
436 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
437 |
} catch(RuntimeException | Error x) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
438 |
if (suppressed != null) x.addSuppressed(suppressed); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
439 |
throw x; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
440 |
} catch(Exception x) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
441 |
if (suppressed != null) x.addSuppressed(suppressed); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
442 |
throw new RuntimeException(x); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
443 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
444 |
}); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
445 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
446 |
if (failed != null) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
447 |
// should rarely happen... |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
448 |
throw new RuntimeException(failed); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
449 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
450 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
451 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
452 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
453 |
|
32649
2ee9017c7597
8136583: Core libraries should use blessed modifier order
martin
parents:
30046
diff
changeset
|
454 |
static final class PermissionsBuilder { |
27754
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
455 |
final Permissions perms; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
456 |
public PermissionsBuilder() { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
457 |
this(new Permissions()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
458 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
459 |
public PermissionsBuilder(Permissions perms) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
460 |
this.perms = perms; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
461 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
462 |
public PermissionsBuilder add(Permission p) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
463 |
perms.add(p); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
464 |
return this; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
465 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
466 |
public PermissionsBuilder addAll(PermissionCollection col) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
467 |
if (col != null) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
468 |
for (Enumeration<Permission> e = col.elements(); e.hasMoreElements(); ) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
469 |
perms.add(e.nextElement()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
470 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
471 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
472 |
return this; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
473 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
474 |
public Permissions toPermissions() { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
475 |
final PermissionsBuilder builder = new PermissionsBuilder(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
476 |
builder.addAll(perms); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
477 |
return builder.perms; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
478 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
479 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
480 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
481 |
public static class SimplePolicy extends Policy { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
482 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
483 |
final Permissions permissions; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
484 |
final Permissions allPermissions; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
485 |
final AtomicBoolean allowAll; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
486 |
public SimplePolicy(TestCase test, AtomicBoolean allowAll) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
487 |
this.allowAll = allowAll; |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
488 |
permissions = new Permissions(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
489 |
permissions.add(new LoggingPermission("control", null)); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
490 |
permissions.add(new FilePermission(PREFIX+".lck", "read,write,delete")); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
491 |
permissions.add(new FilePermission(PREFIX, "read,write")); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
492 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
493 |
// these are used for configuring the test itself... |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
494 |
allPermissions = new Permissions(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
495 |
allPermissions.add(new java.security.AllPermission()); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
496 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
497 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
498 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
499 |
@Override |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
500 |
public boolean implies(ProtectionDomain domain, Permission permission) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
501 |
if (allowAll.get()) return allPermissions.implies(permission); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
502 |
return permissions.implies(permission); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
503 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
504 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
505 |
@Override |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
506 |
public PermissionCollection getPermissions(CodeSource codesource) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
507 |
return new PermissionsBuilder().addAll(allowAll.get() |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
508 |
? allPermissions : permissions).toPermissions(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
509 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
510 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
511 |
@Override |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
512 |
public PermissionCollection getPermissions(ProtectionDomain domain) { |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
513 |
return new PermissionsBuilder().addAll(allowAll.get() |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
514 |
? allPermissions : permissions).toPermissions(); |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
515 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
516 |
} |
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
517 |
|
ee2f7768e1c9
8060132: Handlers configured on abstract nodes in logging.properties are not always properly closed
dfuchs
parents:
diff
changeset
|
518 |
} |