1. swingx
  2. SWINGX-1488

JXErrorPane's BasicErrorPaneUI renders exceptions incorrectly and has some minor performance issues


    • Type: Bug Bug
    • Status: Open
    • Priority: Trivial Trivial
    • Resolution: Unresolved
    • Affects Version/s: 1.6, 1.6.1, 1.6.2, 1.6.3
    • Fix Version/s: None
    • Component/s: Misc Component
    • Labels:
    • Environment:



      org.jdesktop.swingx.plaf.basic.BasicErrorPaneUI suffers from a number of flaws:

      A) Renders exceptions incorrectly in the details pane:

      html.append(" " + escapeXml(errorInfo.getErrorException().toString())); // incorrect, shall be message(s) only
      html.append("<h4>"ex.getMessage()"</h4>"); // incorrect, use ex.toString()

      B) "Caused by:" is missing for chained exceptions, making it harder to understand the stack trace.

      C) There are a number of minor performance issues:

      1) String concatenation is used instead of append().
      2) String.replace() is used instead of java.util.regex.

      Attached is a modified BasicErrorPaneUI, based on rev 4171 (1.6.3). It has the following changes:

      General changes:

      • Added some serialVersionUID, @Override, @SuppressWarnings and comments in empty block to eliminate IDE warnings.
      • Removed some redundant inheritDoc, some of them even had incorrect syntax.

      Changes in the details pane:

      • Horizontal rule below header removed. I just happened to dislike this, perhaps you don't and want to keep it.
      • "Caused by:" added before nested exceptions.
      • Indentation of stack trace changed.
      • Patterns used instead of String.replace() for performance.
      • Level removed, since it serves little purpose. I just happened to dislike this, perhaps you don't and want to keep it.
      • "Message:" not shown if there are no messages.
      • Title not included if there is no title.
      • Messages from all nested exceptions extracted, duplicates removed.
      • StringBuffer replaced with StringBuilder, added initial capacity and replaced string concatenation with append.
      • Added a TODO about making the details pane lazy.


        There are no comments yet on this issue.


          • Assignee:
            Karl Schaefer
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: