Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      When invoking rules, if a java.lang.Error is thrown, Digester will catch it,
      discard it, and throw a SAXException its place. This is unsafe and unnecessary.
      In general, unless specific handling is required, errors should be allowed to
      percolate up.

      Example from Digester.endElement():
      try {
      Rule rule = (Rule) rules.get;
      if (debug)

      { log.debug(" Fire body() for " + rule); }
      rule.body(bodyText);
      } catch (Exception e) { log.error("Body event threw exception", e); throw createSAXException(e); } catch (Throwable t) { log.error("Body event threw exception", t); throw createSAXException(t.getMessage()); }

      It's OK to catch Throwable in order to log its message, but it should then
      immediately rethrow it. A safe version of the above would be:
      try {
      Rule rule = (Rule) rules.get;
      if (debug) { log.debug(" Fire body() for " + rule); }

      rule.body(bodyText);
      } catch (Exception e)

      { log.error("Body event threw exception", e); throw createSAXException(e); }

      catch (Error e)

      { log.error("Body event threw error", e); throw e; }

        Activity

        Hide
        Craig McClanahan added a comment -

        Fixed in nightly build 20020311.

        Show
        Craig McClanahan added a comment - Fixed in nightly build 20020311.

          People

          • Assignee:
            Unassigned
            Reporter:
            David H. Martin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development