Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package apache-commons-logging for
openSUSE:Factory checked in at 2024-08-14 14:13:53
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/apache-commons-logging (Old)
and /work/SRC/openSUSE:Factory/.apache-commons-logging.new.7232 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "apache-commons-logging"
Wed Aug 14 14:13:53 2024 rev:26 rq:1193680 version:1.3.3
Changes:
--------
---
/work/SRC/openSUSE:Factory/apache-commons-logging/apache-commons-logging.changes
2024-02-21 17:52:20.578458036 +0100
+++
/work/SRC/openSUSE:Factory/.apache-commons-logging.new.7232/apache-commons-logging.changes
2024-08-14 14:14:01.930485459 +0200
@@ -1,0 +2,83 @@
+Fri Aug 9 08:05:34 UTC 2024 - Gus Kenion <[email protected]>
+
+- Upgrade to 1.3.3
+ * Bug Fixes:
+ + * LOGGING-193: Update Log4j 2 OSGi imports #268.
+ + * Fix PMD UnnecessaryFullyQualifiedName in SimpleLog.
+ + * Fix NullPointerException in SimpleLog#write(Object) on null
+ input.
+ + Fix NullPointerException in SimpleLog#write(StringBuffer) on
+ null input.
+- Includes changes from 1.3.2
+ * Fixed Bugs
+ + LOGGING-190: Add OSGi metadata to enable Service Loader
+ Mediator #234.
+ + LOGGING-191: Apache commons logging shows 1.4 as latest
+ release instead of 1.3.1.
+ + Deprecate
+ org.apache.commons.logging.LogSource.jdk14IsAvailable.
+- Includes changes from 1.3.1
+ * New features
+ + Add Maven property project.build.outputTimestamp for build
+ reproducibility.
+ * Fixed Bugs
+ + Remove references to very old JDK and Commons Logging
+ versions #201.
+ + Update from Logj 1 to the Log4j 2 API compatibility layer
+ #231.
+ + Allow Servlet 4 in OSGi environment #191.
+ + Fix generics warnings #213.
+ + LOGGING-189: Fix Import-Package entry for org.slf4j #188.
+- Includes changes from 1.3.0
+ * New Features:
+ + Add support for Log4j API and SLF4J #177.
+ + Deprecate org.apache.commons.logging.impl.WeakHashtable
+ without replacement. LOGGING-188: Deprecate and disable
+ `Jdk13LumberjackLogger` and `Log4JLogger`. LOGGING-173:
+ + Deprecate and disable `AvalonLogger` and `LogKitLogger`.
+ + LOGGING-165: Add Automatic-Module-Name Manifest Header for
+ Java 9 compatibility.
+ * Fixed Bugs:
+ + LOGGING-163: BufferedReader is not closed properly.
+ + LOGGING-177: Remove redundant initializer #46
+ + Use a weak reference for the cached class loader #71.
+ + Add more entries to .gitignore file #25.
+ + Minor Improvements #34.
+ + [StepSecurity] ci: Harden GitHub Actions #145.
+ + LOGGING-185: Replace custom code with `ServiceLoader` call.
+ + Fix possible NPEs in LogFactoryImpl.
+ + LOGGING-185: Fix failing tests #180.
+ + Deprecate LogConfigurationException.cause in favor of
+ getCause().
+ + Fix SpotBugs [ERROR] High: Found reliance on default encoding
+ in org.apache.commons.logging.LogFactory.initDiagnostics():
+ new java.io.PrintStream(OutputStream)
+ [org.apache.commons.logging.LogFactory] At
+ LogFactory.java:[line 1205] DM_DEFAULT_ENCODING.
+ + Fix SpotBugs [ERROR] Medium: Class
+ org.apache.commons.logging.impl.WeakHashtable defines
+ non-transient non-serializable instance field queue
+ [org.apache.commons.logging.impl.WeakHashtable] In
+ WeakHashtable.java SE_BAD_FIELD.
+ + Set java.logging as optional module #183.
+ + Fix SpotBugs [ERROR] Medium: Switch statement found in
+ org.apache.commons.logging.impl.SimpleLog.log(int, Object,
+ Throwable) where default case is missing
+ [org.apache.commons.logging.impl.SimpleLog] At
+ SimpleLog.java:[lines 505-522] SF_SWITCH_NO_DEFAULT.
+ + Deprecate
+ org.apache.commons.logging.impl.Jdk13LumberjackLogger.dummyLevel
+ without replacement.
+- Remove deprecated patch files:
+ * commons-logging-1.1.3-src-junit.diff
+ * commons-logging-1.2-sourcetarget.patch
+ * commons-logging-manifests.patch
+ * no-tests.patch
+- Reinstate ant build (removed upstream)
+ * add build.xml
+ * add build.properties
+- Remove unnecessary dependencies
+ * add commons-logging-1.3.3-dependencies.patch
+- Add upstream dev's public key to apache-commons-logging.keyring
+
+-------------------------------------------------------------------
Old:
----
commons-logging-1.1.3-src-junit.diff
commons-logging-1.2-sourcetarget.patch
commons-logging-1.2-src.tar.gz
commons-logging-1.2-src.tar.gz.asc
commons-logging-manifests.patch
no-tests.patch
New:
----
build.properties
build.xml
commons-logging-1.3.3-dependencies.patch
commons-logging-1.3.3-src.tar.gz
commons-logging-1.3.3-src.tar.gz.asc
BETA DEBUG BEGIN:
Old:- Remove deprecated patch files:
* commons-logging-1.1.3-src-junit.diff
* commons-logging-1.2-sourcetarget.patch
Old: * commons-logging-1.1.3-src-junit.diff
* commons-logging-1.2-sourcetarget.patch
* commons-logging-manifests.patch
Old: * commons-logging-1.2-sourcetarget.patch
* commons-logging-manifests.patch
* no-tests.patch
Old: * commons-logging-manifests.patch
* no-tests.patch
- Reinstate ant build (removed upstream)
BETA DEBUG END:
BETA DEBUG BEGIN:
New:- Remove unnecessary dependencies
* add commons-logging-1.3.3-dependencies.patch
- Add upstream dev's public key to apache-commons-logging.keyring
BETA DEBUG END:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ apache-commons-logging.spec ++++++
--- /var/tmp/diff_new_pack.kda0lz/_old 2024-08-14 14:14:03.246540475 +0200
+++ /var/tmp/diff_new_pack.kda0lz/_new 2024-08-14 14:14:03.250540642 +0200
@@ -20,23 +20,22 @@
%define base_name logging
%define short_name commons-%{base_name}
Name: apache-%{short_name}
-Version: 1.2
+Version: 1.3.3
Release: 0
Summary: Apache Commons Logging
License: Apache-2.0
-URL: http://commons.apache.org/%{base_name}
-Source0:
http://www.apache.org/dist/commons/%{base_name}/source/%{short_name}-%{version}-src.tar.gz
-Source1:
http://www.apache.org/dist/commons/%{base_name}/source/%{short_name}-%{version}-src.tar.gz.asc
+URL: https://commons.apache.org/%{base_name}
+Source0:
https://archive.apache.org/dist/commons/%{base_name}/source/%{short_name}-%{version}-src.tar.gz
+Source1:
https://archive.apache.org/dist/commons/%{base_name}/source/%{short_name}-%{version}-src.tar.gz.asc
Source2: apache-commons-logging.keyring
Source4:
http://central.maven.org/maven2/%{short_name}/%{short_name}-api/1.1/%{short_name}-api-1.1.pom
-Patch0: commons-logging-1.1.3-src-junit.diff
-Patch1: commons-logging-1.2-sourcetarget.patch
-Patch2: commons-logging-manifests.patch
-Patch3: no-tests.patch
+Source5: build.xml
+Source6: build.properties
+Patch0: commons-logging-1.3.3-dependencies.patch
BuildRequires: ant
BuildRequires: glassfish-servlet-api
BuildRequires: java-devel >= 1.8
-BuildRequires: javapackages-local
+BuildRequires: javapackages-local >= 6
BuildRequires: reload4j
Requires: java >= 1.8
Provides: jakarta-%{short_name} = %{version}-%{release}
@@ -59,10 +58,10 @@
%prep
%autosetup -p1 -n %{short_name}-%{version}-src
-sed -i 's/\r//' RELEASE-NOTES.txt LICENSE.txt
+cp %{SOURCE5} build.xml
+cp %{SOURCE6} build.properties
-#FIXME
-rm ./src/test/java/org/apache/commons/logging/servlet/BasicServletTestCase.java
+sed -i 's/\r//' RELEASE-NOTES.txt LICENSE.txt
%pom_remove_parent .
@@ -93,11 +92,11 @@
# pom
install -d -m 755 %{buildroot}%{_mavenpomdir}
-install -pm 644 pom.xml
%{buildroot}/%{_mavenpomdir}/%{short_name}-%{version}.pom
+%mvn_install_pom pom.xml
%{buildroot}/%{_mavenpomdir}/%{short_name}-%{version}.pom
sed 's#<version>1.1</version>#<version>1.2</version>#g' < %{SOURCE4} > tmp.pom
-install -pm 644 tmp.pom
%{buildroot}/%{_mavenpomdir}/%{short_name}-api-%{version}.pom
+%mvn_install_pom tmp.pom
%{buildroot}/%{_mavenpomdir}/%{short_name}-api-%{version}.pom
sed -e 's#<version>1.1</version>#<version>1.2</version>#g' -e
"s#%{short_name}-api#%{short_name}-adapters#g" < %{SOURCE4} > tmp.pom
-install -pm 644 tmp.pom
%{buildroot}/%{_mavenpomdir}/%{short_name}-adapters-%{version}.pom
+%mvn_install_pom tmp.pom
%{buildroot}/%{_mavenpomdir}/%{short_name}-adapters-%{version}.pom
%add_maven_depmap %{short_name}-%{version}.pom %{short_name}.jar -a
"org.apache.commons:%{short_name}","apache:%{short_name}"
%add_maven_depmap %{short_name}-api-%{version}.pom %{short_name}-api.jar -a
"org.apache.commons:%{short_name}-api","apache:%{short_name}-api"
%add_maven_depmap %{short_name}-adapters-%{version}.pom
%{short_name}-adapters.jar -a
"org.apache.commons:%{short_name}-adapters","apache:%{short_name}-adapters"
++++++ apache-commons-logging.keyring ++++++
--- /var/tmp/diff_new_pack.kda0lz/_old 2024-08-14 14:14:03.306542983 +0200
+++ /var/tmp/diff_new_pack.kda0lz/_new 2024-08-14 14:14:03.310543151 +0200
@@ -69,3 +69,42 @@
=ChmV
-----END PGP PUBLIC KEY BLOCK-----
+
+pub 2048R/A11262CB 2011-04-12
+uid Gary David Gregory (Code signing key)
<[email protected]>
+sig 3 A11262CB 2011-04-12 Gary David Gregory (Code signing key)
<[email protected]>
+sub 2048R/AD3D7F94 2011-04-12
+sig A11262CB 2011-04-12 Gary David Gregory (Code signing key)
<[email protected]>
+
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.11 (MingW32)
+
+mQENBE2kzuwBCACYV+G9yxNkSjAKSji0B5ipMGM74JAL1Ogtcu+993pLHHYsdXri
+WWXi37x9PLjeHxw63mN26SFyrbMJ4A8erLB03PDjw0DEzAwiu9P2vSvL/RFxGBbk
+cM0BTNXNR1rk8DpIzvXtejp8IHtD1qcDLTlJ8D0W3USebShDPo6NmMxTNuH0u99B
+WHCMAdSa34wsg0ZpffwQmRxeA+ebrf2ydKupGkeZsKjkLlaXNkTVp1ghn5ts/lvg
+KeHv1SJivWKCRmFlbPhBK4+mxSUSOPdoBNAfxA51QzZoPizSk0VbRz3YufYRVLFy
+9vqPSorDmYJhCvn3f6+A38FS/j8VE+8obQ2rABEBAAG0O0dhcnkgRGF2aWQgR3Jl
+Z29yeSAoQ29kZSBzaWduaW5nIGtleSkgPGdncmVnb3J5QGFwYWNoZS5vcmc+iQE4
+BBMBAgAiBQJNpM7sAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRCG/cfi
+oRJiy2vXCACU6jW2+XIWuWBKSmeowBMxlUMJFSq7QjLt+o6B1ZYClbzBLDKcxlnS
+dF6v0jLhp71LozTde+HFI4/qIv6OO4UaGHin8Z1rNU/i5L07HkhLxcrbDoWhaSGD
+buRsWCv9ljm5GCXyK9s6Uj7d4af9mDWaGhNFJJFIs+yqOvTwffoaB7y+2a1YWStZ
+ZXDJ0KiHdY7xQ7bbYR/61MgvJslF1uX+u4jLTNmbU0tCXLtUrLd2VbJiAMFezqy6
+hV/ZxQLZoBPpr3FYhR2SIzNhQ30nj9AVcPgCCuLD49nx6Ad5CpcP8sTwb4aWk9GK
++Uu3Bfz4jTAvd9Q7TsRMt3NV+7sOGD4vuQENBE2kzuwBCACzeGpkd6X/xTfKDBWv
+XgHOOKIJ2pht9XmtZZKiIj7LIiSwvSds/ZkoZKxAm7AY+KPh8Xjf968FtoUBQJvH
+AG4rbowEqT7OOrJae2JcenH5qzaod7TpIPQVv+Ysz8I1wLlC6LzKRj1X99Hng6X+
+obsEasnPbmEEkuiZ/Sgi4vVC8SHkDmYt1Dx8jDgm53oUeWkEJO9LSI2zcrZhSgvg
+1xa4Q4gY5UUK7gE4LbmGCjFlATuuW/0sryxu8zxph15gkn4Nqgk0CPMSjesMYEGO
+sdDzfQXl2tXbt+Pe6mBoWh67MZ1v5zOq3EDtoSqDpWPxponAeaCuNDDFX44vGjfx
+GE0tABEBAAGJAR8EGAECAAkFAk2kzuwCGwwACgkQhv3H4qESYsvEMAf/VGyqIEcw
+4T2D3gZZ3ITkeoBevQdxBT/27xNvoWOZyGSzGYlRbRQrlo+uZsjfMc9MNvaSmxyy
+4gLVbcdvQr3PF//GxphJ98W8pk9l+M57jfyHnnCumn7MO4o9ed+WuigN5oeuNJ6B
+Iq3ff2o1DsrEvDChYOJEOeFuWxv+u7I2ABJJep7NbByM2n9PE8vlGU3zUBgWUBsk
+6jT+klKnEyHE76WzegPLz3jtElTuyB7jRhjyQJu1yiJEMbs2zH8aJGObi5f8Jum4
+tILZuEAdoI0M3c3VRq12cz/vLy+9VXa/s//8IsGn88kjyyYqOy8WJEjoOXFh++dp
+WiM7nZkgQcNi5A==
+=0UFs
+-----END PGP PUBLIC KEY BLOCK-----
+
++++++ build.properties ++++++
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
######################################################################
#
# TO USE:
#
# Copy this file to build.properties and either
#
# a) Use 'ant getlibs' to populate the default directory
# with dependencies
# or b) Change the property values to appropriate values
#
########################################################################
# Apache Log4j 1.2.x series
log4j12.jar=lib/log4j-1.2.12.jar
# Apache Log4j 1.3.x series
# Note: Log4j 1.3 support not available in the 1.1 release
#log4j13.jar=lib/log4j-1.3.0.jar
# logkit.jar - Avalon LogKit classes (see http://jakarta.apache.org/avalon)
logkit.jar=lib/logkit-1.0.1.jar
# Avalon framework - used for wrapper for avalon framework logger
avalon-framework.jar=lib/avalon-framework-4.1.3.jar
# ServletApi - used to build ServletContextCleaner class
servletapi.jar=lib/servletapi-2.3.jar
#
# if you want to run the test cases, junit needs to be in the classpath.
# the build.xml uses a default value so you might not need to set this property.
# Note that version junit 3.8 is required and 3.8.1 recommended.
#
junit.jar=lib/junit-3.8.1.jar
# Maven properties (for web site build)
# Those committers using agents may like to use
#maven.username=rdonkin
#logging.cvs=lserver:[email protected]:/home/cvs
# The path to a 1.4 JSDK javac
# Optional - used when building with a 1.2 JVM for releases
# executable.javac1.4=/opt/java/jdks/j2sdk1.4.2_10/bin/javac
++++++ build.xml ++++++
++++ 812 lines (skipped)
++++++ commons-logging-1.3.3-dependencies.patch ++++++
--- a/src/main/java/org/apache/commons/logging/impl/Log4jApiLogFactory.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.logging.impl;
-
-import java.io.IOException;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.MarkerManager;
-import org.apache.logging.log4j.spi.AbstractLoggerAdapter;
-import org.apache.logging.log4j.spi.ExtendedLogger;
-import org.apache.logging.log4j.spi.LoggerAdapter;
-import org.apache.logging.log4j.spi.LoggerContext;
-import org.apache.logging.log4j.util.StackLocatorUtil;
-
-/**
- * Logger factory hardcoded to send everything to Log4j API.
- * <p>
- * Based on the `log4j-jcl` artifact from Apache Logging Services.
- * </p>
- *
- * @since 1.3.0
- */
-public final class Log4jApiLogFactory extends LogFactory {
-
- private static final class Log4j2Log implements Log {
-
- private static final String FQCN = Log4j2Log.class.getName();
-
- private final ExtendedLogger logger;
-
- public Log4j2Log(final ExtendedLogger logger) {
- this.logger = logger;
- }
-
- @Override
- public void debug(final Object message) {
- logIfEnabled(Level.DEBUG, message, null);
- }
-
- @Override
- public void debug(final Object message, final Throwable t) {
- logIfEnabled(Level.DEBUG, message, t);
- }
-
- @Override
- public void error(final Object message) {
- logIfEnabled(Level.ERROR, message, null);
- }
-
- @Override
- public void error(final Object message, final Throwable t) {
- logIfEnabled(Level.ERROR, message, t);
- }
-
- @Override
- public void fatal(final Object message) {
- logIfEnabled(Level.FATAL, message, null);
- }
-
- @Override
- public void fatal(final Object message, final Throwable t) {
- logIfEnabled(Level.FATAL, message, t);
- }
-
- @Override
- public void info(final Object message) {
- logIfEnabled(Level.INFO, message, null);
- }
-
- @Override
- public void info(final Object message, final Throwable t) {
- logIfEnabled(Level.INFO, message, t);
- }
-
- @Override
- public boolean isDebugEnabled() {
- return isEnabled(Level.DEBUG);
- }
-
- private boolean isEnabled(final Level level) {
- return logger.isEnabled(level, MARKER, null);
- }
-
- @Override
- public boolean isErrorEnabled() {
- return isEnabled(Level.ERROR);
- }
-
- @Override
- public boolean isFatalEnabled() {
- return isEnabled(Level.FATAL);
- }
-
- @Override
- public boolean isInfoEnabled() {
- return isEnabled(Level.INFO);
- }
-
- @Override
- public boolean isTraceEnabled() {
- return isEnabled(Level.TRACE);
- }
-
- @Override
- public boolean isWarnEnabled() {
- return isEnabled(Level.WARN);
- }
-
- private void logIfEnabled(final Level level, final Object message,
final Throwable t) {
- if (message instanceof CharSequence) {
- logger.logIfEnabled(FQCN, level, MARKER, (CharSequence)
message, t);
- } else {
- logger.logIfEnabled(FQCN, level, MARKER, message, t);
- }
- }
-
- @Override
- public void trace(final Object message) {
- logIfEnabled(Level.TRACE, message, null);
- }
-
- @Override
- public void trace(final Object message, final Throwable t) {
- logIfEnabled(Level.TRACE, message, t);
- }
-
- @Override
- public void warn(final Object message) {
- logIfEnabled(Level.WARN, message, null);
- }
-
- @Override
- public void warn(final Object message, final Throwable t) {
- logIfEnabled(Level.WARN, message, t);
- }
- }
- private static final class LogAdapter extends AbstractLoggerAdapter<Log> {
-
- @Override
- protected LoggerContext getContext() {
- return getContext(LogManager.getFactory().isClassLoaderDependent()
? StackLocatorUtil.getCallerClass(
- LogFactory.class) : null);
- }
-
- @Override
- protected Log newLogger(final String name, final LoggerContext
context) {
- return new Log4j2Log(context.getLogger(name));
- }
-
- }
-
- private static final String[] EMPTY_ARRAY = {};
-
- /**
- * Marker used by all messages coming from Apache Commons Logging.
- */
- private static final Marker MARKER =
MarkerManager.getMarker("COMMONS-LOGGING");
-
- /**
- * Caches Log instances
- */
- private final LoggerAdapter<Log> adapter = new LogAdapter();
-
- private final ConcurrentMap<String, Object> attributes = new
ConcurrentHashMap<>();
-
- /**
- * Constructs a new instance.
- */
- public Log4jApiLogFactory() {
- // empty
- }
-
- @Override
- public Object getAttribute(final String name) {
- return attributes.get(name);
- }
-
- @Override
- public String[] getAttributeNames() {
- return attributes.keySet().toArray(EMPTY_ARRAY);
- }
-
- @Override
- public Log getInstance(final Class<?> clazz) {
- return getInstance(clazz.getName());
- }
-
- @Override
- public Log getInstance(final String name) {
- return adapter.getLogger(name);
- }
-
- /**
- * This method is supposed to clear all loggers. In this implementation it
will clear all the logger
- * wrappers but the loggers managed by the underlying logger context will
not be.
- */
- @Override
- public void release() {
- try {
- adapter.close();
- } catch (final IOException ignored) {
- // Ignore
- }
- }
-
- @Override
- public void removeAttribute(final String name) {
- attributes.remove(name);
- }
-
- @Override
- public void setAttribute(final String name, final Object value) {
- if (value != null) {
- attributes.put(name, value);
- } else {
- removeAttribute(name);
- }
- }
-}
--- a/src/main/java/org/apache/commons/logging/impl/Slf4jLogFactory.java
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.logging.impl;
-
-import static org.slf4j.spi.LocationAwareLogger.DEBUG_INT;
-import static org.slf4j.spi.LocationAwareLogger.ERROR_INT;
-import static org.slf4j.spi.LocationAwareLogger.INFO_INT;
-import static org.slf4j.spi.LocationAwareLogger.TRACE_INT;
-import static org.slf4j.spi.LocationAwareLogger.WARN_INT;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogConfigurationException;
-import org.apache.commons.logging.LogFactory;
-import org.slf4j.ILoggerFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.Marker;
-import org.slf4j.MarkerFactory;
-import org.slf4j.spi.LocationAwareLogger;
-
-/**
- * Logger factory hardcoded to send everything to SLF4J.
- *
- * @since 1.3.0
- */
-public final class Slf4jLogFactory extends LogFactory {
-
- private static final class Slf4jLocationAwareLog implements Log {
-
- private static final String FQCN =
Slf4jLocationAwareLog.class.getName();
-
- private final LocationAwareLogger logger;
-
- public Slf4jLocationAwareLog(final LocationAwareLogger logger) {
- this.logger = logger;
- }
-
- @Override
- public void debug(final Object message) {
- log(DEBUG_INT, message, null);
- }
-
- @Override
- public void debug(final Object message, final Throwable t) {
- log(DEBUG_INT, message, t);
- }
-
- @Override
- public void error(final Object message) {
- log(ERROR_INT, message, null);
- }
-
- @Override
- public void error(final Object message, final Throwable t) {
- log(ERROR_INT, message, t);
- }
-
- @Override
- public void fatal(final Object message) {
- error(message);
- }
-
- @Override
- public void fatal(final Object message, final Throwable t) {
- error(message, t);
- }
-
- @Override
- public void info(final Object message) {
- log(INFO_INT, message, null);
- }
-
- @Override
- public void info(final Object message, final Throwable t) {
- log(INFO_INT, message, t);
- }
-
- @Override
- public boolean isDebugEnabled() {
- return logger.isDebugEnabled(MARKER);
- }
-
- @Override
- public boolean isErrorEnabled() {
- return logger.isErrorEnabled(MARKER);
- }
-
- @Override
- public boolean isFatalEnabled() {
- return isErrorEnabled();
- }
-
- @Override
- public boolean isInfoEnabled() {
- return logger.isInfoEnabled(MARKER);
- }
-
- @Override
- public boolean isTraceEnabled() {
- return logger.isTraceEnabled(MARKER);
- }
-
- @Override
- public boolean isWarnEnabled() {
- return logger.isWarnEnabled(MARKER);
- }
-
- private void log(final int level, final Object message, final
Throwable t) {
- logger.log(MARKER, FQCN, level, String.valueOf(message),
EMPTY_OBJECT_ARRAY, t);
- }
-
- @Override
- public void trace(final Object message) {
- log(TRACE_INT, message, null);
- }
-
- @Override
- public void trace(final Object message, final Throwable t) {
- log(TRACE_INT, message, t);
- }
-
- @Override
- public void warn(final Object message) {
- log(WARN_INT, message, null);
- }
-
- @Override
- public void warn(final Object message, final Throwable t) {
- log(WARN_INT, message, t);
- }
- }
- private static class Slf4jLog implements Log {
-
- private final Logger logger;
-
- public Slf4jLog(final Logger logger) {
- this.logger = logger;
- }
-
- @Override
- public void debug(final Object message) {
- logger.debug(MARKER, String.valueOf(message));
- }
-
- @Override
- public void debug(final Object message, final Throwable t) {
- logger.debug(MARKER, String.valueOf(message), t);
- }
-
- @Override
- public void error(final Object message) {
- logger.error(MARKER, String.valueOf(message));
- }
-
- @Override
- public void error(final Object message, final Throwable t) {
- logger.debug(MARKER, String.valueOf(message), t);
- }
-
- @Override
- public void fatal(final Object message) {
- error(message);
- }
-
- @Override
- public void fatal(final Object message, final Throwable t) {
- error(message, t);
- }
-
- @Override
- public void info(final Object message) {
- logger.info(MARKER, String.valueOf(message));
- }
-
- @Override
- public void info(final Object message, final Throwable t) {
- logger.info(MARKER, String.valueOf(message), t);
- }
-
- @Override
- public boolean isDebugEnabled() {
- return logger.isDebugEnabled(MARKER);
- }
-
- @Override
- public boolean isErrorEnabled() {
- return logger.isErrorEnabled(MARKER);
- }
-
- @Override
- public boolean isFatalEnabled() {
- return isErrorEnabled();
- }
-
- @Override
- public boolean isInfoEnabled() {
- return logger.isInfoEnabled(MARKER);
- }
-
- @Override
- public boolean isTraceEnabled() {
- return logger.isTraceEnabled(MARKER);
- }
-
- @Override
- public boolean isWarnEnabled() {
- return logger.isWarnEnabled(MARKER);
- }
-
- @Override
- public void trace(final Object message) {
- logger.trace(MARKER, String.valueOf(message));
- }
-
- @Override
- public void trace(final Object message, final Throwable t) {
- logger.trace(MARKER, String.valueOf(message), t);
- }
-
- @Override
- public void warn(final Object message) {
- logger.warn(MARKER, String.valueOf(message));
- }
-
- @Override
- public void warn(final Object message, final Throwable t) {
- logger.warn(MARKER, String.valueOf(message), t);
- }
- }
-
- private static final Object[] EMPTY_OBJECT_ARRAY = {};
-
- private static final String[] EMPTY_STRING_ARRAY = {};
-
- /**
- * Marker used by all messages coming from Apache Commons Logging.
- */
- private static final Marker MARKER =
MarkerFactory.getMarker("COMMONS-LOGGING");
-
- /**
- * Caches Log instances.
- * <p>
- * The SLF4J reference implementation (Logback) has a single logger
context, so each call to
- * {@link #getInstance(String)}
- * should give the same result.
- * </p>
- */
- private final ConcurrentMap<String, Log> loggers = new
ConcurrentHashMap<>();
-
- private final ConcurrentMap<String, Object> attributes = new
ConcurrentHashMap<>();
-
- /**
- * Constructs a new instance.
- */
- public Slf4jLogFactory() {
- // empty
- }
-
- @Override
- public Object getAttribute(final String name) {
- return attributes.get(name);
- }
-
- @Override
- public String[] getAttributeNames() {
- return attributes.keySet().toArray(EMPTY_STRING_ARRAY);
- }
-
- @Override
- public Log getInstance(final Class<?> clazz) throws
LogConfigurationException {
- return getInstance(clazz.getName());
- }
-
- @Override
- public Log getInstance(final String name) {
- return loggers.computeIfAbsent(name, n -> {
- final Logger logger = LoggerFactory.getLogger(n);
- return logger instanceof LocationAwareLogger ? new
Slf4jLocationAwareLog((LocationAwareLogger) logger) : new Slf4jLog(
- logger);
- });
- }
-
- /**
- * This method is supposed to clear all loggers.
- * <p>
- * In this implementation it calls a "stop" method if the logger factory
supports it. This is the case of
- * Logback.
- * </p>
- */
- @Override
- public void release() {
- final ILoggerFactory factory = LoggerFactory.getILoggerFactory();
- try {
- factory.getClass().getMethod("stop").invoke(factory);
- } catch (final ReflectiveOperationException ignored) {
- // empty
- }
- }
-
- @Override
- public void removeAttribute(final String name) {
- attributes.remove(name);
- }
-
- @Override
- public void setAttribute(final String name, final Object value) {
- if (value != null) {
- attributes.put(name, value);
- } else {
- removeAttribute(name);
- }
- }
-}
++++++ commons-logging-1.2-src.tar.gz -> commons-logging-1.3.3-src.tar.gz ++++++
++++ 22907 lines of diff (skipped)