You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gobblin.apache.org by "phet (via GitHub)" <gi...@apache.org> on 2024/04/12 03:50:32 UTC
[PR] [GOBBLIN-2041] Fix NPE in `CopySource::getCopyEntityClass` [gobblin]
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"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@gobblin.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [GOBBLIN-2041] Fix NPE in `CopySource::getCopyEntityClass` [gobblin]
Posted by "Will-Lo (via GitHub)" <gi...@apache.org>.
Will-Lo commented on PR #3920:
URL: https://github.com/apache/gobblin/pull/3920#issuecomment-2052054544
This would be changing the NPE into an IOException instead right? The underlying issue is that not every source has a CopyEntityClass which is depended on by `ProcessWorkUnitImpl`, it seems that you need to decouple the ProcessWorkUnitImpl with the CopySource since there are different Gobblin sources that can be used.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@gobblin.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [GOBBLIN-2041] Fix NPE in `CopySource::getCopyEntityClass` [gobblin]
Posted by "Will-Lo (via GitHub)" <gi...@apache.org>.
Will-Lo merged PR #3920:
URL: https://github.com/apache/gobblin/pull/3920
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@gobblin.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [GOBBLIN-2041] Fix NPE in `CopySource::getCopyEntityClass` [gobblin]
Posted by "phet (via GitHub)" <gi...@apache.org>.
phet commented on PR #3920:
URL: https://github.com/apache/gobblin/pull/3920#issuecomment-2052089195
> This would be changing the NPE into an IOException instead right? The underlying issue is that not every source has a CopyEntityClass which is depended on by `ProcessWorkUnitImpl`, it seems that you need to decouple the ProcessWorkUnitImpl with the CopySource since there are different Gobblin sources that can be used.
I do agree with addressing the presumption in `ProcessWorkUnitImpl`, but will do so separately. RN the presumption of `CopyEntity` only shows up there for informational logging, but I agree, that it's too `CopySource`-specific for the general case.
that said, protecting against NPE by first checking the result seems a reasonable stand-alone change, and this method already has `IOException` in its signature.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@gobblin.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org