svn commit: r954955 - /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java

[email protected]
Newsgroups gmane.comp.apache.logging
Message-ID <[email protected]>
Author: sdeboy
Date: Tue Jun 15 16:39:44 2010
New Revision: 954955

URL: http://svn.apache.org/viewvc?rev=954955&view=rev
Log:
throwable renderer cleanup (zero-len non-null throwable string array should display nothing in the throwable popup)

Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java?rev=954955&r1=954954&r2=954955&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java Tue Jun 15 16:39:44 2010
@@ -907,21 +907,22 @@ public class LogPanel extends DockablePa
             table.getColumnName(table.getSelectedColumn()) + " detail...");
           if (event == null) {
               detailArea.setText("");
-          } else if (event.getThrowableStrRep() instanceof String[]) {
-            StringBuffer buf = new StringBuffer();
-            buf.append(event.getMessage());
-            buf.append("\n");
-            String[] ti = (String[]) event.getThrowableStrRep();
-            buf.append(ti[0]).append("\n");
-
-            for (int i = 1; i < ti.length; i++) {
-              buf.append(ti[i]).append("\n    ");
-            }
-
-            detailArea.setText(buf.toString());
           } else {
-            //no exception
-            detailArea.setText("");
+            //throwable string representation may be a length-one empty array
+            String[] ti = event.getThrowableStrRep();
+            if (ti != null && ti.length > 0 && (!(ti.length == 1 && ti[0].equals("")))) {
+                StringBuffer buf = new StringBuffer();
+                buf.append(event.getMessage());
+                buf.append("\n");
+                for (int i = 0; i < ti.length; i++) {
+                  buf.append(ti[i]).append("\n    ");
+                }
+
+                detailArea.setText(buf.toString());
+              } else {
+                //no exception
+                detailArea.setText("");
+              }
           }
 
           SwingHelper.invokeOnEDT(new Runnable() {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.