[
https://issues.apache.org/jira/browse/GOBBLIN-2041?focusedWorklogId=914313&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-914313
]
ASF GitHub Bot logged work on GOBBLIN-2041:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 12/Apr/24 03:50
Start Date: 12/Apr/24 03:50
Worklog Time Spent: 10m
Work Description: phet opened a new pull request, #3920:
URL: https://github.com/apache/gobblin/pull/3920
Dear Gobblin maintainers,
Please accept this PR. I understand that it will not be reviewed until I
have checked off all the steps below!
### JIRA
- [ ] My PR addresses the following [Gobblin
JIRA](https://issues.apache.org/jira/browse/GOBBLIN/) issues and references
them in the PR title. For example, "[GOBBLIN-XXX] My Gobblin PR"
- https://issues.apache.org/jira/browse/GOBBLIN-2041
### Description
- [ ] Here are some details about my PR, including screenshots (if
applicable):
Access to the property `gobblin.copy.copy.entity.class`, which is NOT
mandatory in a `WorkUnit` can cause `CopySource::getCopyEntityClass` to throw
NPE:
```
java.lang.NullPointerException:
at java.lang.Class.forName0(Native Method:0)
at java.lang.Class.forName(Class.java:264)
at
org.apache.gobblin.data.management.copy.CopySource.getCopyEntityClass(CopySource.java:558)
at
org.apache.gobblin.temporal.ddm.activity.impl.ProcessWorkUnitImpl.getOptCopyEntityClass(ProcessWorkUnitImpl.java:204)
at
org.apache.gobblin.temporal.ddm.activity.impl.ProcessWorkUnitImpl.getOptCopyableFile(ProcessWorkUnitImpl.java:184)
...
```
This change adds a guard, to avoid the NPE and now log, such as:
```
java.io.IOException: property 'gobblin.copy.copy.entity.class' not found in
state: WorkUnit(super=Common:{}
Specific: {source.filebased.fs.snapshot=<<redacted-URL>>,
converter.avro.jdbc.date_fields={},
writer.staging.table=stage_2663272993647806,
source.filebased.files.to.pull=<<redacted-URL>>, job.id=<<job-id>>, task.key=0,
task.id=<<task-id>>}, extract=Common:{}
Specific: {extract.extract.id=20240412013924, extract.table.name=<<path>>,
extract.table.type=APPEND_ONLY, extract.namespace=<<namespace>>,
extract.extractIdTimeZone=UTC, extract.is.full=false})
at
org.apache.gobblin.data.management.copy.CopySource.getCopyEntityClass(CopySource.java:558)
at
org.apache.gobblin.temporal.ddm.activity.impl.ProcessWorkUnitImpl.getOptCopyEntityClass(ProcessWorkUnitImpl.java:194)
at
org.apache.gobblin.temporal.ddm.activity.impl.ProcessWorkUnitImpl.getOptCopyableFile(ProcessWorkUnitImpl.java:174)
...
```
### Tests
- [ ] My PR adds the following unit tests __OR__ does not need testing for
this extremely good reason:
manual observation
### Commits
- [ ] My commits all reference JIRA issues in their subject lines, and I
have squashed multiple commits if they address the same issue. In addition, my
commits follow the guidelines from "[How to write a good git commit
message](http://chris.beams.io/posts/git-commit/)":
1. Subject is separated from body by a blank line
2. Subject is limited to 50 characters
3. Subject does not end with a period
4. Subject uses the imperative mood ("add", not "adding")
5. Body wraps at 72 characters
6. Body explains "what" and "why", not "how"
Issue Time Tracking
-------------------
Worklog Id: (was: 914313)
Remaining Estimate: 0h
Time Spent: 10m
> CopySource::getCopyEntityClass throws NPE when optional property missing
> ------------------------------------------------------------------------
>
> Key: GOBBLIN-2041
> URL: https://issues.apache.org/jira/browse/GOBBLIN-2041
> Project: Apache Gobblin
> Issue Type: New Feature
> Components: gobblin-core
> Reporter: Kip Kohn
> Assignee: Abhishek Tiwari
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> access to prop `gobblin.copy.copy.entity.class`, when not present, causes:
> {code}
> java.lang.NullPointerException:
> at java.lang.Class.forName0(Native Method:0)
> at java.lang.Class.forName(Class.java:264)
> at
> org.apache.gobblin.data.management.copy.CopySource.getCopyEntityClass(CopySource.java:558)
> at
> org.apache.gobblin.temporal.ddm.activity.impl.ProcessWorkUnitImpl.getOptCopyEntityClass(ProcessWorkUnitImpl.java:204)
> at
> org.apache.gobblin.temporal.ddm.activity.impl.ProcessWorkUnitImpl.getOptCopyableFile(ProcessWorkUnitImpl.java:184)
> ...
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)