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 2022/08/30 15:19:51 UTC

[commons-codec] branch master updated: Use ternary expression

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


The following commit(s) were added to refs/heads/master by this push:
     new 101fea65 Use ternary expression
101fea65 is described below

commit 101fea65942f9ed5f765bdfac2c7a1ca545ed356
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Aug 30 11:19:47 2022 -0400

    Use ternary expression
---
 src/main/java/org/apache/commons/codec/binary/StringUtils.java | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/commons/codec/binary/StringUtils.java b/src/main/java/org/apache/commons/codec/binary/StringUtils.java
index fe4e69fb..c0e017f4 100644
--- a/src/main/java/org/apache/commons/codec/binary/StringUtils.java
+++ b/src/main/java/org/apache/commons/codec/binary/StringUtils.java
@@ -124,10 +124,7 @@ public class StringUtils {
      * @return the encoded bytes
      */
     private static byte[] getBytes(final String string, final Charset charset) {
-        if (string == null) {
-            return null;
-        }
-        return string.getBytes(charset);
+        return string == null ? null : string.getBytes(charset);
     }
 
     /**