*/\r
public IdentifierManager(long lowerbound, long upperbound) {\r
if (lowerbound > upperbound) {\r
- String message = "lowerbound must not be greater than upperbound";\r
- throw new IllegalArgumentException(message);\r
+ throw new IllegalArgumentException("lowerbound must not be greater than upperbound, had " + lowerbound + " and " + upperbound);\r
}\r
else if (lowerbound < MIN_ID) { \r
String message = "lowerbound must be greater than or equal to " + Long.toString(MIN_ID);\r
else if (upperbound > MAX_ID) {\r
/*\r
* while MAX_ID is Long.MAX_VALUE, this check is pointless. But if\r
- * someone subclasses / tweaks the limits, this check if fine.\r
+ * someone subclasses / tweaks the limits, this check is fine.\r
*/\r
- String message = "upperbound must be less thean or equal " + Long.toString(MAX_ID);\r
- throw new IllegalArgumentException(message);\r
+ throw new IllegalArgumentException("upperbound must be less than or equal to " + Long.toString(MAX_ID) + " but had " + upperbound);\r
}\r
this.lowerbound = lowerbound;\r
this.upperbound = upperbound;\r
\r
public long reserve(long id) {\r
if (id < lowerbound || id > upperbound) {\r
- throw new IllegalArgumentException("Value for parameter 'id' was out of bounds");\r
+ throw new IllegalArgumentException("Value for parameter 'id' was out of bounds, had " + id + ", but should be within [" + lowerbound + ":" + upperbound + "]");\r
}\r
verifyIdentifiersLeft();\r
\r
*/\r
public boolean release(long id) {\r
if (id < lowerbound || id > upperbound) {\r
- throw new IllegalArgumentException("Value for parameter 'id' was out of bounds");\r
+ throw new IllegalArgumentException("Value for parameter 'id' was out of bounds, had " + id + ", but should be within [" + lowerbound + ":" + upperbound + "]");\r
}\r
\r
if (id == upperbound) {\r