Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/sun/rmi/runtime/Log/4504153/Test4504153.java
38867 views
1
/*
2
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/* @test
25
* @bug 4504153
26
* @summary RMI implementation should not log to two loggers where one is
27
* an ancestor of the other, to avoid unintended or duplicate logging
28
* @author Peter Jones
29
*
30
* @library ../../../../../java/rmi/testlibrary
31
* @build JavaVM
32
* @run main/othervm Test4504153
33
*/
34
35
import java.io.ByteArrayOutputStream;
36
import java.rmi.registry.LocateRegistry;
37
import java.rmi.server.RemoteServer;
38
39
public class Test4504153 {
40
41
private final static String DONE = "Done!";
42
43
public static void main(String[] args) throws Exception {
44
45
System.err.println("\nRegression test for bug 4504153\n");
46
47
ByteArrayOutputStream out = new ByteArrayOutputStream();
48
ByteArrayOutputStream err = new ByteArrayOutputStream();
49
JavaVM vm = new JavaVM(StartRegistry.class.getName(),
50
"-Dsun.rmi.transport.logLevel=v", "", out, err);
51
vm.execute();
52
53
String errString = err.toString();
54
55
System.err.println(
56
"child process's standard error output:\n\n" + err + "\n");
57
58
if (errString.indexOf(DONE) < 0) {
59
throw new RuntimeException("TEST FAILED: " +
60
"failed to collect expected child process output");
61
}
62
63
if (errString.indexOf("TCPEndpoint") >= 0) {
64
throw new RuntimeException("TEST FAILED: " +
65
"unrequested logging output detected");
66
}
67
68
System.err.println("TEST PASSED");
69
}
70
71
public static class StartRegistry {
72
public static void main(String[] args) throws Exception {
73
LocateRegistry.createRegistry(0);
74
System.err.println(DONE);
75
}
76
}
77
}
78
79