Commons Digester
  1. Commons Digester
  2. DIGESTER-73

Cause of XmlLoadException swalloed making it hard to debug parse errors

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: Nightly Builds
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      While o.a.c.d.xmlrules.XmlLoadException has constructors taking the Throwable
      cause of the exception, this value is never used again. This makes it rather
      hard to debug parse errors in the rule files when using
      FromXmlRuleSet#addRuleInstances(). I've created a simple patch that at least
      under a 1.4 JDK allows to debug this by calling Throwable.initCause() inside
      XmlLoadException.

        Activity

        Stefan Kuehnel created issue -
        Hide
        Stefan Kuehnel added a comment -

        Created an attachment (id=7803)
        Simple patch

        Show
        Stefan Kuehnel added a comment - Created an attachment (id=7803) Simple patch
        Hide
        Simon Kitching added a comment -

        Hmm.. the code is a bit odd, isn't it? The XmlLoadException class takes a cause
        parameter, and stores it in a private member variable, but never does anything
        with it and never provides any methods to access it.

        How about we add a (one-line) getCause() method to this class? This would be
        api-compatible with java1.4 exceptions, but allow the class to work the same on
        all platforms. This solution is explicitly mentioned in the Jdk1.4 javadocs for
        Throwable.getCause() as a good solution for pre-1.4 exceptions.

        Or have I missed something?

        Show
        Simon Kitching added a comment - Hmm.. the code is a bit odd, isn't it? The XmlLoadException class takes a cause parameter, and stores it in a private member variable, but never does anything with it and never provides any methods to access it. How about we add a (one-line) getCause() method to this class? This would be api-compatible with java1.4 exceptions, but allow the class to work the same on all platforms. This solution is explicitly mentioned in the Jdk1.4 javadocs for Throwable.getCause() as a good solution for pre-1.4 exceptions. Or have I missed something?
        Hide
        rdonkin@apache.org added a comment -

        +1 to simon's assessment and proposed solution

        unless, of course, we've both missed something...

        Show
        rdonkin@apache.org added a comment - +1 to simon's assessment and proposed solution unless, of course, we've both missed something...
        Hide
        Simon Kitching added a comment -

        Patch committed to add a getCause method to the class.

        Show
        Simon Kitching added a comment - Patch committed to add a getCause method to the class.
        Henri Yandell made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 22383 12340902
        Henri Yandell made changes -
        Project Commons [ 12310458 ] Commons Digester [ 12310471 ]
        Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
        Key COM-751 DIGESTER-73
        Affects Version/s Nightly Builds [ 12311648 ]
        Component/s Digester [ 12311111 ]
        Henri Yandell made changes -
        Affects Version/s Nightly Builds [ 12311810 ]
        Henri Yandell made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Stefan Kuehnel
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development