Announcement Announcement Module
No announcement yet.
Bug? UndeclaredThrowableException for checked exceptions Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bug? UndeclaredThrowableException for checked exceptions


    I am using 1.0.0.RC1, and when my (flex-remoting) Java service bean throws a checked exception, then this causes an UndeclaredThrowableException to be transmitted to the client.

    If I change that exception to be a subclass of RuntimeException, this does not happen.

    I have tried doing some debugging, but do get lost in AOP generated code quickly.

    Anybody having had a similar experience? Happy to provide more details, just tell me what you want.

  • #2
    This might help...

    Up to Milestone 2, Java exceptions were translated automatically, now we apparently have to do some work ourselves.

    Create a class, like this:

    package xxx;
    import org.springframework.flex.core.ExceptionTranslator;
    import org.springframework.util.ClassUtils;
    import flex.messaging.MessageException;
    public class MyExceptionTranslator implements ExceptionTranslator {
    public boolean handles(Class<?> clazz) {
      return !(ClassUtils.isAssignable(AuthenticationException.class, clazz) || 
        ClassUtils.isAssignable(AccessDeniedException.class, clazz));
      public MessageException translate(Throwable t) {
        MessageException ex = new MessageException();
        return ex;
    AuthenticationException and AccessDeniedException are not handled, since the framework takes care of them.

    And now declare your exception translator, thus:

    <bean id="myExceptionTranslator" class="xxx.MyExceptionTranslator"/>
      <flex:exception-translator ref="myExceptionTranslator"/>


    • #3
      This is not logical!

      I got the same problem when I upgraded from M2 to the current release. Before I could throw an exception from Java and then get its variables easily through FaultEvent.fault.rootCause, but now I have to implement the fix given by 'ARAsoft'. This seems odd. There must surely be a better solution? It can't go from easy and logical to the opposite.

      I hope someone with the necessary technical skills can bring clarity to this strange issue.


      • #4
        Ahh, I see. Yes, this is not the intended behavior. The ExceptionTranslator is really meant for cases where the exception thrown by BlazeDS isn't very helpful and you want to augment the result with more information. (We use this mechanism internally, for example, to do better translation of security failures.) I think I see how it can be fixed. Would you mind opening a Jira for this? We should be able to take care of it in 1.0.1.


        • #5


          • #6
            Great, thanks for that. I've committed a potential fix. Please try the snapshot build at (or later) to verify that things now work the way you're expecting.


            • #7
              I have tested this new version briefly and it seems like the behavior now equals the M2 release. Thanks for fixing this very quickly.