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 2023/09/20 13:16:10 UTC

[commons-lang] branch master updated (3c92ada99 -> 4ab7add38)

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-lang.git


    from 3c92ada99 Bump github/codeql-action from 2.21.5 to 2.21.7 (#1111)
     new d0f65ab0a Reuse Objects.toString()
     new 5571b9b46 Reuse Objects.toString()
     new 4ab7add38 In-line single use local

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:
 src/main/java/org/apache/commons/lang3/ArrayUtils.java     | 3 +--
 src/main/java/org/apache/commons/lang3/text/StrLookup.java | 7 ++-----
 2 files changed, 3 insertions(+), 7 deletions(-)


[commons-lang] 01/03: Reuse Objects.toString()

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-lang.git

commit d0f65ab0a42e9dd4f279cd8b306c9edfe963606d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Sep 20 09:13:35 2023 -0400

    Reuse Objects.toString()
---
 src/main/java/org/apache/commons/lang3/ArrayUtils.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/lang3/ArrayUtils.java b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
index 08f8628e4..80ce0a881 100644
--- a/src/main/java/org/apache/commons/lang3/ArrayUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
@@ -9627,7 +9627,7 @@ public class ArrayUtils {
         final String[] result = new String[array.length];
         for (int i = 0; i < array.length; i++) {
             final Object object = array[i];
-            result[i] = object == null ? valueForNullElements : object.toString();
+            result[i] = Objects.toString(object, valueForNullElements);
         }
 
         return result;


[commons-lang] 02/03: Reuse Objects.toString()

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-lang.git

commit 5571b9b464528dcd60819cc48c93bb2f8015b3cb
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Sep 20 09:14:35 2023 -0400

    Reuse Objects.toString()
---
 src/main/java/org/apache/commons/lang3/text/StrLookup.java | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/commons/lang3/text/StrLookup.java b/src/main/java/org/apache/commons/lang3/text/StrLookup.java
index 52ef035e1..b28d6db5f 100644
--- a/src/main/java/org/apache/commons/lang3/text/StrLookup.java
+++ b/src/main/java/org/apache/commons/lang3/text/StrLookup.java
@@ -17,6 +17,7 @@
 package org.apache.commons.lang3.text;
 
 import java.util.Map;
+import java.util.Objects;
 
 import org.apache.commons.lang3.SystemProperties;
 
@@ -164,11 +165,7 @@ public abstract class StrLookup<V> {
             if (map == null) {
                 return null;
             }
-            final Object obj = map.get(key);
-            if (obj == null) {
-                return null;
-            }
-            return obj.toString();
+            return Objects.toString(map.get(key), null);
         }
     }
 


[commons-lang] 03/03: In-line single use local

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-lang.git

commit 4ab7add381194bb2707b64c515e47d8fc3c625b0
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Sep 20 09:16:04 2023 -0400

    In-line single use local
---
 src/main/java/org/apache/commons/lang3/ArrayUtils.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/lang3/ArrayUtils.java b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
index 80ce0a881..f0f356341 100644
--- a/src/main/java/org/apache/commons/lang3/ArrayUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
@@ -9626,8 +9626,7 @@ public class ArrayUtils {
 
         final String[] result = new String[array.length];
         for (int i = 0; i < array.length; i++) {
-            final Object object = array[i];
-            result[i] = Objects.toString(object, valueForNullElements);
+            result[i] = Objects.toString(array[i], valueForNullElements);
         }
 
         return result;