{"action":"created","issue":{"url":"https://api.github.com/repos/checkstyle/checkstyle/issues/921","labels_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/921/labels{/name}","comments_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/921/comments","events_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/921/events","html_url":"https://github.com/checkstyle/checkstyle/issues/921","id":67755896,"number":921,"title":"NullPointerException from TreeWalker.destroy","user":{"login":"jshiell","id":1030482,"avatar_url":"https://avatars.githubusercontent.com/u/1030482?v=3","gravatar_id":"","url":"https://api.github.com/users/jshiell","html_url":"https://github.com/jshiell","followers_url":"https://api.github.com/users/jshiell/followers","following_url":"https://api.github.com/users/jshiell/following{/other_user}","gists_url":"https://api.github.com/users/jshiell/gists{/gist_id}","starred_url":"https://api.github.com/users/jshiell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jshiell/subscriptions","organizations_url":"https://api.github.com/users/jshiell/orgs","repos_url":"https://api.github.com/users/jshiell/repos","events_url":"https://api.github.com/users/jshiell/events{/privacy}","received_events_url":"https://api.github.com/users/jshiell/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/checkstyle/checkstyle/labels/approved","name":"approved","color":"009800"}],"state":"open","locked":false,"assignee":{"login":"pirat9600q","id":8556628,"avatar_url":"https://avatars.githubusercontent.com/u/8556628?v=3","gravatar_id":"","url":"https://api.github.com/users/pirat9600q","html_url":"https://github.com/pirat9600q","followers_url":"https://api.github.com/users/pirat9600q/followers","following_url":"https://api.github.com/users/pirat9600q/following{/other_user}","gists_url":"https://api.github.com/users/pirat9600q/gists{/gist_id}","starred_url":"https://api.github.com/users/pirat9600q/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pirat9600q/subscriptions","organizations_url":"https://api.github.com/users/pirat9600q/orgs","repos_url":"https://api.github.com/users/pirat9600q/repos","events_url":"https://api.github.com/users/pirat9600q/events{/privacy}","received_events_url":"https://api.github.com/users/pirat9600q/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/checkstyle/checkstyle/milestones/1","html_url":"https://github.com/checkstyle/checkstyle/milestones/6.6","labels_url":"https://api.github.com/repos/checkstyle/checkstyle/milestones/1/labels","id":1042371,"number":1,"title":"6.6","description":"Release 6.6","creator":{"login":"romani","id":812984,"avatar_url":"https://avatars.githubusercontent.com/u/812984?v=3","gravatar_id":"","url":"https://api.github.com/users/romani","html_url":"https://github.com/romani","followers_url":"https://api.github.com/users/romani/followers","following_url":"https://api.github.com/users/romani/following{/other_user}","gists_url":"https://api.github.com/users/romani/gists{/gist_id}","starred_url":"https://api.github.com/users/romani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/romani/subscriptions","organizations_url":"https://api.github.com/users/romani/orgs","repos_url":"https://api.github.com/users/romani/repos","events_url":"https://api.github.com/users/romani/events{/privacy}","received_events_url":"https://api.github.com/users/romani/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":13,"state":"open","created_at":"2015-03-27T21:29:15Z","updated_at":"2015-04-11T14:14:54Z","due_on":"2015-04-26T07:00:00Z","closed_at":null},"comments":5,"created_at":"2015-04-11T08:36:21Z","updated_at":"2015-04-12T21:40:21Z","closed_at":null,"body":"One of the users of the IDEA plugin [reported a problem](https://github.com/jshiell/checkstyle-idea/issues/150) with a NPE being generated during TreeWalker.destroy. This is reproducible with the 6.5 JAR distribution.\r\n\r\n```\r\n$  java -jar ../checkstyle-6.5-all.jar -c rules.xml TestCase.java\r\nException in thread \"main\" java.lang.NullPointerException\r\n\tat com.google.common.io.Flushables.flush(Flushables.java:56)\r\n\tat com.puppycrawl.tools.checkstyle.PropertyCacheFile.flushAndCloseOutStream(PropertyCacheFile.java:135)\r\n\tat com.puppycrawl.tools.checkstyle.PropertyCacheFile.destroy(PropertyCacheFile.java:123)\r\n\tat com.puppycrawl.tools.checkstyle.TreeWalker.destroy(TreeWalker.java:499)\r\n\tat com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:299)\r\n\tat com.puppycrawl.tools.checkstyle.Main.main(Main.java:125)\r\n```\r\n\r\nThe rules file is:\r\n```\r\n<?xml version=\"1.0\"?>\r\n<!DOCTYPE module PUBLIC\r\n        \"-//Puppy Crawl//DTD Check Configuration 1.2//EN\"\r\n        \"http://www.puppycrawl.com/dtds/configuration_1_2.dtd\">\r\n\r\n<module name=\"Checker\">\r\n    <module name=\"TreeWalker\">\r\n        <property name=\"cacheFile\" value=\"target/checkstyle_cache\"/>\r\n    </module>\r\n</module>\r\n```\r\n\r\nThe test Java file is pretty trivial:\r\n```\r\npublic class TestCase {\r\n\r\n}\r\n```\r\n\r\nThank you :smile:"},"comment":{"url":"https://api.github.com/repos/checkstyle/checkstyle/issues/comments/92137007","html_url":"https://github.com/checkstyle/checkstyle/issues/921#issuecomment-92137007","issue_url":"https://api.github.com/repos/checkstyle/checkstyle/issues/921","id":92137007,"user":{"login":"mkordas","id":5467276,"avatar_url":"https://avatars.githubusercontent.com/u/5467276?v=3","gravatar_id":"","url":"https://api.github.com/users/mkordas","html_url":"https://github.com/mkordas","followers_url":"https://api.github.com/users/mkordas/followers","following_url":"https://api.github.com/users/mkordas/following{/other_user}","gists_url":"https://api.github.com/users/mkordas/gists{/gist_id}","starred_url":"https://api.github.com/users/mkordas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkordas/subscriptions","organizations_url":"https://api.github.com/users/mkordas/orgs","repos_url":"https://api.github.com/users/mkordas/repos","events_url":"https://api.github.com/users/mkordas/events{/privacy}","received_events_url":"https://api.github.com/users/mkordas/received_events","type":"User","site_admin":false},"created_at":"2015-04-12T21:40:21Z","updated_at":"2015-04-12T21:40:21Z","body":"This is interesting - in UT I get this NPE only when path to cache file is invalid or write to this file was not successful. And from code perspective, this is also the only possibility (see https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/PropertyCacheFile.java#L110).\r\n\r\nUT with `<property name=\"cacheFile\" value=\"target/checkstyle_cache\"/>` passes, while UT `<property name=\"cacheFile\" value=\"/invalidPath!\"/>` fails with the same stacktrace as presented. \r\n\r\nAm I right or I miss something?"}}