X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Futil%2Fnumber%2FHex.java;h=de7929e7cfe65e7982a67bd6c9a71055ed80494c;hb=1318ca0dedd3b2c0e5457979b0d4ec111df6fa8d;hp=3f6145f75b0cd9c6e280d4c66708d0b2423c6ffc;hpb=2e719ee43cf1b21c9445c67a0707e8373d77ee66;p=jSite2.git diff --git a/src/net/pterodactylus/util/number/Hex.java b/src/net/pterodactylus/util/number/Hex.java index 3f6145f..de7929e 100644 --- a/src/net/pterodactylus/util/number/Hex.java +++ b/src/net/pterodactylus/util/number/Hex.java @@ -68,11 +68,13 @@ public class Hex { * The hexadecimal representation to decode * @return The decoded byte array * @see Integer#parseInt(java.lang.String, int) + * @throw NumberFormatException if the given string is not the hexadecimal + * representation of a byte array */ 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) {