From 8f684b6ec9d337d8fa5e4064ada7ec12af1350de Mon Sep 17 00:00:00 2001 From: hns Date: Wed, 30 Oct 2002 17:45:38 +0000 Subject: [PATCH] Consult the macro handler map in the response object rather than the request path when resolving macro handler names. By default the new handler map contains the objects from the request path, but it lets the developer add or remove handlers. Improved the way macros are displayed and logged. --- src/helma/framework/core/Skin.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/helma/framework/core/Skin.java b/src/helma/framework/core/Skin.java index 27596416..b4735d1e 100644 --- a/src/helma/framework/core/Skin.java +++ b/src/helma/framework/core/Skin.java @@ -340,14 +340,15 @@ public final class Skin { if (handlerObject == null) { // eiter because thisObject == null or the right object wasn't found in the object's parent path // go check request path for an object with matching prototype - int l = reval.requestPath.size(); + /* int l = reval.requestPath.size(); for (int i=l-1; i>=0; i--) { Object pathelem = reval.requestPath.get (i); if (handler.equals (app.getPrototypeName (pathelem))) { handlerObject = pathelem; break; } - } + } */ + handlerObject = reval.res.getMacroHandlers().get (handler); } // the macro handler object couldn't be found @@ -417,8 +418,11 @@ public final class Skin { } catch (TimeoutException timeout) { throw timeout; } catch (Exception x) { - x.printStackTrace(); - String msg = "[HopMacro error in "+getFullName()+": "+x+"]"; + // x.printStackTrace(); + String msg = x.getMessage(); + if (msg == null || msg.length() < 10) + msg = x.toString(); + msg = "[HopMacro error in "+getFullName()+": "+msg+"]"; reval.res.write (" "+msg+" "); app.logEvent (msg); }