Skip to content
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

Closed
wants to merge 6 commits into from
Closed

Fix task def name npe #360

wants to merge 6 commits into from

Conversation

shaileshpadave
Copy link
Contributor

@shaileshpadave shaileshpadave commented Jan 9, 2025

Pull Request type

  • Bugfix
  • Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • WHOSUSING.md
  • Other (please describe):

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

@@ -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);
Copy link
Contributor

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.

Copy link
Collaborator

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.

Copy link
Contributor

@jmigueprieto jmigueprieto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Please fix the description format. As it is, it's difficult to read. Remove the placeholder text.
Screenshot 2025-01-09 at 11 18 14

@v1r3n v1r3n closed this Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants