{"action":"created","issue":{"url":"https://api.github.com/repos/checkstyle/checkstyle/issues/583","labels_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/583/labels{/name}","comments_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/583/comments","events_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/583/events","html_url":"https://github.com/checkstyle/checkstyle/issues/583","id":54493145,"number":583,"title":"PackageDeclarationCheck.finishTree throws NPE","user":{"login":"felixpageau","id":7828198,"avatar_url":"https://avatars.githubusercontent.com/u/7828198?v=3","gravatar_id":"","url":"https://api.github.com/users/felixpageau","html_url":"https://github.com/felixpageau","followers_url":"https://api.github.com/users/felixpageau/followers","following_url":"https://api.github.com/users/felixpageau/following{/other_user}","gists_url":"https://api.github.com/users/felixpageau/gists{/gist_id}","starred_url":"https://api.github.com/users/felixpageau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixpageau/subscriptions","organizations_url":"https://api.github.com/users/felixpageau/orgs","repos_url":"https://api.github.com/users/felixpageau/repos","events_url":"https://api.github.com/users/felixpageau/events{/privacy}","received_events_url":"https://api.github.com/users/felixpageau/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/checkstyle/checkstyle/labels/incomplete","name":"incomplete","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-15T19:33:09Z","updated_at":"2015-01-16T17:56:22Z","closed_at":null,"body":"When I run checkstyle-6.1.1 against my codebase, I get a NPE in checkstyle:\r\n\r\n    [error] java.lang.NullPointerException\r\n    [error] \tat com.puppycrawl.tools.checkstyle.checks.coding.PackageDeclarationCheck.finishTree(PackageDeclarationCheck.java:73)\r\n    [error] \tat com.puppycrawl.tools.checkstyle.TreeWalker.notifyEnd(TreeWalker.java:420)\r\n    [error] \tat com.puppycrawl.tools.checkstyle.TreeWalker.walk(TreeWalker.java:376)\r\n    [error] \tat com.puppycrawl.tools.checkstyle.TreeWalker.processFiltered(TreeWalker.java:207)\r\n    [error] \tat com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck.process(AbstractFileSetCheck.java:73)\r\n    [error] \tat com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:263)\r\n    [error] \tat com.puppycrawl.tools.checkstyle.Main.main(Main.java:129)\r\n\r\n\r\nBy digging in the source code, it seems to be caused by the PackageDeclarationCheck.finishTree() using the input parameter without checking that it isn't null. \r\n\r\nSee: https://github.com/checkstyle/checkstyle/blob/501b7c5240705c6db756608618fdcf58189e807e/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/PackageDeclarationCheck.java#L60"},"comment":{"url":"https://api.github.com/repos/checkstyle/checkstyle/issues/comments/70293540","html_url":"https://github.com/checkstyle/checkstyle/issues/583#issuecomment-70293540","issue_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/583","id":70293540,"user":{"login":"felixpageau","id":7828198,"avatar_url":"https://avatars.githubusercontent.com/u/7828198?v=3","gravatar_id":"","url":"https://api.github.com/users/felixpageau","html_url":"https://github.com/felixpageau","followers_url":"https://api.github.com/users/felixpageau/followers","following_url":"https://api.github.com/users/felixpageau/following{/other_user}","gists_url":"https://api.github.com/users/felixpageau/gists{/gist_id}","starred_url":"https://api.github.com/users/felixpageau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixpageau/subscriptions","organizations_url":"https://api.github.com/users/felixpageau/orgs","repos_url":"https://api.github.com/users/felixpageau/repos","events_url":"https://api.github.com/users/felixpageau/events{/privacy}","received_events_url":"https://api.github.com/users/felixpageau/received_events","type":"User","site_admin":false},"created_at":"2015-01-16T17:56:22Z","updated_at":"2015-01-16T17:56:22Z","body":"I did test with both 6.2 and the yet unreleased 6.3. Both fail in the exact same way as 6.1 did. \r\n\r\nAfter removing out the 'PackageDeclaration' module from my config, I got checkstyle to run just fine on my codebase.\r\n\r\nI'll just submit a patch to add a null check on line 60 of PackageDeclarationCheck"}}