Avoid NPE.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2712 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
samskivert
2010-02-09 20:13:01 +00:00
parent 3a0f8e3fc2
commit 09d98be8d7
2 changed files with 5 additions and 4 deletions
@@ -37,7 +37,6 @@ public class ServletContextResourceManager extends ResourceManagerImpl
throws Exception
{
super.initialize(rsvc);
rsvc.getLog().info("SCRM initializing.");
// the web framework was kind enough to slip this into the runtime when it started up
Application app = (Application)rsvc.getApplicationAttribute(Application.VELOCITY_ATTR_KEY);
@@ -45,7 +44,9 @@ public class ServletContextResourceManager extends ResourceManagerImpl
rsvc.getLog().warn("SCRM: No application was initialized. A user of the " +
"servlet context resource manager must ensure that " +
"an application is instantiated and initialized.");
return;
}
rsvc.getLog().info("SCRM initializing.");
// create our resource loader
_contextLoader = new ServletContextResourceLoader(app.getServletContext());
@@ -46,16 +46,16 @@ public class SiteResourceManager extends ResourceManagerImpl
throws Exception
{
super.initialize(rsvc);
Log.log.info("SiteResourceManager initializing.");
// the web framework was kind enough to slip this into the runtime when it started up
Application app = (Application)rsvc.getApplicationAttribute(
Application.VELOCITY_ATTR_KEY);
Application app = (Application)rsvc.getApplicationAttribute(Application.VELOCITY_ATTR_KEY);
if (app == null) {
Log.log.warning("SiteResourceManager: No application was initialized. " +
"A user of the site resource manager must ensure that " +
"an application is instantiated and initialized.");
return;
}
Log.log.info("SiteResourceManager initializing.");
// get handles on the good stuff
_sctx = app.getServletContext();