Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2453

Lost cause in DeploymentException

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Minor Minor
    • 3.0.3.Final, 2.4.7.Final
    • None
    • None
    • None

      Hi,

      In the Bean Validation TCK, we need to catch the {{DeploymentException}}s and be able to determine its cause.

      The issue we have is that, in the case at hand, the constructor called to build the Weld DeploymentException is the one taking a List of causes (this one: https://github.com/weld/core/blob/master/impl/src/main/java/org/jboss/weld/exceptions/DeploymentException.java#L52) and in this case the cause is not accessible.

      Note that we have this issue even if there is only one cause.

      It forces us to check if the message contains the FQCN of the class we want to check: https://github.com/beanvalidation/beanvalidation-tck/pull/152/commits/5d94b3a9fb8b7556deea2d035fb48fbebfe94718#diff-d071e91c5ab6d0d1cfc23f4ccacd3e13R99 . And we are also forced to forge a new exception as we can't get the cause.

      I was wondering if we could inject the first cause of the list inside the Throwable's cause? And maybe the other ones could be added as suppressed throwables?

      Thanks for your feedback!

              mkouba@redhat.com Martin Kouba
              gsmet@redhat.com Guillaume Smet
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: