[Git][java-team/jboss-logmanager][master] 5 commits: New upstream version 2.1.15

Markus Koschany gitlab at salsa.debian.org
Sun Apr 26 00:15:47 BST 2020



Markus Koschany pushed to branch master at Debian Java Maintainers / jboss-logmanager


Commits:
cfbe16e1 by Markus Koschany at 2020-04-26T01:07:04+02:00
New upstream version 2.1.15
- - - - -
76bb1442 by Markus Koschany at 2020-04-26T01:07:05+02:00
Update upstream source from tag 'upstream/2.1.15'

Update to upstream version '2.1.15'
with Debian dir 328443fe8454417d7db5db19598a7ae29da8a0e6
- - - - -
29a318c9 by Markus Koschany at 2020-04-26T01:07:24+02:00
Declare compliance with Debian Policy 4.5.0.

- - - - -
3de0a7a8 by Markus Koschany at 2020-04-26T01:07:58+02:00
Update copyright year

- - - - -
0da54310 by Markus Koschany at 2020-04-26T01:08:24+02:00
Update changelog

- - - - -


10 changed files:

- + .github/workflows/maven.yml
- debian/changelog
- debian/control
- debian/copyright
- pom.xml
- src/main/java/org/jboss/logmanager/ClassLoaderLogContextSelector.java
- src/main/java/org/jboss/logmanager/JDKSpecific.java
- src/main/java/org/jboss/logmanager/LogContext.java
- src/main/java/org/jboss/logmanager/Logger.java
- src/main/java9/org/jboss/logmanager/JDKSpecific.java


Changes:

=====================================
.github/workflows/maven.yml
=====================================
@@ -0,0 +1,41 @@
+# This workflow will build a Java project with Maven
+# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
+
+name: Java CI with Maven
+
+on:
+  push:
+    branches: [ '**' ]
+  pull_request:
+    branches: [ '**' ]
+
+jobs:
+  build:
+
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: [ubuntu-latest, windows-latest ]
+
+    steps:
+      - uses: actions/checkout at v2
+      - uses: actions/cache at v1
+        with:
+          path: ~/.m2/repository
+          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+          restore-keys: |
+            ${{ runner.os }}-maven-
+      - name: Set up JDK 1.8
+        uses: actions/setup-java at v1
+        with:
+          java-version: 1.8
+      - name: Set up JDK 11
+        uses: actions/setup-java at v1
+        with:
+          java-version: 11
+      - name: Build with Maven Linux
+        if: runner.os == 'Linux'
+        run: mvn verify -Djava8.home=$JAVA_HOME_8_X64
+      - name: Build with Maven Windows
+        if: runner.os == 'Windows'
+        run: mvn verify '-Djava8.home="%JAVA_HOME_8_X64%"'


=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+jboss-logmanager (2.1.15-1) unstable; urgency=medium
+
+  * New upstream version 2.1.15.
+  * Declare compliance with Debian Policy 4.5.0.
+
+ -- Markus Koschany <apo at debian.org>  Sun, 26 Apr 2020 01:08:08 +0200
+
 jboss-logmanager (2.1.14-1) unstable; urgency=medium
 
   * New upstream version 2.1.14.


=====================================
debian/control
=====================================
@@ -18,7 +18,7 @@ Build-Depends:
  libmaven-source-plugin-java,
  libwildfly-common-java,
  maven-debian-helper (>= 1.5)
-Standards-Version: 4.4.0
+Standards-Version: 4.5.0
 Vcs-Git: https://salsa.debian.org/java-team/jboss-logmanager.git
 Vcs-Browser: https://salsa.debian.org/java-team/jboss-logmanager
 Homepage: https://github.com/jboss-logging/jboss-logmanager


=====================================
debian/copyright
=====================================
@@ -3,11 +3,11 @@ Upstream-Name: JBoss Log Manager
 Source: https://github.com/jboss-logging/jboss-logmanager
 
 Files: *
-Copyright: 2014-2019, Red Hat, Inc.
+Copyright: 2014-2020, Red Hat, Inc.
 License: Apache-2.0
 
 Files: debian/*
-Copyright: 2015-2019, Markus Koschany <apo at debian.org>
+Copyright: 2015-2020, Markus Koschany <apo at debian.org>
 License: Apache-2.0
 
 License: Apache-2.0


=====================================
pom.xml
=====================================
@@ -28,7 +28,7 @@
     <groupId>org.jboss.logmanager</groupId>
     <artifactId>jboss-logmanager</artifactId>
     <packaging>jar</packaging>
-    <version>2.1.14.Final</version>
+    <version>2.1.15.Final</version>
 
     <parent>
         <groupId>org.jboss</groupId>


=====================================
src/main/java/org/jboss/logmanager/ClassLoaderLogContextSelector.java
=====================================
@@ -20,12 +20,12 @@
 package org.jboss.logmanager;
 
 import java.security.AccessController;
-import java.security.PrivilegedAction;
 import java.security.Permission;
-import java.util.Collection;
+import java.security.PrivilegedAction;
 import java.util.Collections;
 import java.util.Set;
 import java.util.concurrent.ConcurrentMap;
+import java.util.function.Function;
 
 /**
  * A log context selector which chooses a log context based on the caller's classloader.
@@ -88,31 +88,32 @@ public final class ClassLoaderLogContextSelector implements LogContextSelector {
     private final Set<ClassLoader> logApiClassLoaders = Collections.newSetFromMap(new CopyOnWriteMap<ClassLoader, Boolean>());
     private final boolean checkParentClassLoaders;
 
-    private final PrivilegedAction<LogContext> logContextAction = new PrivilegedAction<LogContext>() {
-        public LogContext run() {
-            final Collection<Class<?>> callingClasses = JDKSpecific.findCallingClasses(logApiClassLoaders);
-            for (Class<?> caller : callingClasses) {
-                final LogContext result = check(caller.getClassLoader());
-                if (result != null) {
-                    return result;
-                }
-            }
-            return defaultSelector.getLogContext();
-        }
+    private final Function<ClassLoader, LogContext> logContextFinder = new Function<ClassLoader, LogContext>() {
+        @Override
+        public LogContext apply(final ClassLoader classLoader) {
 
-        private LogContext check(final ClassLoader classLoader) {
             final LogContext context = contextMap.get(classLoader);
             if (context != null) {
                 return context;
             }
             final ClassLoader parent = classLoader.getParent();
-            if (parent != null && checkParentClassLoaders && ! logApiClassLoaders.contains(parent)) {
-                return check(parent);
+            if (parent != null && checkParentClassLoaders && !logApiClassLoaders.contains(parent)) {
+                return apply(parent);
             }
             return null;
         }
     };
 
+    private final PrivilegedAction<LogContext> logContextAction = new PrivilegedAction<LogContext>() {
+        public LogContext run() {
+            final LogContext result = JDKSpecific.logContextFinder(logApiClassLoaders, logContextFinder);
+            if (result != null) {
+                return result;
+            }
+            return defaultSelector.getLogContext();
+        }
+    };
+
     /**
      * {@inheritDoc}  This instance will consult the call stack to see if any calling classloader is associated
      * with any log context.


=====================================
src/main/java/org/jboss/logmanager/JDKSpecific.java
=====================================
@@ -21,9 +21,8 @@ package org.jboss.logmanager;
 
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.util.Collection;
-import java.util.LinkedHashSet;
 import java.util.Set;
+import java.util.function.Function;
 
 import org.jboss.modules.Module;
 import org.jboss.modules.Version;
@@ -69,15 +68,17 @@ final class JDKSpecific {
         return null;
     }
 
-    static Collection<Class<?>> findCallingClasses(Set<ClassLoader> rejectClassLoaders) {
-        final Collection<Class<?>> result = new LinkedHashSet<>();
+    static LogContext logContextFinder(Set<ClassLoader> rejectClassLoaders, final Function<ClassLoader, LogContext> finder) {
         for (Class<?> caller : GATEWAY.getClassContext()) {
             final ClassLoader classLoader = caller.getClassLoader();
             if (classLoader != null && !rejectClassLoaders.contains(classLoader)) {
-                result.add(caller);
+                final LogContext result = finder.apply(classLoader);
+                if (result != null) {
+                    return result;
+                }
             }
         }
-        return result;
+        return null;
     }
 
     static void calculateCaller(ExtLogRecord logRecord) {


=====================================
src/main/java/org/jboss/logmanager/LogContext.java
=====================================
@@ -422,6 +422,10 @@ public final class LogContext implements Protectable, AutoCloseable {
      * @param closeHandler the close handler to use
      */
     public void addCloseHandler(final AutoCloseable closeHandler) {
+        final SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(CONTROL_PERMISSION);
+        }
         synchronized (treeLock) {
             closeHandlers.add(closeHandler);
         }
@@ -449,6 +453,10 @@ public final class LogContext implements Protectable, AutoCloseable {
      * @param closeHandlers the close handlers to use
      */
     public void setCloseHandlers(final Collection<AutoCloseable> closeHandlers) {
+        final SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(CONTROL_PERMISSION);
+        }
         synchronized (treeLock) {
             this.closeHandlers.clear();
             this.closeHandlers.addAll(closeHandlers);


=====================================
src/main/java/org/jboss/logmanager/Logger.java
=====================================
@@ -83,8 +83,8 @@ public final class Logger extends java.util.logging.Logger implements Serializab
     Logger(final LoggerNode loggerNode, final String name) {
         // Don't set up the bundle in the parent...
         super(name, null);
-        // We maintain our own level
-        super.setLevel(Level.ALL);
+        // We have to propagate our level to an internal data structure in the superclass
+        super.setLevel(loggerNode.getLevel());
         this.loggerNode = loggerNode;
     }
 
@@ -116,6 +116,8 @@ public final class Logger extends java.util.logging.Logger implements Serializab
      */
     public void setLevel(Level newLevel) throws SecurityException {
         LogContext.checkAccess(loggerNode.getContext());
+        // We have to propagate our level to an internal data structure in the superclass
+        super.setLevel(newLevel);
         loggerNode.setLevel(newLevel);
     }
 


=====================================
src/main/java9/org/jboss/logmanager/JDKSpecific.java
=====================================
@@ -23,10 +23,8 @@ import static java.security.AccessController.doPrivileged;
 
 import java.lang.module.ModuleDescriptor;
 import java.security.PrivilegedAction;
-import java.util.Collection;
 import java.util.EnumSet;
 import java.util.Iterator;
-import java.util.LinkedHashSet;
 import java.util.Optional;
 import java.util.Set;
 import java.util.function.Function;
@@ -64,12 +62,12 @@ final class JDKSpecific {
         }
     }
 
-    static Collection<Class<?>> findCallingClasses(Set<ClassLoader> rejectClassLoaders) {
+    static LogContext logContextFinder(Set<ClassLoader> rejectClassLoaders, final Function<ClassLoader, LogContext> finder) {
         final SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
-            return doPrivileged(new FindCallingClassesAction(rejectClassLoaders));
+            return doPrivileged(new FindCallingClassesAction(rejectClassLoaders, finder));
         } else {
-            return WALKER.walk(new FindAllWalkFunction(rejectClassLoaders));
+            return WALKER.walk(new FindAllWalkFunction(rejectClassLoaders, finder));
         }
     }
 
@@ -163,15 +161,17 @@ final class JDKSpecific {
         }
     }
 
-    static final class FindCallingClassesAction implements PrivilegedAction<Collection<Class<?>>> {
+    static final class FindCallingClassesAction implements PrivilegedAction<LogContext> {
         private final Set<ClassLoader> rejectClassLoaders;
+        private final Function<ClassLoader, LogContext> finder;
 
-        FindCallingClassesAction(final Set<ClassLoader> rejectClassLoaders) {
+        FindCallingClassesAction(final Set<ClassLoader> rejectClassLoaders, final Function<ClassLoader, LogContext> finder) {
             this.rejectClassLoaders = rejectClassLoaders;
+            this.finder = finder;
         }
 
-        public Collection<Class<?>> run() {
-            return WALKER.walk(new FindAllWalkFunction(rejectClassLoaders));
+        public LogContext run() {
+            return WALKER.walk(new FindAllWalkFunction(rejectClassLoaders, finder));
         }
     }
 
@@ -195,24 +195,29 @@ final class JDKSpecific {
         }
     }
 
-    static final class FindAllWalkFunction implements Function<Stream<StackWalker.StackFrame>, Collection<Class<?>>> {
+    static final class FindAllWalkFunction implements Function<Stream<StackWalker.StackFrame>, LogContext> {
         private final Set<ClassLoader> rejectClassLoaders;
+        private final Function<ClassLoader, LogContext> finder;
 
-        FindAllWalkFunction(final Set<ClassLoader> rejectClassLoaders) {
+        FindAllWalkFunction(final Set<ClassLoader> rejectClassLoaders, final Function<ClassLoader, LogContext> finder) {
             this.rejectClassLoaders = rejectClassLoaders;
+            this.finder = finder;
         }
 
-        public Collection<Class<?>> apply(final Stream<StackWalker.StackFrame> stream) {
-            final Collection<Class<?>> results = new LinkedHashSet<>();
+        @Override
+        public LogContext apply(final Stream<StackWalker.StackFrame> stream) {
             final Iterator<StackWalker.StackFrame> iterator = stream.iterator();
             while (iterator.hasNext()) {
                 final Class<?> clazz = iterator.next().getDeclaringClass();
                 final ClassLoader classLoader = clazz.getClassLoader();
                 if (classLoader != null && ! rejectClassLoaders.contains(classLoader)) {
-                    results.add(clazz);
+                    final LogContext result = finder.apply(classLoader);
+                    if (result != null) {
+                        return result;
+                    }
                 }
             }
-            return results;
+            return null;
         }
     }
 }



View it on GitLab: https://salsa.debian.org/java-team/jboss-logmanager/-/compare/3509df11926d17f816473f05839066101c7c448d...0da5431072602bd908dd20a98bf28e8124fc34c0

-- 
View it on GitLab: https://salsa.debian.org/java-team/jboss-logmanager/-/compare/3509df11926d17f816473f05839066101c7c448d...0da5431072602bd908dd20a98bf28e8124fc34c0
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20200425/7e54fa34/attachment.html>


More information about the pkg-java-commits mailing list