mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-04-07 19:14:17 +00:00
Throw an explicit error instead of a NullPointerException
This commit is contained in:
parent
ee68856878
commit
f0ce85bd8d
@ -46,6 +46,8 @@ public abstract class AbstractId {
|
||||
private final byte[] binary;
|
||||
|
||||
public AbstractId(String hex) throws InvalidHexException {
|
||||
if (hex==null)
|
||||
throw new InvalidHexException(this, "null is not a invalid hex value");
|
||||
if (hex.length() != getBinarySize()*2)
|
||||
throw new InvalidHexException(this, "invalid length " + hex.length() + " (should be " + (getBinarySize() * 2) + ") of '" + hex + "'");
|
||||
binary = new byte[getBinarySize()];
|
||||
|
Loading…
x
Reference in New Issue
Block a user