diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/NumberUtil.java b/smack-core/src/main/java/org/jivesoftware/smack/util/NumberUtil.java index 831ccf0ad..98635309d 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/NumberUtil.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/NumberUtil.java @@ -1,6 +1,6 @@ /** * - * Copyright © 2015-2019 Florian Schmaus + * Copyright © 2015-2020 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,15 +33,15 @@ public class NumberUtil { /** * Checks if the given long is within the range of an unsigned 32-bit integer, the XML type "xs:unsignedInt". * - * @param value TODO javadoc me please + * @param value the long to check. * @return the input value. */ public static long requireUInt32(long value) { if (value < 0) { - throw new IllegalArgumentException("unsigned 32-bit integers can't be negative"); + throw new IllegalArgumentException("unsigned 32-bit integers can't be negative: " + value); } if (value > ((1L << 32) - 1)) { - throw new IllegalArgumentException("unsigned 32-bit integers can't be greater than 2^32 - 1"); + throw new IllegalArgumentException("unsigned 32-bit integers can't be greater than 2^32 - 1: " + value); } return value; } @@ -49,15 +49,15 @@ public class NumberUtil { /** * Checks if the given int is within the range of an unsigned 16-bit integer, the XML type "xs:unsignedShort". * - * @param value TODO javadoc me please + * @param value the int to check. * @return the input value. */ public static int requireUShort16(int value) { if (value < 0) { - throw new IllegalArgumentException("unsigned 16-bit integers can't be negative"); + throw new IllegalArgumentException("unsigned 16-bit integers can't be negative: " + value); } if (value > ((1 << 16) - 1)) { - throw new IllegalArgumentException("unsigned 16-bit integers can't be greater than 2^16 - 1"); + throw new IllegalArgumentException("unsigned 16-bit integers can't be greater than 2^16 - 1: " + value); } return value; } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatavalidation/DataValidationHelperTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatavalidation/DataValidationHelperTest.java index a12effdb6..42f08f499 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatavalidation/DataValidationHelperTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatavalidation/DataValidationHelperTest.java @@ -44,9 +44,8 @@ public class DataValidationHelperTest { () -> element.checkConsistency(field)); assertEquals("Field type 'jid-single' is not consistent with validation method 'basic'.", vce.getMessage()); - IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, + assertThrows(IllegalArgumentException.class, () -> new ListRange(-1L, 1L)); - assertEquals("unsigned 32-bit integers can't be negative", iae.getMessage()); element.setListRange(new ListRange(10L, 100L)); vce = assertThrows(ValidationConsistencyException.class, () -> element.checkConsistency(field));