Details

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

      Operating System: All
      Platform: All

    • Bugzilla Id:
      6290

      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; }

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: