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 2024/06/30 12:06:26 UTC
(commons-logging) branch master updated (c8bba3d -> 61c2610)
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 c8bba3d Write code more directly
new b31e91c Javadoc
new 8251056 Fix NullPointerException in SimpleLog#write(Object) on null input
new 03ec597 Fix NullPointerException in SimpleLog#write(StringBuffer) on null input
new 35a4110 Update Log4j 2 OSGi imports
new 61c2610 Format nits
The 5 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:
src/changes/changes.xml | 4 +-
.../org/apache/commons/logging/impl/SimpleLog.java | 59 +++++++++++++---------
2 files changed, 37 insertions(+), 26 deletions(-)
(commons-logging) 02/05: Fix NullPointerException in SimpleLog#write(Object) on null input
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 825105628fe6a47b1bfaa3cede35d4a323895975
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 30 08:01:52 2024 -0400
Fix NullPointerException in SimpleLog#write(Object) on null input
---
src/changes/changes.xml | 1 +
src/main/java/org/apache/commons/logging/impl/SimpleLog.java | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index d40b25b..31c8fcc 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.
<!-- FIX -->
<action dev="ggregory" type="fix" due-to="Gary Gregory">Fix PMD UnnecessaryFullyQualifiedName in SimpleLog.</action>
<action dev="ggregory" type="fix" issue="LOGGING-193" due-to="Philippe Marschall">Update Log4j 2 Imports #268.</action>
+ <action dev="ggregory" type="fix" due-to="Gary Gregory">Fix NullPointerException in SimpleLog#write(Object) on null input.</action>
<!-- ADD -->
<!-- UPDATE -->
<action dev="ggregory" type="update" due-to="Dependabot">Bump org.apache.commons:commons-parent from 69 to 71 #267.</action>
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 60044f7..97580fe 100644
--- a/src/main/java/org/apache/commons/logging/impl/SimpleLog.java
+++ b/src/main/java/org/apache/commons/logging/impl/SimpleLog.java
@@ -27,6 +27,7 @@ import java.security.PrivilegedAction;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.Objects;
import java.util.Properties;
import org.apache.commons.logging.Log;
@@ -640,7 +641,7 @@ public class SimpleLog implements Log, Serializable {
* text to be logged
*/
private void write(final Object buffer) {
- System.err.println(buffer.toString());
+ System.err.println(Objects.toString(buffer));
}
/**
(commons-logging) 01/05: 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 b31e91cba52d3b6e76b80072b232b7479be2122f
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 30 08:01:44 2024 -0400
Javadoc
---
.../org/apache/commons/logging/impl/SimpleLog.java | 26 ++++++++++++++--------
1 file changed, 17 insertions(+), 9 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 84102de..60044f7 100644
--- a/src/main/java/org/apache/commons/logging/impl/SimpleLog.java
+++ b/src/main/java/org/apache/commons/logging/impl/SimpleLog.java
@@ -66,6 +66,7 @@ import org.apache.commons.logging.LogConfigurationException;
* above, this implementation also checks for a class loader resource named
* {@code "simplelog.properties"}, and includes any matching definitions
* from this resource (if it exists).
+ * </p>
*/
public class SimpleLog implements Log, Serializable {
@@ -394,11 +395,12 @@ public class SimpleLog implements Log, Serializable {
}
/**
- * Are debug messages currently enabled?
+ * Tests whether debug messages are enabled.
* <p>
* This allows expensive operations such as {@code String}
* concatenation to be avoided when the message will be ignored by the
* logger.
+ * </p>
*/
@Override
public final boolean isDebugEnabled() {
@@ -406,11 +408,12 @@ public class SimpleLog implements Log, Serializable {
}
/**
- * Are error messages currently enabled?
+ * Tests whether error messages are enabled.
* <p>
* This allows expensive operations such as {@code String}
* concatenation to be avoided when the message will be ignored by the
* logger.
+ * </p>
*/
@Override
public final boolean isErrorEnabled() {
@@ -418,11 +421,12 @@ public class SimpleLog implements Log, Serializable {
}
/**
- * Are fatal messages currently enabled?
+ * Tests whether fatal messages are enabled.
* <p>
* This allows expensive operations such as {@code String}
* concatenation to be avoided when the message will be ignored by the
* logger.
+ * </p>
*/
@Override
public final boolean isFatalEnabled() {
@@ -430,11 +434,12 @@ public class SimpleLog implements Log, Serializable {
}
/**
- * Are info messages currently enabled?
+ * Tests whether info messages are enabled.
* <p>
* This allows expensive operations such as {@code String}
* concatenation to be avoided when the message will be ignored by the
* logger.
+ * </p>
*/
@Override
public final boolean isInfoEnabled() {
@@ -442,7 +447,7 @@ public class SimpleLog implements Log, Serializable {
}
/**
- * Tests whether the given log level currently enabled.
+ * Tests whether the given level is enabled.
*
* @param logLevel is this level enabled?
* @return whether the given log level currently enabled.
@@ -454,11 +459,12 @@ public class SimpleLog implements Log, Serializable {
}
/**
- * Are trace messages currently enabled?
+ * Tests whether trace messages are enabled.
* <p>
* This allows expensive operations such as {@code String}
* concatenation to be avoided when the message will be ignored by the
* logger.
+ * </p>
*/
@Override
public final boolean isTraceEnabled() {
@@ -466,11 +472,12 @@ public class SimpleLog implements Log, Serializable {
}
/**
- * Are warn messages currently enabled?
+ * Tests whether warn messages are enabled.
* <p>
* This allows expensive operations such as {@code String}
* concatenation to be avoided when the message will be ignored by the
* logger.
+ * </p>
*/
@Override
public final boolean isWarnEnabled() {
@@ -482,6 +489,7 @@ public class SimpleLog implements Log, Serializable {
* <p>
* This method assembles the message and then calls {@code write()}
* to cause it to be written.
+ * </p>
*
* @param type One of the LOG_LEVEL_XXX constants defining the log level
* @param message The message itself (typically a String)
@@ -624,7 +632,7 @@ public class SimpleLog implements Log, Serializable {
}
/**
- * Write the content of the message accumulated in the specified
+ * Writes the content of the message accumulated in the specified
* {@code StringBuffer} to the appropriate output destination. The
* default implementation writes to {@code System.err}.
*
@@ -636,7 +644,7 @@ public class SimpleLog implements Log, Serializable {
}
/**
- * Write the content of the message accumulated in the specified
+ * Writes the content of the message accumulated in the specified
* {@code StringBuffer} to the appropriate output destination. The
* default implementation writes to {@code System.err}.
*
(commons-logging) 03/05: Fix NullPointerException in SimpleLog#write(StringBuffer) on null input
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 03ec597a10b447165d0afa168d753af73b833268
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 30 08:02:35 2024 -0400
Fix NullPointerException in SimpleLog#write(StringBuffer) on null input
---
src/changes/changes.xml | 1 +
src/main/java/org/apache/commons/logging/impl/SimpleLog.java | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 31c8fcc..f5b898a 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -48,6 +48,7 @@ The <action> type attribute can be add,update,fix,remove.
<action dev="ggregory" type="fix" due-to="Gary Gregory">Fix PMD UnnecessaryFullyQualifiedName in SimpleLog.</action>
<action dev="ggregory" type="fix" issue="LOGGING-193" due-to="Philippe Marschall">Update Log4j 2 Imports #268.</action>
<action dev="ggregory" type="fix" due-to="Gary Gregory">Fix NullPointerException in SimpleLog#write(Object) on null input.</action>
+ <action dev="ggregory" type="fix" due-to="Gary Gregory">Fix NullPointerException in SimpleLog#write(StringBuffer) on null input.</action>
<!-- ADD -->
<!-- UPDATE -->
<action dev="ggregory" type="update" due-to="Dependabot">Bump org.apache.commons:commons-parent from 69 to 71 #267.</action>
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 97580fe..541e9ac 100644
--- a/src/main/java/org/apache/commons/logging/impl/SimpleLog.java
+++ b/src/main/java/org/apache/commons/logging/impl/SimpleLog.java
@@ -653,7 +653,7 @@ public class SimpleLog implements Log, Serializable {
* text to be logged
*/
protected void write(final StringBuffer buffer) {
- System.err.println(buffer.toString());
+ System.err.println(Objects.toString(buffer));
}
}
(commons-logging) 04/05: Update Log4j 2 OSGi imports
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 35a41108dc6e7a0285611b6e36ee491eb0ab48ef
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 30 08:02:55 2024 -0400
Update Log4j 2 OSGi imports
---
src/changes/changes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index f5b898a..04a8f18 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,7 +46,7 @@ The <action> type attribute can be add,update,fix,remove.
<release version="1.3.3" 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 PMD UnnecessaryFullyQualifiedName in SimpleLog.</action>
- <action dev="ggregory" type="fix" issue="LOGGING-193" due-to="Philippe Marschall">Update Log4j 2 Imports #268.</action>
+ <action dev="ggregory" type="fix" issue="LOGGING-193" due-to="Philippe Marschall">Update Log4j 2 OSGi imports #268.</action>
<action dev="ggregory" type="fix" due-to="Gary Gregory">Fix NullPointerException in SimpleLog#write(Object) on null input.</action>
<action dev="ggregory" type="fix" due-to="Gary Gregory">Fix NullPointerException in SimpleLog#write(StringBuffer) on null input.</action>
<!-- ADD -->
(commons-logging) 05/05: Format nits
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 61c261037d87348b16e123f2434b72b4b8ccfc16
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 30 08:06:13 2024 -0400
Format nits
---
.../org/apache/commons/logging/impl/SimpleLog.java | 28 +++++++++++-----------
1 file changed, 14 insertions(+), 14 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 541e9ac..be9ad09 100644
--- a/src/main/java/org/apache/commons/logging/impl/SimpleLog.java
+++ b/src/main/java/org/apache/commons/logging/impl/SimpleLog.java
@@ -245,33 +245,33 @@ public class SimpleLog implements Log, Serializable {
setLevel(LOG_LEVEL_INFO);
// Set log level from properties
- String lvl = getStringProperty(systemPrefix + "log." + logName);
+ String level = getStringProperty(systemPrefix + "log." + logName);
int i = String.valueOf(name).lastIndexOf(".");
- while(null == lvl && i > -1) {
- name = name.substring(0,i);
- lvl = getStringProperty(systemPrefix + "log." + name);
+ while (null == level && i > -1) {
+ name = name.substring(0, i);
+ level = getStringProperty(systemPrefix + "log." + name);
i = String.valueOf(name).lastIndexOf(".");
}
- if (null == lvl) {
- lvl = getStringProperty(systemPrefix + "defaultlog");
+ if (null == level) {
+ level = getStringProperty(systemPrefix + "defaultlog");
}
- if ("all".equalsIgnoreCase(lvl)) {
+ if ("all".equalsIgnoreCase(level)) {
setLevel(LOG_LEVEL_ALL);
- } else if ("trace".equalsIgnoreCase(lvl)) {
+ } else if ("trace".equalsIgnoreCase(level)) {
setLevel(LOG_LEVEL_TRACE);
- } else if ("debug".equalsIgnoreCase(lvl)) {
+ } else if ("debug".equalsIgnoreCase(level)) {
setLevel(LOG_LEVEL_DEBUG);
- } else if ("info".equalsIgnoreCase(lvl)) {
+ } else if ("info".equalsIgnoreCase(level)) {
setLevel(LOG_LEVEL_INFO);
- } else if ("warn".equalsIgnoreCase(lvl)) {
+ } else if ("warn".equalsIgnoreCase(level)) {
setLevel(LOG_LEVEL_WARN);
- } else if ("error".equalsIgnoreCase(lvl)) {
+ } else if ("error".equalsIgnoreCase(level)) {
setLevel(LOG_LEVEL_ERROR);
- } else if ("fatal".equalsIgnoreCase(lvl)) {
+ } else if ("fatal".equalsIgnoreCase(level)) {
setLevel(LOG_LEVEL_FATAL);
- } else if ("off".equalsIgnoreCase(lvl)) {
+ } else if ("off".equalsIgnoreCase(level)) {
setLevel(LOG_LEVEL_OFF);
}
}