0

We are currently using the OmniFaces FullAjaxExceptionHandlerFactory to redirect any exceptions in the application to a general error page. This page then examines the exception and determines its type so that we can display a particular (and hopefully more helpful) message for certain known error cases.

However, under certain circumstances all we get is a PropertyNotFoundException with no attached causes or details instead of the actual exception that the program throws. This thwarts my attempt to recognize known error cases.

I figured out the circumstances under which this happens: I wrote a composite component that encapsulates an h:commandLink. To pass in the action method I used retargeting like so:

<cc:attribute name="action" targets="link"  required="true" />

and, accordingly,

<h:commandLink id="link" value="test" />

This works fine, but as said above: If the action stumbles upon an exception during execution, this original exception will not be handed to the error page. Only a PropertyNotFoundException shows up and tells me, the action method could not be found - without any info about the actual problem.

I tried to pass in the method in a different way, for example as

<cc:attribute name="bean"   required="true" />
<cc:attribute name="method" required="true" />
<cc:attribute name="param" />

and

<h:commandLink  id="link"
                value="test"
                action="#{cc.attrs.bean[cc.attrs.method](cc.attrs.param)}" />

In this case I get the right exceptions handed over, but the method fails for cases where the using page does not pass a param. A method like doSomething() will then not be found (IllegalArgumentException). However, I'd rather like to use one component throughout the application with or without parameters instead of forcing some workaround here for the different usages.

Are there other ways to avoid the retargeting approach or can we change something, so that a retargeted method does not result in the unhelpful PropertyNotFoundExecption?

EDIT: If possible, I'd prefer the retargeting, as it's less of an limitation to the use of the component. The above alternative for example would only allow for actions with one parameter. :/

Louise
  • 1,451
  • 1
  • 18
  • 40
  • Deja vu. I've ever reported this as https://java.net/jira/browse/JAVASERVERFACES-1806 which was told to be fixed in 2.1.10. However, this seems not true, given https://java.net/jira/browse/JAVASERVERFACES-2758 Which Mojarra version are you using? – BalusC May 30 '13 at 17:01
  • Regarding the reported issues: The second one reports a wrong warning in the logs, which was introduced when fixing the first issue. As long as the right exception gets thrown, I'm OK with wrong warnings. I'll check out which Mojarra we're on and see what can be done. – Louise May 31 '13 at 07:05
  • Just saw [this other question](http://stackoverflow.com/q/3487489/840977) - weird it didn't come up in my search yesterday. Anyhow, mine might be closed as a duplicate then. I tried around with my second approach, but I didn't get it to work without a unpleasant amount of code duplication and inflexibility, so I don't think this question needs to remain open. – Louise May 31 '13 at 07:19

1 Answers1

0

As per comments, this is a known Mojarra issue. We upgraded to Mojarra 2.1.21 and I can confirm that the issue is fixed in this version and exceptions end up in the interface pure and unaltered as the code intended ;)

Thanks for the help!

Louise
  • 1,451
  • 1
  • 18
  • 40