< prev index next >
test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java
Print this page
rev 47439 : 8189291: Test policy should extend the default system policy
Reviewed-by:
*** 1,7 ****
/*
! * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 54,64 ****
import java.util.concurrent.atomic.AtomicReference;
import jdk.internal.logger.SimpleConsoleLogger;
/**
* @test
! * @bug 8140364
* @summary JDK implementation specific unit test for LoggerFinderLoader.
* Tests the behavior of LoggerFinderLoader with respect to the
* value of the internal diagnosability switches. Also test the
* DefaultLoggerFinder and SimpleConsoleLogger implementation.
* @modules java.base/sun.util.logging
--- 54,64 ----
import java.util.concurrent.atomic.AtomicReference;
import jdk.internal.logger.SimpleConsoleLogger;
/**
* @test
! * @bug 8140364 8189291
* @summary JDK implementation specific unit test for LoggerFinderLoader.
* Tests the behavior of LoggerFinderLoader with respect to the
* value of the internal diagnosability switches. Also test the
* DefaultLoggerFinder and SimpleConsoleLogger implementation.
* @modules java.base/sun.util.logging
*** 94,103 ****
--- 94,104 ----
* @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader -Djdk.logger.finder.singleton=true -Djdk.logger.finder.error=QUIET LoggerFinderLoaderTest WITHPERMISSIONS
* @author danielfuchs
*/
public class LoggerFinderLoaderTest {
+ static final Policy DEFAULT_POLICY = Policy.getPolicy();
static final RuntimePermission LOGGERFINDER_PERMISSION =
new RuntimePermission("loggerFinder");
final static boolean VERBOSE = false;
static final ThreadLocal<AtomicBoolean> allowControl = new ThreadLocal<AtomicBoolean>() {
@Override
*** 864,874 ****
return permissions;
}
@Override
public boolean implies(ProtectionDomain domain, Permission permission) {
! return getPermissions().implies(permission);
}
@Override
public PermissionCollection getPermissions(CodeSource codesource) {
return new PermissionsBuilder().addAll(getPermissions()).toPermissions();
--- 865,876 ----
return permissions;
}
@Override
public boolean implies(ProtectionDomain domain, Permission permission) {
! return getPermissions().implies(permission) ||
! DEFAULT_POLICY.implies(domain, permission);
}
@Override
public PermissionCollection getPermissions(CodeSource codesource) {
return new PermissionsBuilder().addAll(getPermissions()).toPermissions();
< prev index next >