Check if Server singleton exists before trying to get the list of extensions from it.

This commit is contained in:
hns 2003-08-18 14:50:18 +00:00
parent c583133234
commit 5c9df59014
2 changed files with 37 additions and 28 deletions

View file

@ -269,6 +269,7 @@ public final class Application implements IPathElement, Runnable {
*/ */
public void init() public void init()
throws DatabaseException, ScriptingException, MalformedURLException { throws DatabaseException, ScriptingException, MalformedURLException {
if (Server.getServer() != null) {
Vector extensions = Server.getServer().getExtensions(); Vector extensions = Server.getServer().getExtensions();
for (int i = 0; i < extensions.size(); i++) { for (int i = 0; i < extensions.size(); i++) {
@ -281,6 +282,7 @@ public final class Application implements IPathElement, Runnable {
e.toString()); e.toString());
} }
} }
}
// read the sessions if wanted // read the sessions if wanted
if ("true".equalsIgnoreCase(getProperty("persistentSessions"))) { if ("true".equalsIgnoreCase(getProperty("persistentSessions"))) {
@ -387,6 +389,7 @@ public final class Application implements IPathElement, Runnable {
typemgr = null; typemgr = null;
// tell the extensions that we're stopped. // tell the extensions that we're stopped.
if (Server.getServer() != null) {
Vector extensions = Server.getServer().getExtensions(); Vector extensions = Server.getServer().getExtensions();
for (int i = 0; i < extensions.size(); i++) { for (int i = 0; i < extensions.size(); i++) {
@ -394,6 +397,7 @@ public final class Application implements IPathElement, Runnable {
ext.applicationStopped(this); ext.applicationStopped(this);
} }
}
// store the sessions if wanted // store the sessions if wanted
if ("true".equalsIgnoreCase(getProperty("persistentSessions"))) { if ("true".equalsIgnoreCase(getProperty("persistentSessions"))) {
@ -1630,6 +1634,7 @@ public final class Application implements IPathElement, Runnable {
} }
// update extensions // update extensions
if (Server.getServer() != null) {
Vector extensions = Server.getServer().getExtensions(); Vector extensions = Server.getServer().getExtensions();
for (int i = 0; i < extensions.size(); i++) { for (int i = 0; i < extensions.size(); i++) {
@ -1638,6 +1643,8 @@ public final class Application implements IPathElement, Runnable {
try { try {
ext.applicationUpdated(this); ext.applicationUpdated(this);
} catch (ConfigurationException e) { } catch (ConfigurationException e) {
logEvent("Error updating extension "+ext+": "+e);
}
} }
} }

View file

@ -92,6 +92,7 @@ public class RhinoEngine implements ScriptingEngine {
// context.putThreadLocal ("engine", this); // context.putThreadLocal ("engine", this);
extensionGlobals = new HashMap(); extensionGlobals = new HashMap();
if (Server.getServer() != null) {
Vector extVec = Server.getServer().getExtensions(); Vector extVec = Server.getServer().getExtensions();
for (int i = 0; i < extVec.size(); i++) { for (int i = 0; i < extVec.size(); i++) {
@ -108,6 +109,7 @@ public class RhinoEngine implements ScriptingEngine {
e.getMessage()); e.getMessage());
} }
} }
}
// context.removeThreadLocal ("reval"); // context.removeThreadLocal ("reval");
// context.removeThreadLocal ("engine"); // context.removeThreadLocal ("engine");