Skip to content

Commit

Permalink
[GOBBLIN-2041] Fix NPE in CopySource::getCopyEntityClass (#3920)
Browse files Browse the repository at this point in the history
  • Loading branch information
phet committed Apr 12, 2024
1 parent 19d1620 commit 97fc864
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,13 @@ public static void serializeCopyEntity(State state, CopyEntity copyEntity) {
state.setProp(COPY_ENTITY_CLASS, copyEntity.getClass().getName());
}

public static Class<?> getCopyEntityClass(State state)
throws IOException {
public static Class<?> getCopyEntityClass(State state) throws IOException {
Optional<String> optClassName = Optional.fromNullable(state.getProp(COPY_ENTITY_CLASS));
if (!optClassName.isPresent()) {
throw new IOException("property '" + COPY_ENTITY_CLASS + "' not found in state: " + state);
}
try {
return Class.forName(state.getProp(COPY_ENTITY_CLASS));
return Class.forName(optClassName.get());
} catch (ClassNotFoundException cnfe) {
throw new IOException(cnfe);
}
Expand Down

0 comments on commit 97fc864

Please sign in to comment.