Skip to content

Commit

Permalink
fix IOUtil#readObject
Browse files Browse the repository at this point in the history
  • Loading branch information
adamtomi committed Nov 24, 2022
1 parent dc2ec53 commit cf8bea8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/com/vamk/tbg/util/IOUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static <O extends Serializable> void writeObject(O serializable, String p
public static <O extends Serializable> O readObject(Class<O> type, String path) throws ClassNotFoundException, IOException {
try (ObjectInputStream in = new ObjectInputStream(new FileInputStream(path))) {
Object result = in.readObject();
if (!type.isInstance(type)) throw new IllegalStateException("Object %s is not of type %s".formatted(result, type.getName()));
if (!type.isInstance(result)) throw new IllegalStateException("Object %s is not of type %s".formatted(result, type.getName()));

return type.cast(result);
}
Expand Down

0 comments on commit cf8bea8

Please sign in to comment.