Author: niallp Date: Sat Nov 5 18:44:59 2005 New Revision: 331060 URL: http://svn.apache.org/viewcvs?rev=331060&view=rev Log: Add new InvalidPathException to the AbstractSelectAction command when an action mapping cannot be found for the specified path. Also update the RequestProcessor error messages.
Added: struts/core/trunk/src/java/org/apache/struts/chain/commands/InvalidPathException.java (with props) Modified: struts/core/trunk/src/java/org/apache/struts/action/ActionResources.properties struts/core/trunk/src/java/org/apache/struts/action/RequestProcessor.java struts/core/trunk/src/java/org/apache/struts/chain/commands/AbstractSelectAction.java Modified: struts/core/trunk/src/java/org/apache/struts/action/ActionResources.properties URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/java/org/apache/struts/action/ActionResources.properties?rev=331060&r1=331059&r2=331060&view=diff ============================================================================== --- struts/core/trunk/src/java/org/apache/struts/action/ActionResources.properties (original) +++ struts/core/trunk/src/java/org/apache/struts/action/ActionResources.properties Sat Nov 5 18:44:59 2005 @@ -20,8 +20,8 @@ mappingType=Must specify one of "forward", "include" or "type" for path {0} notAuthorized=User is not authorized to access action {0} noInput=No input attribute for mapping path {0} -processInvalid=Invalid path {0} was requested -processPath=No process path found in request URI {0} +processInvalid=Invalid path was requested +processPath=No process path found in request URI reloading=Reloading from configuration files requestDispatcher=Cannot get request dispatcher for path {0} sessionCreate=No user session could be created Modified: struts/core/trunk/src/java/org/apache/struts/action/RequestProcessor.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/java/org/apache/struts/action/RequestProcessor.java?rev=331060&r1=331059&r2=331060&view=diff ============================================================================== --- struts/core/trunk/src/java/org/apache/struts/action/RequestProcessor.java (original) +++ struts/core/trunk/src/java/org/apache/struts/action/RequestProcessor.java Sat Nov 5 18:44:59 2005 @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright 2000-2004 The Apache Software Foundation. + * Copyright 2000-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -689,8 +689,8 @@ } // No mapping can be found to process this request - String msg = getInternal().getMessage("processInvalid", path); - log.error(msg); + String msg = getInternal().getMessage("processInvalid"); + log.error(msg + " " + path); response.sendError(HttpServletResponse.SC_NOT_FOUND, msg); return null; @@ -779,10 +779,8 @@ } String prefix = moduleConfig.getPrefix(); if (!path.startsWith(prefix)) { - String msg = getInternal().getMessage( - "processPath", request.getRequestURI()); - - log.error(msg); + String msg = getInternal().getMessage("processPath"); + log.error(msg + " " + request.getRequestURI()); response.sendError(HttpServletResponse.SC_BAD_REQUEST, msg); return null; Modified: struts/core/trunk/src/java/org/apache/struts/chain/commands/AbstractSelectAction.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/java/org/apache/struts/chain/commands/AbstractSelectAction.java?rev=331060&r1=331059&r2=331060&view=diff ============================================================================== --- struts/core/trunk/src/java/org/apache/struts/chain/commands/AbstractSelectAction.java (original) +++ struts/core/trunk/src/java/org/apache/struts/chain/commands/AbstractSelectAction.java Sat Nov 5 18:44:59 2005 @@ -1,5 +1,5 @@ /* - * Copyright 2003,2004 The Apache Software Foundation. + * Copyright 2003-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,8 +71,8 @@ } if (actionConfig == null) { - throw new IllegalArgumentException("No action config for '" + - path + "'"); + throw new InvalidPathException( + "No action config found for the specified url.", path); } actionCtx.setActionConfig(actionConfig); return (false); Added: struts/core/trunk/src/java/org/apache/struts/chain/commands/InvalidPathException.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/java/org/apache/struts/chain/commands/InvalidPathException.java?rev=331060&view=auto ============================================================================== --- struts/core/trunk/src/java/org/apache/struts/chain/commands/InvalidPathException.java (added) +++ struts/core/trunk/src/java/org/apache/struts/chain/commands/InvalidPathException.java Sat Nov 5 18:44:59 2005 @@ -0,0 +1,52 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.struts.chain.commands; + +/** + * <p>Exception thrown when no mapping can be found for the specified path.</p> + * + * @version $Rev$ $Date$ + */ + +public class InvalidPathException extends Exception { + + private String path; + + /** Constructor */ + public InvalidPathException() { + super(); + } + + /** + * Constructor. + * + * @param message The error or warning message. + * @param path The invalid path. + */ + public InvalidPathException(String message, String path) { + super(message); + this.path = path; + } + + /** + * Return the path. + */ + public String getPath() { + return path; + } + +} + Propchange: struts/core/trunk/src/java/org/apache/struts/chain/commands/InvalidPathException.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: struts/core/trunk/src/java/org/apache/struts/chain/commands/InvalidPathException.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]