{"action":"closed","issue":{"url":"https://api.github.com/repos/ehcache/ehcache3/issues/620","labels_url":"https://api.github.com/repos/ehcache/ehcache3/issues/620/labels{/name}","comments_url":"https://api.github.com/repos/ehcache/ehcache3/issues/620/comments","events_url":"https://api.github.com/repos/ehcache/ehcache3/issues/620/events","html_url":"https://github.com/ehcache/ehcache3/issues/620","id":109112681,"number":620,"title":"NPE for invalid Cache config & non existing XML","user":{"login":"JSAhuja","id":7835175,"avatar_url":"https://avatars.githubusercontent.com/u/7835175?v=3","gravatar_id":"","url":"https://api.github.com/users/JSAhuja","html_url":"https://github.com/JSAhuja","followers_url":"https://api.github.com/users/JSAhuja/followers","following_url":"https://api.github.com/users/JSAhuja/following{/other_user}","gists_url":"https://api.github.com/users/JSAhuja/gists{/gist_id}","starred_url":"https://api.github.com/users/JSAhuja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JSAhuja/subscriptions","organizations_url":"https://api.github.com/users/JSAhuja/orgs","repos_url":"https://api.github.com/users/JSAhuja/repos","events_url":"https://api.github.com/users/JSAhuja/events{/privacy}","received_events_url":"https://api.github.com/users/JSAhuja/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ehcache/ehcache3/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/ehcache/ehcache3/labels/under%20review","name":"under review","color":"fbca04"}],"state":"closed","locked":false,"assignee":{"login":"albinsuresh","id":1647963,"avatar_url":"https://avatars.githubusercontent.com/u/1647963?v=3","gravatar_id":"","url":"https://api.github.com/users/albinsuresh","html_url":"https://github.com/albinsuresh","followers_url":"https://api.github.com/users/albinsuresh/followers","following_url":"https://api.github.com/users/albinsuresh/following{/other_user}","gists_url":"https://api.github.com/users/albinsuresh/gists{/gist_id}","starred_url":"https://api.github.com/users/albinsuresh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/albinsuresh/subscriptions","organizations_url":"https://api.github.com/users/albinsuresh/orgs","repos_url":"https://api.github.com/users/albinsuresh/repos","events_url":"https://api.github.com/users/albinsuresh/events{/privacy}","received_events_url":"https://api.github.com/users/albinsuresh/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/ehcache/ehcache3/milestones/6","html_url":"https://github.com/ehcache/ehcache3/milestones/Milestone%204","labels_url":"https://api.github.com/repos/ehcache/ehcache3/milestones/6/labels","id":1195232,"number":6,"title":"Milestone 4","description":"Focus on Ehcache 3 standalone stability\r\nByte sized heap, OSGi, testing and quality","creator":{"login":"alexsnaps","id":509058,"avatar_url":"https://avatars.githubusercontent.com/u/509058?v=3","gravatar_id":"","url":"https://api.github.com/users/alexsnaps","html_url":"https://github.com/alexsnaps","followers_url":"https://api.github.com/users/alexsnaps/followers","following_url":"https://api.github.com/users/alexsnaps/following{/other_user}","gists_url":"https://api.github.com/users/alexsnaps/gists{/gist_id}","starred_url":"https://api.github.com/users/alexsnaps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexsnaps/subscriptions","organizations_url":"https://api.github.com/users/alexsnaps/orgs","repos_url":"https://api.github.com/users/alexsnaps/repos","events_url":"https://api.github.com/users/alexsnaps/events{/privacy}","received_events_url":"https://api.github.com/users/alexsnaps/received_events","type":"User","site_admin":false},"open_issues":21,"closed_issues":8,"state":"open","created_at":"2015-07-06T16:24:09Z","updated_at":"2015-10-05T15:35:02Z","due_on":"2015-10-22T22:00:00Z","closed_at":null},"comments":1,"created_at":"2015-09-30T15:10:27Z","updated_at":"2015-10-05T15:35:02Z","closed_at":"2015-10-05T15:35:02Z","body":"Cont.. from the chain mail, getting NPE exception for below case.\r\nSomething meaningful messages can help user understand the NPE which are cause by user errors.\r\n\r\ni)       Pointed xml is not available.\r\n````\r\npublic void identityCopierTest() throws ClassNotFoundException, SAXException, InstantiationException, IOException, IllegalAccessException {\r\n  CopierCallCounter.resetCounter();\r\n  String initialAlias=\"Hello\", modifiedAlias=\"Verifying store by reference\";\r\n  Configuration xmlConfig = new XmlConfiguration(getClass().getResource(\"/XMLNotAvailable123.xml\"));//NPE, #42\r\n  CacheManager cacheManager = CacheManagerBuilder.newCacheManager(xmlConfig);\r\n  cacheManager.init();\r\n  Cache<Integer, Description> cache = cacheManager.getCache(\"IdentityCopier\", Integer.class, Description.class);\r\n  cacheManager.close();\r\n}\r\n````\r\n\r\nStack trace:\r\n````\r\njava.lang.NullPointerException\r\n    at org.ehcache.config.xml.XmlConfiguration.parseConfiguration(XmlConfiguration.java:158)\r\n    at org.ehcache.config.xml.XmlConfiguration.<init>(XmlConfiguration.java:152)\r\n    at org.ehcache.config.xml.XmlConfiguration.<init>(XmlConfiguration.java:127)\r\n    at org.ehcache.config.xml.XmlConfiguration.<init>(XmlConfiguration.java:107)\r\n    at com.terracotta.qa.ehcache.CustomCopierTest.identityCopierTest(CustomCopierTest.java:42)\r\n```` \r\n \r\nii) Cache config is not available in the XML, i.e. the xml is present but have only <ehcache:config> </ehcache:config> tags\r\n````` \r\npublic void identityCopierTest() throws ClassNotFoundException, SAXException, InstantiationException, IOException, IllegalAccessException {\r\n  CopierCallCounter.resetCounter();\r\n  String initialAlias=\"Hello\", modifiedAlias=\"Verifying store by reference\";\r\n  Configuration xmlConfig = new XmlConfiguration(getClass().getResource(\"/ehcache/CustomCopierTest.xml\"));\r\n  CacheManager cacheManager = CacheManagerBuilder.newCacheManager(xmlConfig);\r\n  cacheManager.init();\r\n  Cache<Integer, Description> cache = cacheManager.getCache(\"CacheNotDefined\", Integer.class, Description.class);// CacheNotDefined is not defined in the XML\r\n\r\n  Description desc = new Description(1234, initialAlias);\r\n  cache.put(1, desc);//NPE #48\r\n\r\n  cacheManager.close();\r\n}\r\n```` \r\nXML Something like this:\r\n````\r\n<ehcache:config\r\n    xmlns:ehcache='http://www.ehcache.org/v3'>\r\n</ehcache:config>\r\n````\r\n \r\nStack Trace:\r\n````\r\n20:43:45.231 [main] INFO  o.e.config.xml.XmlConfiguration - Loading Ehcache XML configuration from /C:/Users/jia/Documents/SourceTree/ehcachetest/copier/target/test-classes/ehcache/CustomCopierTest.xml.\r\n20:43:45.925 [main] INFO  org.ehcache.spi.ServiceLocator - All Services successfully started.\r\n20:43:45.928 [main] INFO  org.ehcache.EhcacheManager - Initialize successful.\r\njava.lang.NullPointerException\r\nat com.terracotta.qa.ehcache.CustomCopierTest.identityCopierTest(CustomCopierTest.java:48)\r\n````"}}