< prev index next >
src/java.base/share/classes/jdk/internal/logger/DefaultLoggerFinder.java
Print this page
*** 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. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2015, 2016, 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. Oracle designates this
*** 135,151 ****
final static SharedLoggers system = new SharedLoggers();
final static SharedLoggers application = new SharedLoggers();
}
public static boolean isSystem(Module m) {
! ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
! public ClassLoader run() {
! return m.getClassLoader();
}
});
! return cl == null;
}
@Override
public final Logger getLogger(String name, Module module) {
checkPermission();
--- 135,159 ----
final static SharedLoggers system = new SharedLoggers();
final static SharedLoggers application = new SharedLoggers();
}
public static boolean isSystem(Module m) {
! final boolean isSystem = AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
! public Boolean run() {
! final ClassLoader moduleCL = m.getClassLoader();
! if (moduleCL == null) return true;
! ClassLoader cl = ClassLoader.getPlatformClassLoader();
! while (cl != null && moduleCL != cl) {
! cl = cl.getParent();
! }
! // returns true if moduleCL is the platform class loader
! // or one of its ancestors.
! return moduleCL == cl;
}
});
! return isSystem;
}
@Override
public final Logger getLogger(String name, Module module) {
checkPermission();
< prev index next >