rleland 2002/12/07 22:04:42 Modified: src/example/org/apache/struts/webapp/example ExpiredPasswordException.java LogonAction.java src/share/org/apache/struts/action ExceptionHandler.java src/share/org/apache/struts/util AppException.java Added: src/share/org/apache/struts/util ModuleException.java Log: deprecate AppException and use ModuleException instead. Revision Changes Path 1.2 +5 -5 jakarta-struts/src/example/org/apache/struts/webapp/example/ExpiredPasswordException.java Index: ExpiredPasswordException.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/example/org/apache/struts/webapp/example/ExpiredPasswordException.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ExpiredPasswordException.java 31 Dec 2001 01:14:36 -0000 1.1 +++ ExpiredPasswordException.java 8 Dec 2002 06:04:42 -0000 1.2 @@ -62,7 +62,7 @@ package org.apache.struts.webapp.example; -import org.apache.struts.util.AppException; +import org.apache.struts.util.ModuleException; /** * Example of an application-specific exception for which a handler @@ -70,7 +70,7 @@ */ -public class ExpiredPasswordException extends AppException { +public class ExpiredPasswordException extends ModuleException { /** 1.12 +8 -8 jakarta-struts/src/example/org/apache/struts/webapp/example/LogonAction.java Index: LogonAction.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/example/org/apache/struts/webapp/example/LogonAction.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- LogonAction.java 12 Nov 2002 03:53:31 -0000 1.11 +++ LogonAction.java 8 Dec 2002 06:04:42 -0000 1.12 @@ -75,7 +75,7 @@ import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; -import org.apache.struts.util.AppException; +import org.apache.struts.util.ModuleException; import org.apache.struts.util.MessageResources; import org.apache.commons.beanutils.PropertyUtils; @@ -111,7 +111,7 @@ * already been completed. * * @param mapping The ActionMapping used to select this instance - * @param actionForm The optional ActionForm bean for this request (if any) + * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * @@ -186,10 +186,10 @@ * @param database Database in which to look up the user * @param username Username specified on the logon form * - * @exception AppException if a business logic rule is violated + * @exception ModuleException if a business logic rule is violated */ public User getUser(UserDatabase database, String username) - throws AppException { + throws ModuleException { // Force an ArithmeticException which can be handled explicitly if ("arithmetic".equals(username)) { 1.11 +4 -4 jakarta-struts/src/share/org/apache/struts/action/ExceptionHandler.java Index: ExceptionHandler.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ExceptionHandler.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- ExceptionHandler.java 12 Nov 2002 03:56:08 -0000 1.10 +++ ExceptionHandler.java 8 Dec 2002 06:04:42 -0000 1.11 @@ -60,7 +60,7 @@ import org.apache.struts.Globals; import org.apache.struts.config.ExceptionConfig; -import org.apache.struts.util.AppException; +import org.apache.struts.util.ModuleException; /** * An ExceptionHandler is configured in the Struts configuration file to handle a specific @@ -111,9 +111,9 @@ forward = new ActionForward(path); // Figure out the error - if (ex instanceof AppException) { - error = ((AppException) ex).getError(); - property = ((AppException) ex).getProperty(); + if (ex instanceof ModuleException) { + error = ((ModuleException) ex).getError(); + property = ((ModuleException) ex).getProperty(); } else { error = new ActionError(ae.getKey()); property = error.getKey(); 1.6 +17 -47 jakarta-struts/src/share/org/apache/struts/util/AppException.java Index: AppException.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/AppException.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- AppException.java 8 Nov 2002 19:38:12 -0000 1.5 +++ AppException.java 8 Dec 2002 06:04:42 -0000 1.6 @@ -54,49 +54,45 @@ */ package org.apache.struts.util; -import org.apache.struts.action.ActionError; +/** + * @deprecated use {@link ModuleException} + */ +public class AppException extends ModuleException { -public class AppException extends Exception { - protected String property = null; - protected ActionError error = null; - - // ----------------------------------------------------------- Constructors + // ----------------------------------------------------------- Constructors /** - * Construct an application module exception with no replacement values. + * Construct an module exception with no replacement values. * * @param key Message key for this error message */ public AppException(String key) { super(key); - error = new ActionError(key); } /** - * Construct an application module exception with the specified replacement values. + * Construct an module exception with the specified replacement values. * * @param key Message key for this error message * @param value First replacement value */ public AppException(String key, Object value) { - super(key); - error = new ActionError(key, value); + super(key,value); } - + /** - * Construct an application module exception with the specified replacement values. + * Construct an module exception with the specified replacement values. * * @param key Message key for this error message * @param value0 First replacement value * @param value1 Second replacement value */ public AppException(String key, Object value0, Object value1) { - super(key); - error = new ActionError(key, value0, value1); + super(key,value0,value1); } /** - * Construct an application module exception with the specified replacement values. + * Construct an module exception with the specified replacement values. * * @param key Message key for this error message * @param value0 First replacement value @@ -104,12 +100,11 @@ * @param value2 Third replacement value */ public AppException(String key, Object value0, Object value1, Object value2) { - super(key); - error = new ActionError(key, value0, value1, value2); + super(key, value0, value1, value2); } /** - * Construct an application module exception with the specified replacement values. + * Construct an module exception with the specified replacement values. * * @param key Message key for this error message * @param value0 First replacement value @@ -118,10 +113,9 @@ * @param value3 Fourth replacement value */ public AppException(String key, Object value0, Object value1, Object value2, Object value3) { - super(key); - error = new ActionError(key, value0, value1, value2, value3); + super(key, value0, value1, value2, value3); } - + /** * Construct an action error with the specified replacement values. * @@ -129,32 +123,8 @@ * @param values Array of replacement values */ public AppException(String key, Object[] values) { - error = new ActionError(key, values); - } - - // -------------------------------------------------------- Public Methods - - /** - * Returns the property associated with the exception. - * @return Value of property. - */ - public String getProperty() { - return (property != null) ? property : error.getKey(); + super(key,values); } - /** - * Set the property associated with the exception. - * It can be a name of the edit field, which 'caused' the exception. - */ - public void setProperty(String property) { - this.property = property; - } - /** - * Returns the error associated with the exception. - * @return Value of property error. - */ - public ActionError getError() { - return error; - } } 1.1 jakarta-struts/src/share/org/apache/struts/util/ModuleException.java Index: ModuleException.java =================================================================== /* * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ package org.apache.struts.util; import org.apache.struts.action.ActionError; /** * Used for specialized exception handling. */ public class ModuleException extends Exception { protected String property = null; protected ActionError error = null; /** * Construct an module exception with no replacement values. * * @param key Message key for this error message */ public ModuleException(String key) { super(key); error = new ActionError(key); } /** * Construct an module exception with the specified replacement values. * * @param key Message key for this error message * @param value First replacement value */ public ModuleException(String key, Object value) { super(key); error = new ActionError(key, value); } /** * Construct an module exception with the specified replacement values. * * @param key Message key for this error message * @param value0 First replacement value * @param value1 Second replacement value */ public ModuleException(String key, Object value0, Object value1) { super(key); error = new ActionError(key, value0, value1); } /** * Construct an module exception with the specified replacement values. * * @param key Message key for this error message * @param value0 First replacement value * @param value1 Second replacement value * @param value2 Third replacement value */ public ModuleException(String key, Object value0, Object value1, Object value2) { super(key); error = new ActionError(key, value0, value1, value2); } /** * Construct an module exception with the specified replacement values. * * @param key Message key for this error message * @param value0 First replacement value * @param value1 Second replacement value * @param value2 Third replacement value * @param value3 Fourth replacement value */ public ModuleException(String key, Object value0, Object value1, Object value2, Object value3) { super(key); error = new ActionError(key, value0, value1, value2, value3); } /** * Construct an action error with the specified replacement values. * * @param key Message key for this message * @param values Array of replacement values */ public ModuleException(String key, Object[] values) { error = new ActionError(key, values); } // -------------------------------------------------------- Public Methods /** * Returns the property associated with the exception. * @return Value of property. */ public String getProperty() { return (property != null) ? property : error.getKey(); } /** * Set the property associated with the exception. * It can be a name of the edit field, which 'caused' the exception. */ public void setProperty(String property) { this.property = property; } /** * Returns the error associated with the exception. * @return Value of property error. */ public ActionError getError() { return error; } }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>