0 Replies Latest reply on Mar 26, 2010 8:40 PM by Rafael Ribeiro

    org.jboss.seam.util.Reflections should rethrow InvocationTargetException.getTargetException

    Rafael Ribeiro Novice

      Seam class org.jboss.seam.util.Reflections that seems to be used during some backing bean action method call is trying to rethrow InvocationTargetException.getCause which seems to be always null instead of InvocationTargetException.getTargetException.
      This leads to the following (fragment) of stacktrace (I guess when the action throws an uncatched RuntimeException):


      Caused by java.lang.reflect.InvocationTargetException with message: ""



      I checked the newest tag org.jboss.seam.util.Reflections and it still rethrows the getCause:


      catch (InvocationTargetException ite)
            {
               if ( ite.getCause() instanceof Exception )
               {
                  throw (Exception) ite.getCause();
               }
               else
               {
                  throw ite;
               }
            }
      



      I sincerely think that instead of the code above it should be:


      catch (InvocationTargetException ite)
            {
               if ( ite.getCause() instanceof Exception )
               {
                  throw (Exception) ite.getTargetException();
               }
               else
               {
                  throw ite;
               }
            }
      



      As I've confirmed while debugging that targetException had the IncompatibleClassChangeException that I should be getting on error page.


      regards,
      Rafael Ribeiro