]
Brian Leathem resolved RF-12571.
--------------------------------
Resolution: Rejected
JSF Error handling should be implemented on the server side. The {f/a4j}:ajax _onerror_
attribute is meant to handle errors with the http communication, not JSF errors.
aj4:status - onerror - more documentation - more attributes ?
-------------------------------------------------------------
Key: RF-12571
URL:
https://issues.jboss.org/browse/RF-12571
Project: RichFaces
Issue Type: Feature Request
Security Level: Public(Everyone can see)
Reporter: Jean ANDRE
The documentation on aj4:status does not explain very well what we should expected as
data to be passed or retrieved when error occurred. Could you please, post here and also
at the documentation, some clues, details, information, valuable examples, live demos...
to help us managing error on ajax request. Thank you very much.
{code}
<a4j:status id="ajax-status"
name="ajaxStatus"
onstart="#{rich:component('messageWaiter')}.show()"
onstop="#{rich:component('messageWaiter')}.hide()"
onerror="alert(event.type);alert(status);" />
{code}
Based on above code, it seems we can catch at least one object - the event but the event
does not seem to have any valuable information.
It is possible to sent us some valuable information when we received the onerror event
from ajax call and tell us what we can use as information to be displayed to user.
Some old versions?, seems to have 3 attributes like req, status, message on event error
but with RichFaces 4.2.3 final, what we can have, have as alternative or do ?
from
https://community.jboss.org/message/54813
{code}
A4J.AJAX.onError = function(req, status, message){
if(status == 505 || status == 500 || status == 400){
window.alert("Error: "+message + "\n Please contact administrator"
);
}
}
{code}
For example, in this situation, I emulated an error into the controller, which is a NPE
{code}
public String doOpenItem(String tabId, Integer itemId) throws InterruptedException {
Thread.currentThread().join(2000);
Integer i = null;
i.doubleValue();
return "thepage";
}
{code}
The error is trigger from a simple commandLink
{code}
<a4j:commandLink id="openCmd"
action="#{listItemController.doOpenItem(tab.id, item.id)}"
render="desktopTabs"
value="#{msg['common.command.open']}"
status="ajaxStatus" />
{code}
{code}
<!-- -->
<!-- WAITER MESSAGE -->
<!-- -->
<rich:popupPanel id="messageWaiter"
modal="false"
style="border:1px solid red;"
autosized="true"
resizeable="false"
shadowDepth="3"
shadowOpacity="1"
top="250">
Please wait...
</rich:popupPanel>
{code}
When we got when the response returns back to the request sent, when the error is
triggered (from the NPE at the controller side).
Under firebug:
{code}
<?xml version='1.0' encoding='UTF-8'?>
<partial-response><error><error-name>class
javax.faces.el.EvaluationException</error-name><error-message><![CDATA[]]></error-message></error></partial-response>
{code}
But the log file of the application is more explicit:
{code}
java.lang.NullPointerException
at com.nested.web.controller.ListItemController.doOpenItem(ListItemController.java:40)
at
com.nested.web.controller.ListItemController$Proxy$_$$_WeldClientProxy.doOpenItem(ListItemController$Proxy$_$$_WeldClientProxy.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.el.BeanELResolver.invokeMethod(BeanELResolver.java:779)
at javax.el.BeanELResolver.invoke(BeanELResolver.java:528)
at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:257)
at com.sun.el.parser.AstValue.invoke(AstValue.java:248)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:302)
at
org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:39)
at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
at
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at
org.richfaces.component.RowKeyContextEventWrapper.broadcast(RowKeyContextEventWrapper.java:104)
at org.richfaces.component.UIDataAdaptor.broadcast(UIDataAdaptor.java:448)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
at
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at
com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:662)
{code}
Is it possible to retrieve all necessary material to be reported to the user or technical
team ?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: