You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by cb...@apache.org on 2011/07/13 18:37:30 UTC
svn commit: r1146120 -
/pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
Author: cbartlett
Date: Wed Jul 13 16:37:30 2011
New Revision: 1146120
URL: http://svn.apache.org/viewvc?rev=1146120&view=rev
Log:
Addition of text to IllegalArgumentExceptions explaining the underlying problems.
Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java?rev=1146120&r1=1146119&r2=1146120&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java Wed Jul 13 16:37:30 2011
@@ -176,7 +176,7 @@ public final class GraphicsUtilities {
public static Color decodeColor(String value) throws NumberFormatException {
if (value == null) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("Cannot decode a null String.");
}
value = value.toLowerCase(Locale.ENGLISH);
@@ -185,7 +185,8 @@ public final class GraphicsUtilities {
if (value.startsWith("0x")) {
value = value.substring(2);
if (value.length() != 8) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(
+ "Incorrect Color format. Expecting exactly 8 digits after the '0x' prefix.");
}
int rgb = Integer.parseInt(value.substring(0, 6), 16);
@@ -195,7 +196,8 @@ public final class GraphicsUtilities {
} else if (value.startsWith("#")) {
value = value.substring(1);
if (value.length() != 6) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(
+ "Incorrect Color format. Expecting exactly 6 digits after the '#' prefix.");
}
int rgb = Integer.parseInt(value, 16);
@@ -223,7 +225,7 @@ public final class GraphicsUtilities {
public static Paint decodePaint(String value) {
if (value == null) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("Cannot decode a null String.");
}
Paint paint;