Throw more appropriate exception.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 23 May 2009 15:19:55 +0000 (17:19 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 23 May 2009 15:19:55 +0000 (17:19 +0200)
src/net/pterodactylus/util/number/Hex.java

index 3f6145f..f92a31a 100644 (file)
@@ -72,7 +72,7 @@ public class Hex {
        public static byte[] toByte(String hexString) {
                if ((hexString.length() & 0x01) == 0x01) {
                        /* odd length, this is not correct. */
-                       throw new IllegalArgumentException("hex string must have even length.");
+                       throw new NumberFormatException("hex string must have even length.");
                }
                byte[] dataBytes = new byte[hexString.length() / 2];
                for (int stringIndex = 0; stringIndex < hexString.length(); stringIndex += 2) {