From 0c3d8d7a44fa057dd1c8bf62732cd23dc6220303 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 11 Sep 2023 17:36:07 +0200 Subject: [PATCH] Align abstract method signatures with original Commons Logging API Closes gh-31166 (cherry picked from commit 268043e9c9013b41c44861562bacf09b2f5e3085) --- .../apache/commons/logging/LogFactory.java | 40 +++++++++++-------- .../commons/logging/LogFactoryService.java | 4 ++ 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/spring-jcl/src/main/java/org/apache/commons/logging/LogFactory.java b/spring-jcl/src/main/java/org/apache/commons/logging/LogFactory.java index e67eb5a4342a..34426cc33f48 100644 --- a/spring-jcl/src/main/java/org/apache/commons/logging/LogFactory.java +++ b/spring-jcl/src/main/java/org/apache/commons/logging/LogFactory.java @@ -77,7 +77,25 @@ public static Log getLog(String name) { */ @Deprecated public static LogFactory getFactory() { - return new LogFactory() {}; + return new LogFactory() { + @Override + public Object getAttribute(String name) { + return null; + } + @Override + public String[] getAttributeNames() { + return new String[0]; + } + @Override + public void removeAttribute(String name) { + } + @Override + public void setAttribute(String name, Object value) { + } + @Override + public void release() { + } + }; } /** @@ -106,29 +124,19 @@ public Log getInstance(String name) { // Just in case some code happens to call uncommon Commons Logging methods... @Deprecated - public Object getAttribute(String name) { - return null; - } + public abstract Object getAttribute(String name); @Deprecated - public String[] getAttributeNames() { - return new String[0]; - } + public abstract String[] getAttributeNames(); @Deprecated - public void removeAttribute(String name) { - // do nothing - } + public abstract void removeAttribute(String name); @Deprecated - public void setAttribute(String name, Object value) { - // do nothing - } + public abstract void setAttribute(String name, Object value); @Deprecated - public void release() { - // do nothing - } + public abstract void release(); @Deprecated public static void release(ClassLoader classLoader) { diff --git a/spring-jcl/src/main/java/org/apache/commons/logging/LogFactoryService.java b/spring-jcl/src/main/java/org/apache/commons/logging/LogFactoryService.java index bf2379b5693e..c40a928a0272 100644 --- a/spring-jcl/src/main/java/org/apache/commons/logging/LogFactoryService.java +++ b/spring-jcl/src/main/java/org/apache/commons/logging/LogFactoryService.java @@ -74,4 +74,8 @@ public String[] getAttributeNames() { return this.attributes.keySet().toArray(new String[0]); } + @Override + public void release() { + } + }