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=15805>. 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=15805 Enhance ModuleException to allow getting chained Exceptions Summary: Enhance ModuleException to allow getting chained Exceptions Product: Struts Version: Nightly Build Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: Utilities AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] It'd be nice if it was possible to use a ModuleException to get a list of chained exceptions and display them to the user. I don't know how this would work, but using JDK 1.4, it might look something like that below. This doesn't compile, but hopefully you get the idea - or maybe I can already do it with this? public class GeneralException extends ModuleException { //~ Constructors =========================================================== /** * Construct a new instance of this exception */ public GeneralException() { super("errors.general"); } /** * Constructor for this exception that allows you to pass in an exception * with possible causes. * * @param e */ public GeneralException(Exception e) { super("errors.detail", getChainedExceptions(e)); } protected String getChainedExceptions(Exception e) { StringBuffer sb = new StringBuffer(); if (e.getCause() == null) { sb.append(e.getMessage()); } else { while (e.getCause() != null) { sb.append(e.getMessage()); sb.append("\n"); e = (Exception) e.getCause(); } } return sb.toString(); } } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>