Menu

#395 NPE on SuppressWarningsHolder

6.9.0
closed
None
1
2017-12-20
2015-10-07
hkais
No

I am getting a NPE on checking with latest eclipse checkstyle plugin.

java.lang.NullPointerException
        at com.puppycrawl.tools.checkstyle.checks.SuppressWarningsHolder.isSuppressed(SuppressWarningsHolder.java:207)
        at com.puppycrawl.tools.checkstyle.filters.SuppressWarningsFilter.accept(SuppressWarningsFilter.java:38)
        at com.puppycrawl.tools.checkstyle.api.FilterSet.accept(FilterSet.java:88)
        at com.puppycrawl.tools.checkstyle.Checker.fireErrors(Checker.java:353)
        at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:271)
        at net.sf.eclipsecs.core.builder.Auditor.runAudit(Auditor.java:159)
        at net.sf.eclipsecs.core.builder.CheckstyleBuilder.handleBuildSelection(CheckstyleBuilder.java:300)
        at net.sf.eclipsecs.core.jobs.RunCheckstyleOnFilesJob.runInWorkspace(RunCheckstyleOnFilesJob.java:116)
        at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

If I got it properly the issue is caused by:

<module name="TreeWalker">
    <module name="SuppressWarningsHolder" />

The issue is, that this is not fully reproducable. Sometimes the error occurs, sometimes not?!?
A higher probablility on getting the NPE is if I do a full clean of the checkstyle violations and rerun checkstyle.

The next issue is, that the error does not report any file or folder on which the error occurs.
So I even tried to narrow down to the corresponding folder, but still cannot reproduce it to be sure on what file the error occurs.

Is there a way how I could get a more tracing in the NPE on which file the error occured?

Discussion

  • Lars Koedderitzsch

    Hey again, this seems like a Checkstyle bug, which you should file over here: https://github.com/checkstyle/checkstyle

    Unfortunately there are no extended logging facilities, neither in the plugin nor in the Checkstyle core library, which would help in tracking down the causing file.

    After you filed the bug over at the Checkstyle core project, please add the issue link here - I want to add my 2 cents about the (recently changed) internal error handling in Checkstyle core.

     
  • hkais

    hkais - 2015-10-09

    Hello together,
    thank you for your quick revert.
    As mentioned, i cannot reproduce it easily. On the CLI (jenkins build with ANT) it seems to working fine with same version (6.9)
    Is there any way to activate a tracing of the currently processed files? It would be also a big improvement for the error reports you will get if you trace out the currently processed files.

     
  • Roman Ivanov

    Roman Ivanov - 2015-12-04

    Is there any way to activate a tracing of the currently processed files?

    For now we do not have this abillity.

    Lars, do you eclipse-cs provide to checkstyle folder with files to process or specific list of files. I just need to understand who should help with tracing.

    Lars, do you have ability to show log events from checkstyle in eclispe-cs ?
    I could put "LOG.debug("file" + file.getAbsolutePath);" to https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java#L254 . Please share your thought what could be done to allow such tracing.

     
  • Lars Koedderitzsch

    Closing for housekeeping, this issue had been fixed in Checkstyle core (quite) a while back.

     
  • Lars Koedderitzsch

    • status: open --> closed
    • assigned_to: Lars Koedderitzsch
     

Log in to post a comment.