You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by pa...@apache.org on 2017/02/20 22:19:15 UTC

[lang] Validate's String.format without arguments (closes #238)

Repository: commons-lang
Updated Branches:
  refs/heads/master 954ade4c1 -> a64153a37


Validate's String.format without arguments (closes #238)

While calling String.format("some string") without any additional
arguments is not technically wrong, it's redundant, as it just
returns the same string.

Removing these calls and just using the string instead both cleans up
the code and offers a (very slight) performance gain.


Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/a64153a3
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/a64153a3
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/a64153a3

Branch: refs/heads/master
Commit: a64153a3710c5035988690f0acf57dd61b711cf4
Parents: 954ade4
Author: Allon Mureinik <am...@redhat.com>
Authored: Sat Feb 18 11:56:09 2017 +0200
Committer: pascalschumacher <pa...@gmx.net>
Committed: Mon Feb 20 23:18:50 2017 +0100

----------------------------------------------------------------------
 src/main/java/org/apache/commons/lang3/Validate.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/a64153a3/src/main/java/org/apache/commons/lang3/Validate.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/Validate.java b/src/main/java/org/apache/commons/lang3/Validate.java
index 508845a..fc52cb4 100644
--- a/src/main/java/org/apache/commons/lang3/Validate.java
+++ b/src/main/java/org/apache/commons/lang3/Validate.java
@@ -1052,7 +1052,7 @@ public class Validate {
     public static void inclusiveBetween(final long start, final long end, final long value, final String message) {
         // TODO when breaking BC, consider returning value
         if (value < start || value > end) {
-            throw new IllegalArgumentException(String.format(message));
+            throw new IllegalArgumentException(message);
         }
     }
 
@@ -1096,7 +1096,7 @@ public class Validate {
     public static void inclusiveBetween(final double start, final double end, final double value, final String message) {
         // TODO when breaking BC, consider returning value
         if (value < start || value > end) {
-            throw new IllegalArgumentException(String.format(message));
+            throw new IllegalArgumentException(message);
         }
     }
 
@@ -1190,7 +1190,7 @@ public class Validate {
     public static void exclusiveBetween(final long start, final long end, final long value, final String message) {
         // TODO when breaking BC, consider returning value
         if (value <= start || value >= end) {
-            throw new IllegalArgumentException(String.format(message));
+            throw new IllegalArgumentException(message);
         }
     }
 
@@ -1234,7 +1234,7 @@ public class Validate {
     public static void exclusiveBetween(final double start, final double end, final double value, final String message) {
         // TODO when breaking BC, consider returning value
         if (value <= start || value >= end) {
-            throw new IllegalArgumentException(String.format(message));
+            throw new IllegalArgumentException(message);
         }
     }