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 2020/12/30 23:15:54 UTC

svn commit: r1884968 - in /pivot/trunk: core/src/org/apache/pivot/util/Utils.java wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java

Author: rwhitcomb
Date: Wed Dec 30 23:15:54 2020
New Revision: 1884968

URL: http://svn.apache.org/viewvc?rev=1884968&view=rev
Log:
Fix compile errors from last (untested) commit.

Modified:
    pivot/trunk/core/src/org/apache/pivot/util/Utils.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.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=1884968&r1=1884967&r2=1884968&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/util/Utils.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/Utils.java Wed Dec 30 23:15:54 2020
@@ -113,23 +113,34 @@ public final class Utils {
      * with an optional message derived from the given string.
      *
      * @param value The argument value to check for {@code null} or empty.
-     * @param argument A description for the argument, used to
+     * @param description A description for the argument, used to
      * construct a message like {@code "xxx must not be null or empty."}.
      * Can be {@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 checkNullOrEmpty(final Object value, final String argument) {
+    public static void checkNullOrEmpty(final Object value, final String description) {
         if (value == null || (value instanceof String && isNullOrEmpty((String) value))) {
-            if (isNullOrEmpty(argument)) {
+            if (isNullOrEmpty(description)) {
                 throw new IllegalArgumentException();
             } else {
-                throw new IllegalArgumentException(argument + " must not be null or empty.");
+                throw new IllegalArgumentException(description + " must not be null or empty.");
             }
         }
     }
 
     /**
+     * Check if the input argument is {@code null} and if it is a string
+     * if it is empty, and throw an {@link IllegalArgumentException} if so.
+     *
+     * @param value The string to check.
+     * @throws IllegalArgumentException if the value is {@code null}.
+     */
+    public static void checkNullOrEmpty(final Object value) {
+        checkNullOrEmpty(value, null);
+    }
+
+    /**
      * If the first argument given is {@code null} then substitute the second argument
      * for it, else just return the given argument.
      *
@@ -145,110 +156,165 @@ public final class Utils {
 
     /**
      * Check if the input argument is negative (less than zero), and throw an
-     * {@link IllegalArgumentException} with or without a descriptive message,
-     * depending on the {@code argument} supplied.
+     * {@link IllegalArgumentException} if so, with or without a descriptive message,
+     * depending on the {@code description} supplied.
      *
      * @param value The value to check.
-     * @param argument A description for the argument, used to
+     * @param description A description for the argument, used to
      * construct a message like {@code "xxx must not be negative."}.
      * Can be {@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 negative.
      */
-    public static void checkNonNegative(final int value, final String argument) {
+    public static void checkNonNegative(final int value, final String description) {
         if (value < 0) {
-            if (isNullOrEmpty(argument)) {
+            if (isNullOrEmpty(description)) {
                 throw new IllegalArgumentException();
             } else {
-                throw new IllegalArgumentException(argument + " must not be negative.");
+                throw new IllegalArgumentException(description + " must not be negative.");
             }
         }
     }
 
     /**
      * Check if the input argument is negative (less than zero), and throw an
-     * {@link IllegalArgumentException} with or without a descriptive message,
-     * depending on the {@code argument} supplied.
+     * {@link IllegalArgumentException} if so.
      *
      * @param value The value to check.
-     * @param argument A description for the argument, used to
+     * @throws IllegalArgumentException if the value is negative.
+     */
+    public static void checkNonNegative(final int value) {
+        checkNonNegative(value, null);
+    }
+
+    /**
+     * Check if the input argument is negative (less than zero), and throw an
+     * {@link IllegalArgumentException} if so, with or without a descriptive message,
+     * depending on the {@code description} supplied.
+     *
+     * @param value The value to check.
+     * @param description A description for the argument, used to
      * construct a message like {@code "xxx must not be negative."}.
      * Can be {@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 negative.
      */
-    public static void checkNonNegative(final float value, final String argument) {
+    public static void checkNonNegative(final float value, final String description) {
         if (value < 0.0f) {
-            if (isNullOrEmpty(argument)) {
+            if (isNullOrEmpty(description)) {
                 throw new IllegalArgumentException();
             } else {
-                throw new IllegalArgumentException(argument + " must not be negative.");
+                throw new IllegalArgumentException(description + " must not be negative.");
             }
         }
     }
 
     /**
+     * Check if the input argument is negative (less than zero), and throw an
+     * {@link IllegalArgumentException} if so.
+     *
+     * @param value The value to check.
+     * @throws IllegalArgumentException if the value is negative.
+     */
+    public static void checkNonNegative(final float value) {
+        checkNonNegative(value, null);
+    }
+
+    /**
      * Check if the input argument is positive (greater than zero), and throw an
      * {@link IllegalArgumentException} if not, with or without a descriptive message,
-     * depending on the {@code argument} supplied.
+     * depending on the {@code description} supplied.
      *
      * @param value The value to check.
-     * @param argument A description for the argument, used to
+     * @param description A description for the argument, used to
      * construct a message like {@code "xxx must be positive."}.
      * Can be {@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 negative.
+     * @throws IllegalArgumentException if the value is negative or zero.
      */
-    public static void checkPositive(final int value, final String argument) {
+    public static void checkPositive(final int value, final String description) {
         if (value <= 0) {
-            if (isNullOrEmpty(argument)) {
+            if (isNullOrEmpty(description)) {
                 throw new IllegalArgumentException();
             } else {
-                throw new IllegalArgumentException(argument + " must be positive.");
+                throw new IllegalArgumentException(description + " must be positive.");
             }
         }
     }
 
     /**
      * Check if the input argument is positive (greater than zero), and throw an
+     * {@link IllegalArgumentException} if not.
+     *
+     * @param value The value to check.
+     * @throws IllegalArgumentException if the value is negative or zero.
+     */
+    public static void checkPositive(final int value) {
+        checkPositive(value, null);
+    }
+
+    /**
+     * Check if the input argument is positive (greater than zero), and throw an
      * {@link IllegalArgumentException} if not, with or without a descriptive message,
-     * depending on the {@code argument} supplied.
+     * depending on the {@code description} supplied.
      *
      * @param value The value to check.
-     * @param argument A description for the argument, used to
+     * @param description A description for the argument, used to
      * construct a message like {@code "xxx must be positive."}.
      * Can be {@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 negative.
      */
-    public static void checkPositive(final float value, final String argument) {
+    public static void checkPositive(final float value, final String description) {
         if (value <= 0.0f) {
-            if (isNullOrEmpty(argument)) {
+            if (isNullOrEmpty(description)) {
                 throw new IllegalArgumentException();
             } else {
-                throw new IllegalArgumentException(argument + " must be positive.");
+                throw new IllegalArgumentException(description + " must be positive.");
             }
         }
     }
 
     /**
+     * Check if the input argument is positive (greater than zero), and throw an
+     * {@link IllegalArgumentException} if not.
+     *
+     * @param value The value to check.
+     * @throws IllegalArgumentException if the value is negative or zero.
+     */
+    public static void checkPositive(final float value) {
+        checkPositive(value, null);
+    }
+
+    /**
      * Check that the given value falls within the range of a non-negative "short" value, that is
      * between 0 and {@link Short#MAX_VALUE} (inclusive).
      *
      * @param value The value to check.
-     * @param argument The optional argument used to describe the value in case it is out of range
+     * @param description The optional argument used to describe the value in case it is out of range
      * (used in the thrown exception).
      * @throws IllegalArgumentException if the value is out of range.
      */
-    public static void checkInRangeOfShort(final int value, final String argument) {
+    public static void checkInRangeOfShort(final int value, final String description) {
         if (value < 0 || value > (int) Short.MAX_VALUE) {
-            String valueMsg = (String) ifNull(argument, "value");
+            String valueMsg = ifNull(description, "value");
             throw new IllegalArgumentException(valueMsg + " must be less than or equal "
                 + Short.MAX_VALUE + ".");
         }
     }
 
     /**
+     * Check that the given value falls within the range of a non-negative "short" value, that is
+     * between 0 and {@link Short#MAX_VALUE} (inclusive).
+     *
+     * @param value The value to check.
+     * @throws IllegalArgumentException if the value is out of range.
+     */
+    public static void checkInRangeOfShort(final int value) {
+        checkInRangeOfShort(value, null);
+    }
+
+    /**
      * Check that the given {@code index} is between the values of {@code start} and {@code end}.
      *
      * @param index  The candidate index into the range.

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java?rev=1884968&r1=1884967&r2=1884968&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java Wed Dec 30 23:15:54 2020
@@ -936,7 +936,7 @@ public final class DesktopApplicationCon
         args[0] = applicationInstance.getClass().getName();
         args[1] = "--" + USE_APPLICATION_INSTANCE_ARGUMENT + "=true";
 
-        this.application = applicationInstance;
+        application = applicationInstance;
 
         main(args);
     }
@@ -959,7 +959,7 @@ public final class DesktopApplicationCon
         args[1] = "--" + USE_APPLICATION_INSTANCE_ARGUMENT + "=true";
 
         System.arraycopy(applicationArgs, 0, args, 2, applicationArgs.length);
-        this.application = applicationInstance;
+        application = applicationInstance;
 
         main(args);
     }