This is an automated email from the ASF dual-hosted git repository.
wlo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/gobblin.git
The following commit(s) were added to refs/heads/master by this push:
new 97fc86427 [GOBBLIN-2041] Fix NPE in `CopySource::getCopyEntityClass`
(#3920)
97fc86427 is described below
commit 97fc864271ff51912c4c242df59b42cc7485c477
Author: Kip Kohn <[email protected]>
AuthorDate: Fri Apr 12 14:14:48 2024 -0700
[GOBBLIN-2041] Fix NPE in `CopySource::getCopyEntityClass` (#3920)
---
.../java/org/apache/gobblin/data/management/copy/CopySource.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git
a/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopySource.java
b/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopySource.java
index 2773f280f..180eefac9 100644
---
a/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopySource.java
+++
b/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopySource.java
@@ -552,10 +552,13 @@ public class CopySource extends AbstractSource<String,
FileAwareInputStream> {
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);
}