Skip to content

Commit eeb22f5

Browse files
committed
Simplify creation of exception messages
1 parent c1930c8 commit eeb22f5

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/main/java/com/maxmind/db/Decoder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ private <T> Object decodeMapIntoObject(int size, Class<T> cls)
448448
+ " Java Type: " +parameterTypes[index].getCanonicalName());
449449
}
450450
}
451-
throw new DeserializationException("Error creating object of type: " + cls.getSimpleName() + " - " + sbErrors.toString(), e);
451+
throw new DeserializationException("Error creating object of type: " + cls.getSimpleName() + " - " + sbErrors, e);
452452
}
453453
}
454454

src/main/java/com/maxmind/db/Reader.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,7 @@ record = this.readNode(buffer, record, bit);
184184
try {
185185
dataRecord = this.resolveDataPointer(buffer, record, cls);
186186
} catch (DeserializationException exception) {
187-
String msgCause = Optional.ofNullable(exception).map(Exception::getMessage).orElse("");
188-
throw new DeserializationException("Error getting record for IP " + ipAddress.toString() + " - " + msgCause, exception);
187+
throw new DeserializationException("Error getting record for IP " + ipAddress + " - " + exception.getMessage(), exception);
189188
}
190189
}
191190
return new DatabaseRecord<>(dataRecord, ipAddress, pl);

0 commit comments

Comments
 (0)