Nevermind, I should have known - ActionErrors vs. ActionMessages.
Changing this:
ActionErrors errors =
(ActionMessages) request.getAttribute(Globals.ERROR_KEY);
if (errors == null) {
errors = new ActionErrors();
}
To this:
ActionMessages errors =
(ActionMessages) request.getAttribute(Globals.ERROR_KEY);
if (errors == null) {
errors = new ActionMessages();
}
Fixed the problem. Since there were no deprecation warnings - I figured
it should work the same. Silly me.
Matt
> -----Original Message-----
> From: Matt Raible [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 09, 2003 2:33 PM
> To: 'Struts Developers List'
> Subject: RE: ActionExceptionHandler doesn't work with Nightly
> Build (does with 1.1)
>
>
> The strange part about this whole thing is that my logs looks
> the same, but the UI doesn't forward to the inputForward like
> it used to.
>
> Matt
>
> > -----Original Message-----
> > From: Matt Raible [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, December 09, 2003 9:50 AM
> > To: [EMAIL PROTECTED]
> > Subject: ActionExceptionHandler doesn't work with Nightly
> > Build (does with 1.1)
> >
> >
> > I have an ActionExceptionHandler (see code below) that works
> > fine with Struts 1.1, but bombs with a nightly build (Nov.
> > 20th). With Struts 1.1, I get an error on on my input page
> > that reads:
> >
> > The process did not complete. Details should follow.
> > No row with the given identifier exists: 3, of class:
> > org.appfuse.persistence.Resume
> >
> > With the nightly build I get:
> >
> > The process did not complete. Details should follow.
> >
> > javax.servlet.ServletException
> > at
> > org.apache.struts.action.RequestProcessor.processException(Req
> > uestProces
> > sor.java:552)
> > at
> > org.apache.struts.action.RequestProcessor.processActionPerform
> > (RequestPr
> > ocessor.java:451)
> > at
> > org.apache.struts.action.RequestProcessor.process(RequestProce
> > ssor.java:
> > 264)
> > at
> > org.apache.struts.action.ActionServlet.process(ActionServlet.j
> > ava:1176)
> > at
> > org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:454)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
> > er(Applica
> > tionFilterChain.java:247)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
> > cationFilt
> > erChain.java:193)
> > at
> >
> org.appfuse.webapp.filter.ActionFilter.doFilter(ActionFilter.java:178)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
> > er(Applica
> > tionFilterChain.java:213)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
> > cationFilt
> > erChain.java:193)
> > at
> > org.appfuse.webapp.filter.CompressionFilter.doFilter(Compressi
> > onFilter.j
> > ava:80)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
> > er(Applica
> > tionFilterChain.java:213)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
> > cationFilt
> > erChain.java:193)
> > at
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
> > rapperValv
> > e.java:256)
> > at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValv
> > eContext.i
> > nvokeNext(StandardPipeline.java:643)
> > at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> > ine.java:4
> > 80)
> > at
> >
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> > at
> > org.apache.catalina.core.StandardContextValve.invoke(StandardC
> > ontextValv
> > e.java:191)
> > at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValv
> > eContext.i
> > nvokeNext(StandardPipeline.java:643)
> > at
> > org.apache.catalina.authenticator.AuthenticatorBase.invoke(Aut
> > henticator
> > Base.java:553)
> > at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValv
> > eContext.i
> > nvokeNext(StandardPipeline.java:641)
> > at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> > ine.java:4
> > 80)
> > at
> >
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> > at
> > org.apache.catalina.core.StandardContext.invoke(StandardContex
> > t.java:241
> > 7)
> > at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHost
> > Valve.java
> > :180)
> > at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValv
> > eContext.i
> > nvokeNext(StandardPipeline.java:643)
> > at
> > org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDi
> > spatcherVa
> > lve.java:171)
> > at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValv
> > eContext.i
> > nvokeNext(StandardPipeline.java:641)
> > at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReport
> > Valve.java
> > :172)
> > at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValv
> > eContext.i
> > nvokeNext(StandardPipeline.java:641)
> > at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> > ine.java:4
> > 80)
> > at
> >
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> > at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
> > gineValve.
> > java:174)
> > at
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValv
> > eContext.i
> > nvokeNext(StandardPipeline.java:643)
> > at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> > ine.java:4
> > 80)
> > at
> >
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> > at
> > org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.
> > java:193)
> > at
> > org.apache.coyote.http11.Http11Processor.process(Http11Process
> > or.java:78
> > 1)
> > at
> > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandle
> > r.processC
> > onnection(Http11Protocol.java:549)
> > at
> > org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoi
> > nt.java:58
> > 9)
> > at
> > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> > ThreadPool
> > .java:666)
> > at java.lang.Thread.run(Thread.java:534)
> >
> >
> > Here is the code for my ActionExceptionHandler which is mapped as
> > follows:
> >
> > <exception type="java.lang.Exception"
> > key="errors.general"
> >
> > handler="org.appfuse.webapp.action.ActionExceptionHandler"/>
> >
> >
> > public final class ActionExceptionHandler extends ExceptionHandler {
> > private Log log =
> LogFactory.getLog(ActionExceptionHandler.class);
> >
> > /**
> > * This method handles any java.lang.Exceptions that are not
> > * caught in previous classes. It will loop through and get
> > * all the causes (exception chain), create ActionErrors,
> > * add them to the request and then forward to the input.
> > *
> > * @see org.apache.struts.action.ExceptionHandler#execute
> > * (
> > * java.lang.Exception,
> > * org.apache.struts.config.ExceptionConfig,
> > * org.apache.struts.action.ActionMapping,
> > * org.apache.struts.action.ActionForm,
> > * javax.servlet.http.HttpServletRequest,
> > * javax.servlet.http.HttpServletResponse
> > * )
> > */
> > public ActionForward execute(Exception ex, ExceptionConfig ae,
> > ActionMapping mapping,
> > ActionForm formInstance,
> > HttpServletRequest request,
> > HttpServletResponse response)
> > throws ServletException {
> > // if there's already errors in the request, don't process
> > ActionErrors errors =
> > (ActionErrors) request.getAttribute(Globals.ERROR_KEY);
> >
> > if (errors != null) {
> > return null;
> > }
> >
> > ActionForward forward =
> > super.execute(ex, ae, mapping, formInstance,
> > request, response);
> >
> > ActionError error = null;
> > String property = null;
> >
> > // log the exception to the default logger
> > logException(ex);
> > // Get the chained exceptions (causes) and add them to the
> > // list of errors as well
> > while (ex != null) {
> > String msg = ex.getMessage();
> > log.error(msg);
> > error = new ActionError("errors.detail", msg);
> > property = error.getKey();
> > ex = (Exception) ex.getCause();
> >
> > if ((ex != null) && (ex.getMessage() != null)) {
> > // check to see if the child message is the same
> > // if so, don't store it
> > if (msg.indexOf(ex.getMessage()) == -1) {
> > storeException(request, property,
> error, forward);
> > }
> > } else {
> > storeException(request, property, error, forward);
> > }
> > }
> >
> > return forward;
> > }
> >
> > /**
> > * This method overrides the the ExceptionHandler's
> storeException
> > * method in order to create more than one error message.
> > *
> > * @param request - The request we are handling
> > * @param property - The property name to use for this error
> > * @param error - The error generated from the exception mapping
> > * @param forward - The forward generated from the input
> > path (from the form or exception mapping)
> > * @param scope - The scope of the exception mapping.
> > */
> > protected void storeException(HttpServletRequest request,
> > String property,
> ActionError error,
> > ActionForward forward) {
> > ActionErrors errors =
> > (ActionErrors) request.getAttribute(Globals.ERROR_KEY);
> >
> > if (errors == null) {
> > errors = new ActionErrors();
> > }
> >
> > errors.add(property, error);
> >
> > request.setAttribute(Globals.ERROR_KEY, errors);
> > }
> > protected void logException(Exception ex) {
> > StringWriter sw = new StringWriter();
> > ex.printStackTrace(new PrintWriter(sw));
> > log.error(sw.toString());
> > }
> > }
> >
> > Should I try a more recent nightly build?
> >
> > Matt
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]