* Remove unnecessary code from executeCronJobs().

* Log errors for session logout and timeout parsing.
* Some minor code cleanups as advised by Intellij.
This commit is contained in:
hns 2006-02-06 13:57:29 +00:00
parent afcef645b9
commit c06106ec8d

View file

@ -990,13 +990,13 @@ public final class Application implements IPathElement, Runnable {
return null; return null;
} }
INode unode = null; INode unode;
try { try {
INode users = getUserRoot(); INode users = getUserRoot();
// check if a user with this name is already registered
unode = (INode) users.getChildElement(uname); unode = (INode) users.getChildElement(uname);
if (unode != null) { if (unode != null) {
return null; return null;
} }
@ -1107,7 +1107,7 @@ public final class Application implements IPathElement, Runnable {
return b.toString(); return b.toString();
} }
private final void composeHref(Object elem, StringBuffer b, int pathCount) private void composeHref(Object elem, StringBuffer b, int pathCount)
throws UnsupportedEncodingException { throws UnsupportedEncodingException {
if ((elem == null) || (pathCount > 50)) { if ((elem == null) || (pathCount > 50)) {
return; return;
@ -1314,7 +1314,7 @@ public final class Application implements IPathElement, Runnable {
} }
// check interfaces, too // check interfaces, too
Class[] classes = obj.getClass().getInterfaces(); Class[] classes = obj.getClass().getInterfaces();
for (int i = 0; i < classes.length && protoname == null; i++) { for (int i = 0; i < classes.length; i++) {
protoname = classMapping.getProperty(classes[i].getName()); protoname = classMapping.getProperty(classes[i].getName());
if (protoname != null) { if (protoname != null) {
// cache the class name for the object so we run faster next time // cache the class name for the object so we run faster next time
@ -1538,7 +1538,8 @@ public final class Application implements IPathElement, Runnable {
sessionTimeout = Math.max(0, sessionTimeout = Math.max(0,
Integer.parseInt(props.getProperty("sessionTimeout", Integer.parseInt(props.getProperty("sessionTimeout",
"30"))); "30")));
} catch (Exception ignore) { } catch (NumberFormatException nfe) {
logEvent("Invalid sessionTimeout setting: " + props.getProperty("sessionTimeout"));
} }
RequestEvaluator thisEvaluator = null; RequestEvaluator thisEvaluator = null;
@ -1561,7 +1562,9 @@ public final class Application implements IPathElement, Runnable {
Object[] param = {session.getSessionId()}; Object[] param = {session.getSessionId()};
thisEvaluator.invokeInternal(userhandle, "onLogout", param); thisEvaluator.invokeInternal(userhandle, "onLogout", param);
} catch (Exception ignore) { } catch (Exception x) {
// errors should already be logged by requestevaluator, but you never know
logError("Error in onLogout", x);
} }
} }
@ -1589,17 +1592,8 @@ public final class Application implements IPathElement, Runnable {
*/ */
private void executeCronJobs() { private void executeCronJobs() {
// loop-local cron job data // loop-local cron job data
List cronJobs = null; List jobs = CronJob.parse(props);
long lastCronParse = 0;
if ((cronJobs == null) || (props.lastModified() > lastCronParse)) {
updateProperties();
cronJobs = CronJob.parse(props);
lastCronParse = props.lastModified();
}
Date date = new Date(); Date date = new Date();
List jobs = new ArrayList(cronJobs);
jobs.addAll(customCronJobs.values()); jobs.addAll(customCronJobs.values());
CronJob.sort(jobs); CronJob.sort(jobs);