You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/02/28 13:52:42 UTC
(commons-logging) branch master updated (298e7c7 -> 9a44202)
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-logging.git
from 298e7c7 Bump org.slf4j:slf4j-api from 2.0.16 to 2.0.17 #344
new 6f066e7 Fix running spotbugs:check
new 15fa50c Javadoc
new 9a44202 Simplify static initialization of SimpleLog
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
pom.xml | 43 +++++++++++-----------
src/changes/changes.xml | 1 +
.../org/apache/commons/logging/impl/SimpleLog.java | 25 ++++++++-----
.../commons/logging/simple/DecoratedSimpleLog.java | 9 +----
4 files changed, 39 insertions(+), 39 deletions(-)
(commons-logging) 03/03: Simplify static initialization of SimpleLog
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-logging.git
commit 9a44202650a94bbb29f77022f741ba0ab5c100dc
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Feb 28 08:52:35 2025 -0500
Simplify static initialization of SimpleLog
Javadoc
---
.../org/apache/commons/logging/impl/SimpleLog.java | 25 +++++++++++++---------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/src/main/java/org/apache/commons/logging/impl/SimpleLog.java b/src/main/java/org/apache/commons/logging/impl/SimpleLog.java
index 19d5cce..db182fb 100644
--- a/src/main/java/org/apache/commons/logging/impl/SimpleLog.java
+++ b/src/main/java/org/apache/commons/logging/impl/SimpleLog.java
@@ -108,6 +108,9 @@ public class SimpleLog implements Log, Serializable {
* in 1.1.1 to fix an existing thread safety bug (SimpleDateFormat.format
* is not thread-safe).
* </p>
+ * <p>
+ * Statically initialized to a {@link SimpleDateFormat}.
+ * </p>
*/
static protected DateFormat dateFormatter;
@@ -142,20 +145,13 @@ public class SimpleLog implements Log, Serializable {
} catch (final IOException ignore) {
// Ignore
}
-
showLogName = getBooleanProperty(systemPrefix + "showlogname", showLogName);
showShortName = getBooleanProperty(systemPrefix + "showShortLogname", showShortName);
showDateTime = getBooleanProperty(systemPrefix + "showdatetime", showDateTime);
-
if (showDateTime) {
- dateTimeFormat = getStringProperty(systemPrefix + "dateTimeFormat", dateTimeFormat);
- try {
- dateFormatter = new SimpleDateFormat(dateTimeFormat);
- } catch (final IllegalArgumentException e) {
- // If the format pattern is invalid - use the default format
- dateTimeFormat = DEFAULT_DATE_TIME_FORMAT;
- dateFormatter = new SimpleDateFormat(dateTimeFormat);
- }
+ SimpleDateFormat simpleDateFormatter = getSimpleDateFormat();
+ dateFormatter = simpleDateFormatter;
+ dateTimeFormat = simpleDateFormatter.toPattern();
}
}
@@ -210,6 +206,15 @@ public class SimpleLog implements Log, Serializable {
});
}
+ private static SimpleDateFormat getSimpleDateFormat() {
+ try {
+ return new SimpleDateFormat(getStringProperty(systemPrefix + "dateTimeFormat", dateTimeFormat));
+ } catch (final IllegalArgumentException e) {
+ // If the format pattern is invalid - use the default format
+ return new SimpleDateFormat(DEFAULT_DATE_TIME_FORMAT);
+ }
+ }
+
private static String getStringProperty(final String name) {
String prop = null;
try {
(commons-logging) 01/03: Fix running spotbugs:check
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-logging.git
commit 6f066e7b679ccd162a9f21414a79e36ffc259c77
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Feb 28 08:25:17 2025 -0500
Fix running spotbugs:check
[ERROR] Failed to execute goal
com.github.spotbugs:spotbugs-maven-plugin:4.9.1.0:spotbugs (spotbugs) on
project commons-logging: Unable to parse configuration of mojo
com.github.spotbugs:spotbugs-maven-plugin:4.9.1.0:spotbugs for parameter
scope: Cannot find 'scope' in class
org.codehaus.mojo.spotbugs.PluginArtifact -> [Help 1]
---
pom.xml | 43 +++++++++++++++++++++----------------------
src/changes/changes.xml | 1 +
2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/pom.xml b/pom.xml
index 2102e43..9d8a197 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@ under the License.
<parent>
<groupId>org.apache.commons</groupId>
<artifactId>commons-parent</artifactId>
- <version>81</version>
+ <version>82-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>commons-logging</groupId>
@@ -479,17 +479,16 @@ under the License.
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
- <configuration>
- <excludeFilterFile>src/conf/spotbugs-excludes.xml</excludeFilterFile>
- <plugins>
- <plugin>
- <groupId>com.h3xstream.findsecbugs</groupId>
- <artifactId>findsecbugs-plugin</artifactId>
- <version>${findsecbugs.version}</version>
- <scope>test</scope>
- </plugin>
- </plugins>
- </configuration>
+ <configuration>
+ <excludeFilterFile>src/conf/spotbugs-excludes.xml</excludeFilterFile>
+ <plugins>
+ <plugin>
+ <groupId>com.h3xstream.findsecbugs</groupId>
+ <artifactId>findsecbugs-plugin</artifactId>
+ <version>${findsecbugs.version}</version>
+ </plugin>
+ </plugins>
+ </configuration>
</plugin>
<!-- Ban Commons Logging clones. -->
<plugin>
@@ -633,16 +632,16 @@ under the License.
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
- <configuration>
- <excludeFilterFile>src/conf/spotbugs-excludes.xml</excludeFilterFile>
- <plugins>
- <plugin>
- <groupId>com.h3xstream.findsecbugs</groupId>
- <artifactId>findsecbugs-plugin</artifactId>
- <version>${findsecbugs.version}</version>
- </plugin>
- </plugins>
- </configuration>
+ <configuration>
+ <excludeFilterFile>src/conf/spotbugs-excludes.xml</excludeFilterFile>
+ <plugins>
+ <plugin>
+ <groupId>com.h3xstream.findsecbugs</groupId>
+ <artifactId>findsecbugs-plugin</artifactId>
+ <version>${findsecbugs.version}</version>
+ </plugin>
+ </plugins>
+ </configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index ad18976..ede8b84 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -47,6 +47,7 @@ The <action> type attribute can be add,update,fix,remove.
<body>
<release version="1.3.6" date="YYYY-MM-DD" description="This is a feature and maintenance release. Java 8 or later is required.">
<!-- FIX -->
+ <action dev="ggregory" type="fix" due-to="Gary Gregory">Fix running spotbugs:check: Unable to parse configuration of mojo.</action>
<!-- ADD -->
<!-- UPDATE -->
<action dev="ggregory" type="update" due-to="Gary Gregory, Dependabot">Bump org.slf4j:slf4j-api from 2.0.16 to 2.0.17 #344.</action>
(commons-logging) 02/03: Javadoc
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-logging.git
commit 15fa50cd09f6818224b96ea85af7809d652537d7
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Feb 28 08:30:57 2025 -0500
Javadoc
---
.../org/apache/commons/logging/simple/DecoratedSimpleLog.java | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/test/java/org/apache/commons/logging/simple/DecoratedSimpleLog.java b/src/test/java/org/apache/commons/logging/simple/DecoratedSimpleLog.java
index 33c1a97..9a4b0bc 100644
--- a/src/test/java/org/apache/commons/logging/simple/DecoratedSimpleLog.java
+++ b/src/test/java/org/apache/commons/logging/simple/DecoratedSimpleLog.java
@@ -24,10 +24,8 @@ import java.util.List;
import org.apache.commons.logging.impl.SimpleLog;
/**
- * <p>Decorated instance of SimpleLog to expose internal state and
- * support buffered output.</p>
+ * Decorated instance of SimpleLog to expose internal state and support buffered output.
*/
-
public class DecoratedSimpleLog extends SimpleLog {
/**
@@ -35,7 +33,7 @@ public class DecoratedSimpleLog extends SimpleLog {
*/
private static final long serialVersionUID = 196544280770017153L;
- // Cache of logged records
+ /** Cache of logged records. */
protected ArrayList<LogRecord> cache = new ArrayList<>();
public DecoratedSimpleLog(final String name) {
@@ -75,10 +73,7 @@ public class DecoratedSimpleLog extends SimpleLog {
// Cache logged messages
@Override
protected void log(final int type, final Object message, final Throwable t) {
-
super.log(type, message, t);
cache.add(new LogRecord(type, message, t));
-
}
-
}