Details
-
Improvement
-
Resolution: Fixed
-
Major
-
0.9.1252
-
None
Description
Running the following code with an invalid hibernateConfig object (a File instance):
XWikiContext context = new XWikiContext(); context.setUser("XWiki.superadmin"); context.setDatabase("xwiki"); XWikiConfig config = new XWikiConfig(); config.put("xwiki.store.class", "com.xpn.xwiki.store.XWikiHibernateStore"); config.put("xwiki.store.hibernate.path", hibernateConfig); config.put("xwiki.store.hibernate.updateschema", "1"); config.put("xwiki.virtual", "1"); XWiki xwiki = new XWiki(config, context); context.setWiki(xwiki);
Leads to a NPE:
13:42:18,897 ERROR main OSCacheService:loadProps:185 - Could not load cache properties oscache.properties java.lang.NullPointerException at com.xpn.xwiki.XWiki.getResourceAsStream(XWiki.java:605) at com.xpn.xwiki.cache.impl.OSCacheService.loadProps(OSCacheService.java:179) at com.xpn.xwiki.cache.impl.OSCacheService.init(OSCacheService.java:71) at com.xpn.xwiki.XWiki.getCacheService(XWiki.java:3657) at com.xpn.xwiki.store.XWikiCacheStore.initCache(XWikiCacheStore.java:76) at com.xpn.xwiki.store.XWikiCacheStore.initCache(XWikiCacheStore.java:71) at com.xpn.xwiki.store.XWikiCacheStore.<init>(XWikiCacheStore.java:54) at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:497) at com.xpn.xwiki.XWiki.<init>(XWiki.java:436) at com.xpn.xwiki.XWiki.<init>(XWiki.java:432) at com.xpn.xwiki.tool.backup.Importer.importDocuments(Importer.java:67) at com.xpn.xwiki.tool.backup.ImportMojo.execute(ImportMojo.java:65) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:417) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:488) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:458) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:393) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:182) at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:746) at org.apache.maven.cli.MavenCli.main(MavenCli.java:388) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) 13:42:18,910 ERROR main OSCacheService:loadProps:185 - Could not load cache properties oscache-local.properties java.lang.NullPointerException at com.xpn.xwiki.XWiki.getResourceAsStream(XWiki.java:605) at com.xpn.xwiki.cache.impl.OSCacheService.loadProps(OSCacheService.java:179) at com.xpn.xwiki.cache.impl.OSCacheService.init(OSCacheService.java:72) at com.xpn.xwiki.XWiki.getCacheService(XWiki.java:3657) at com.xpn.xwiki.store.XWikiCacheStore.initCache(XWikiCacheStore.java:76) at com.xpn.xwiki.store.XWikiCacheStore.initCache(XWikiCacheStore.java:71) at com.xpn.xwiki.store.XWikiCacheStore.<init>(XWikiCacheStore.java:54) at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:497) at com.xpn.xwiki.XWiki.<init>(XWiki.java:436) at com.xpn.xwiki.XWiki.<init>(XWiki.java:432) at com.xpn.xwiki.tool.backup.Importer.importDocuments(Importer.java:67) at com.xpn.xwiki.tool.backup.ImportMojo.execute(ImportMojo.java:65) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:417) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:488) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:458) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:393) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:182) at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:746) at org.apache.maven.cli.MavenCli.main(MavenCli.java:388) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
There should be a better error message!