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

MutableException check fails with NPE if extended class is in canonical form #1124

Closed
mkordas opened this issue May 23, 2015 · 8 comments
Closed

Comments

@mkordas
Copy link
Contributor

mkordas commented May 23, 2015

MutableException check fails with NullPointerException if extended class is in canonical form.

Configuration

<module name="MutableException"/>

Input file

class CustomException extends java.lang.Exception {}

Stacktrace

java.lang.NullPointerException
        at com.puppycrawl.tools.checkstyle.checks.design.MutableExceptionCheck.isExtendedClassNamedAsException(MutableExceptionCheck.java:155)
        at com.puppycrawl.tools.checkstyle.checks.design.MutableExceptionCheck.visitClassDef(MutableExceptionCheck.java:114)
        at com.puppycrawl.tools.checkstyle.checks.design.MutableExceptionCheck.visitToken(MutableExceptionCheck.java:91)
        at com.puppycrawl.tools.checkstyle.TreeWalker.notifyVisit(TreeWalker.java:393)
        at com.puppycrawl.tools.checkstyle.TreeWalker.processIter(TreeWalker.java:482)
        at com.puppycrawl.tools.checkstyle.TreeWalker.walk(TreeWalker.java:322)
        at com.puppycrawl.tools.checkstyle.TreeWalker.processFiltered(TreeWalker.java:195)
        at com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck.process(AbstractFileSetCheck.java:76)
        at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:260)
@romani
Copy link
Member

romani commented May 24, 2015

Pleaese let me know name of opensource project where you found such code, we might use it in checkstyle-checker.

@mkordas
Copy link
Contributor Author

mkordas commented May 24, 2015

It's the project we already use - Findbugs.

@romani
Copy link
Member

romani commented May 24, 2015

Hmm, i checked it on 6.6 it worked fine, so i put priority Hight. I will think how to can make huge regression testing on each commit.

@Vladlis
Copy link
Contributor

Vladlis commented May 24, 2015

Sorry, this is my fault
#1103

Vladlis added a commit to Vladlis/checkstyle that referenced this issue May 24, 2015
Vladlis added a commit to Vladlis/checkstyle that referenced this issue May 24, 2015
romani pushed a commit that referenced this issue May 25, 2015
@romani romani added this to the 6.7 milestone May 25, 2015
@romani
Copy link
Member

romani commented May 25, 2015

merged.

@romani romani closed this as completed May 25, 2015
@romani
Copy link
Member

romani commented May 25, 2015

@Vladlis, on any next PR from you, please test by checkstyle-tester all your changes, and confirm that there is no Errors after your changes for "dead code".

@mkordas
Copy link
Contributor Author

mkordas commented May 25, 2015

This issue needs to be reopened. In this case removing "dead" code and then having NPE was VERY valuable, as it revealed missing implementation for canonical class names. Adding null check hid the issue once again.
I'll provide failing test and new implementation shortly.

@romani
Copy link
Member

romani commented May 25, 2015

I keep it close, as you already fixed it.

mkordas added a commit to mkordas/checkstyle that referenced this issue May 25, 2015
Shaman20 added a commit to Shaman20/checkstyle that referenced this issue Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants