test/jdk/java/security/AccessController/DoPrivAccomplice.java
author shade
Tue, 15 Oct 2019 19:38:59 +0200
changeset 58604 791217cdc433
parent 47216 71c04702a3d5
permissions -rw-r--r--
8232205: Shenandoah: missing "Update References" -> "Update Roots" tracing Reviewed-by: rkennke, zgu
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26362
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
     1
/*
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
     2
 * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
     4
 *
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    10
 *
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    15
 * accompanied this code).
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    16
 *
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    20
 *
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    23
 * questions.
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    24
 */
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    25
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    26
public class DoPrivAccomplice {
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    27
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    28
    public String go() {
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    29
        String name = (String)java.security.AccessController.
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    30
                doPrivileged((java.security.PrivilegedAction)() ->
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    31
                        System.getProperty("user.name"));
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    32
        return name;
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    33
    }
b1e9b551e10a 8048362: Tests for doPrivileged with accomplice
xuelei
parents:
diff changeset
    34
}