commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aherb...@apache.org
Subject [commons-numbers] branch master updated: Removed redundant null checks in parsingException().
Date Thu, 05 Dec 2019 21:13:04 GMT
This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git


The following commit(s) were added to refs/heads/master by this push:
     new e7c32ad  Removed redundant null checks in parsingException().
e7c32ad is described below

commit e7c32ad526f8cdb09045681e266089d129ff6ca9
Author: Alex Herbert <aherbert@apache.org>
AuthorDate: Thu Dec 5 21:12:59 2019 +0000

    Removed redundant null checks in parsingException().
---
 .../main/java/org/apache/commons/numbers/complex/Complex.java | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
index f0efa8b..55cbab4 100644
--- a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
+++ b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
@@ -1847,13 +1847,10 @@ public final class Complex implements Serializable  {
     private static NumberFormatException parsingException(String message,
                                                           String error,
                                                           Throwable cause) {
-        final StringBuilder sb = new StringBuilder();
-        if (message != null) {
-            sb.append(message);
-        }
-        if (error != null) {
-            sb.append(" (").append(error).append(" )");
-        }
+        // Not called with a null message or error
+        final StringBuilder sb = new StringBuilder(100)
+            .append(message)
+            .append(" (").append(error).append(" )");
         if (cause != null) {
             sb.append(": ").append(cause.getMessage());
         }


Mime
View raw message