-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix task def name npe #360
Conversation
@@ -533,6 +533,9 @@ public TaskDef getTaskDefinition() { | |||
* @param taskDefinition Task definition | |||
*/ | |||
public void setTaskDefinition(TaskDef taskDefinition) { | |||
if (taskDefinition != null && taskDefinition.getName() == null) { | |||
taskDefinition.setName(this.name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not expect a setX(X arg)
to mutate the passed parameter. It’s not ideal to introduce side effects to a passed parameter.
Either avoid the side effect, document it clearly or create a copy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shaileshpadave can you check where is this being called from and the caller should fix this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request type
NOTE: Please remember to run
./gradlew spotlessApply
to fix any format violations.Changes in this PR
About the taskDef npe exception for http tasks!
When task definition is not provided and we are trying to use inputSchema in task, then during deserialisation, name will be set to null. We never checked for taskDef name before so never faced issue.
Fix:
Check if taskdef.getName() is null then set taskName.
Describe the new behavior from this PR, and why it's needed
Issue #
Alternatives considered
Describe alternative implementation you have considered