Fix the UnknownHostException is swallowed (#3495)

This commit is contained in:
ljhrot 2020-08-02 18:59:58 +08:00 committed by GitHub
parent 4310b3ee47
commit b79f048a9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,7 +88,7 @@ public class SnowFlowerIdGenerator implements IdGenerator {
try {
address = InetAddress.getLocalHost();
} catch (final UnknownHostException e) {
throw new IllegalStateException("Cannot get LocalHost InetAddress, please check your network!");
throw new IllegalStateException("Cannot get LocalHost InetAddress, please check your network!", e);
}
byte[] ipAddressByteArray = address.getAddress();
this.workerId = (((ipAddressByteArray[ipAddressByteArray.length - 2] & 0B11) << Byte.SIZE) + (