Skip to content

[javascript] NPE while creating rule violation when specifying explicit line numbers #3516

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

Merged
merged 3 commits into from
Sep 25, 2021

Conversation

kevingnet
Copy link

Describe the PR

AbstractEcmascriptRule has a function that takes begin and end lines as parameters. However when using, it produces a null pointer exception. This solution adds the call to the constructor for ParametricRuleViolation in which it was added support for those two line parameters. The new constructor calls the default constructor and then sets the line parameters.

Related issues

  • Fixes #

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

@adangel adangel changed the title Kevingnet branch [javascript] NPE while creating rule violation when specifying explicit line numbers Sep 24, 2021
Copy link
Member

@adangel adangel left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

Please use the existing method setLines(int, int) instead of creating a new constructor.
You can call this method in EcmascriptRuleViolationFactory before returning the new rule violation.

@adangel adangel added the a:bug PMD crashes or fails to analyse a file. label Sep 24, 2021
@adangel adangel added this to the 6.39.0 milestone Sep 24, 2021
@adangel
Copy link
Member

adangel commented Sep 25, 2021

@kevingnet I've fixed this myself, so that this fix can be part of the release today...

@ghost
Copy link

ghost commented Sep 25, 2021

1 Message
📖 No java rules are changed!

Generated by 🚫 Danger

adangel added a commit that referenced this pull request Sep 25, 2021
adangel added a commit that referenced this pull request Sep 25, 2021
[javascript] NPE while creating rule violation when specifying explicit
line numbers #3516
@adangel adangel merged commit 4382a32 into pmd:master Sep 25, 2021
@adangel
Copy link
Member

adangel commented Sep 25, 2021

@all-contributors please add @kevingnet for code

@allcontributors
Copy link
Contributor

@adangel

I've put up a pull request to add @kevingnet! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug PMD crashes or fails to analyse a file.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants