DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9529>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9529

default ExceptionHandler doesn't perform parameter substitution in the ActionError it 
generates when handling AppException instances

           Summary: default ExceptionHandler doesn't perform parameter
                    substitution in the ActionError it generates when
                    handling AppException instances
           Product: Struts
           Version: 1.1 Beta 1
          Platform: PC
        OS/Version: Windows NT/2K
            Status: UNCONFIRMED
          Severity: Minor
          Priority: Other
         Component: Controller
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Summary:
When the execute method of a RequestProcessor throws an AppException, the 
ActionError generated by the default exception handler doesn't perform any parameter 
substitution for the ActionError's message, even if the AppException contains 
parameter-
substitution values.

Details:
When the execute() method of a RequestProcessor subclass 
throws an exception, the default exception handler (an instance of 
org.apache.struts.ExceptionHandler) creates an ActionError containing some message 
intended for display to the user.  Currently, the code in ExceptionHandler.execute() 
creates an 
ActionError instance using the one-argument ActionError constructor, which doesn't 
support 
parameter substitution in the resulting message.  While this works well for the 
general case, 
where the Exception subclass doesn't provide any values intended for use in such 
substitution, 
AppException explicitly provides support for substituting up to 4 values into an 
associated 
ActionError message.

Proposed solution:
In ExceptionHandler.execute(), there's 
already an if statement that builds the ActionError differently based on whether or 
not the 
Exception instance is an AppException; change that clause to use the 
AppException.getError() 
method which returns a correctly constructed/substituted ActionError instance, instead 
of 
creating a new one.

In ExceptionHandler.java, change
<code>
    if (ex instanceof 
AppException) {
        error = new ActionError(ae.getKey());
        property = ((AppException) 
ex).getProperty();
    } else {
        error = new ActionError(ae.getKey());
        property = 
error.getKey();
    }
</code>

to 

<code>
    if (ex instanceof AppException) {
        error = 
((AppException) ex).getError();
        property = ((AppException) ex).getProperty();
    } else 
{
        error = new ActionError(ae.getKey());
        property = error.getKey();
    
}
</code>


Note: This should also fix the more specific bug submitted as #7393

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to