From 230469d5447c1d68a8571e915b7fc0d61ea24630 Mon Sep 17 00:00:00 2001 From: hns Date: Wed, 28 Nov 2007 15:14:02 +0000 Subject: [PATCH] * Rename FrameworkException to NotFoundException in order to reflect actual usage/semantics. --- src/helma/framework/NotFoundException.java | 43 +++++++++++++++++++ .../framework/core/RequestEvaluator.java | 18 ++++---- 2 files changed, 52 insertions(+), 9 deletions(-) create mode 100644 src/helma/framework/NotFoundException.java diff --git a/src/helma/framework/NotFoundException.java b/src/helma/framework/NotFoundException.java new file mode 100644 index 00000000..b9e78207 --- /dev/null +++ b/src/helma/framework/NotFoundException.java @@ -0,0 +1,43 @@ +/* + * Helma License Notice + * + * The contents of this file are subject to the Helma License + * Version 2.0 (the "License"). You may not use this file except in + * compliance with the License. A copy of the License is available at + * http://adele.helma.org/download/helma/license.txt + * + * Copyright 1998-2003 Helma Software. All Rights Reserved. + * + * $RCSfile$ + * $Author$ + * $Revision$ + * $Date$ + */ + +package helma.framework; + + +/** + * The basic exception class used to tell when certain things go + * wrong in evaluation of requests. + */ +public class NotFoundException extends RuntimeException { + /** + * Creates a new NotFoundException object. + * + * @param message ... + */ + public NotFoundException(String message) { + super(message); + } + + /** + * Creates a new NotFoundException object with a cause. + * + * @param message the message + * @param cause the cause + */ + public NotFoundException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/src/helma/framework/core/RequestEvaluator.java b/src/helma/framework/core/RequestEvaluator.java index 932fa3ea..91f3f0d7 100644 --- a/src/helma/framework/core/RequestEvaluator.java +++ b/src/helma/framework/core/RequestEvaluator.java @@ -239,7 +239,7 @@ public final class RequestEvaluator implements Runnable { action = getAction(currentElement, null, req); if (action == null) { - throw new FrameworkException("Action not found"); + throw new NotFoundException("Action not found"); } } else { // march down request path... @@ -262,7 +262,7 @@ public final class RequestEvaluator implements Runnable { for (int i = 0; i < ntokens; i++) { if (currentElement == null) { - throw new FrameworkException("Object not found."); + throw new NotFoundException("Object not found."); } if (pathItems[i].length() == 0) { @@ -288,7 +288,7 @@ public final class RequestEvaluator implements Runnable { } if (currentElement == null) { - throw new FrameworkException("Object not found."); + throw new NotFoundException("Object not found."); } if (action == null) { @@ -296,10 +296,10 @@ public final class RequestEvaluator implements Runnable { } if (action == null) { - throw new FrameworkException("Action not found"); + throw new NotFoundException("Action not found"); } } - } catch (FrameworkException notfound) { + } catch (NotFoundException notfound) { if (error != null) { // we already have an error and the error template wasn't found, @@ -318,7 +318,7 @@ public final class RequestEvaluator implements Runnable { action = getAction(currentElement, notFoundAction, req); if (action == null) { - throw new FrameworkException(notfound.getMessage()); + throw new NotFoundException(notfound.getMessage()); } } @@ -432,7 +432,7 @@ public final class RequestEvaluator implements Runnable { } if (currentElement == null) { - throw new FrameworkException("Method name \"" + + throw new NotFoundException("Method name \"" + function + "\" could not be resolved."); } @@ -448,7 +448,7 @@ public final class RequestEvaluator implements Runnable { // reset skin recursion detection counter skinDepth = 0; if (!scriptingEngine.hasFunction(currentElement, functionName, false)) { - throw new FrameworkException(missingFunctionMessage(currentElement, functionName)); + throw new NotFoundException(missingFunctionMessage(currentElement, functionName)); } result = scriptingEngine.invoke(currentElement, functionName, args, @@ -580,7 +580,7 @@ public final class RequestEvaluator implements Runnable { // check if we tried to process the error already, // or if this is an XML-RPC request if (error == null) { - if (!(x instanceof FrameworkException)) { + if (!(x instanceof NotFoundException)) { app.errorCount += 1; }