You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2016/03/14 20:01:36 UTC
svn commit: r1734986 - /pivot/trunk/core/src/org/apache/pivot/util/Utils.java
Author: rwhitcomb
Date: Mon Mar 14 19:01:36 2016
New Revision: 1734986
URL: http://svn.apache.org/viewvc?rev=1734986&view=rev
Log:
Code cleanup: Make an enhancment to Utils.checkNull() to allow an
empty descriptiont string to also count for throwing a "plain"
IllegalArgumentDescription (i.e., without a message). This will
eliminate weird messages in this case.
Modified:
pivot/trunk/core/src/org/apache/pivot/util/Utils.java
Modified: pivot/trunk/core/src/org/apache/pivot/util/Utils.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/Utils.java?rev=1734986&r1=1734985&r2=1734986&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/util/Utils.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/Utils.java Mon Mar 14 19:01:36 2016
@@ -46,13 +46,13 @@ public class Utils {
* @param value The argument value to check for {@code null}.
* @param description A description for the value used to
* construct a message like {@code "xxx must not be null."}. Can be
- * {@code null} in which case a plain {@link IllegalArgumentException}
- * is thrown without any detail message.
+ * {@code null} or an empty string, in which case a plain
+ * {@link IllegalArgumentException} is thrown without any detail message.
* @throws IllegalArgumentException if the value is {@code null}.
*/
public static void checkNull(Object value, String description) {
if (value == null) {
- if (description == null) {
+ if (description == null || description.isEmpty()) {
throw new IllegalArgumentException();
} else {
throw new IllegalArgumentException(description + " must not be null.");