You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2007/12/03 17:39:36 UTC

svn commit: r600591 - /incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/MultiPageEditor.java

Author: schor
Date: Mon Dec  3 08:39:35 2007
New Revision: 600591

URL: http://svn.apache.org/viewvc?rev=600591&view=rev
Log:
[UIMA-664] The messages for Errors / Exceptions sometimes are insuffient - example: NoClassDefFoundError message is just the class name.  Change the code that prints messages down to the root cause to include the class name (minus the package name, for easier reading) along with the message.

Modified:
    incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/MultiPageEditor.java

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/MultiPageEditor.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/MultiPageEditor.java?rev=600591&r1=600590&r2=600591&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/MultiPageEditor.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/MultiPageEditor.java Mon Dec  3 08:39:35 2007
@@ -2373,11 +2373,19 @@
     boolean wantStackTrace = false;
     StringBuffer b = new StringBuffer(200);
     String messagePart = e.getMessage();
+    
+    // messages for noClassDef found and NPE don't say what the problem was,
+    // so always include the exception class also
+    
+    formatMessageWithClass(e, b, messagePart);
     if (null == messagePart) {
-      b.append(e.getClass().getName());
       wantStackTrace = true;
-    } else
-      b.append(messagePart);
+    }
+//    if (null == messagePart) {
+//      b.append(e.getClass().getName());
+//      wantStackTrace = true;
+//    } else
+//      b.append(messagePart);
     Throwable cur = e;
     Throwable next;
 
@@ -2389,7 +2397,8 @@
         wantStackTrace = true;
       }
       if (null != message && !message.equals(messagePart)) {
-        b.append(Messages.getString("MultiPageEditor.causedBy")).append(message); //$NON-NLS-1$
+        b.append(Messages.getString("MultiPageEditor.causedBy"));
+        formatMessageWithClass(next, b, message);
         messagePart = message;
       }
       cur = next;
@@ -2405,6 +2414,21 @@
     return b.toString();
   }
 
+  private void formatMessageWithClass(Throwable e, StringBuffer b, String messagePart) {
+    String name = e.getClass().getName();
+    //because this is a message for ordinary users, and
+    // because the exceptions are more easily readable without their package prefixes,
+    //  remove the package prefix from the displayed name
+    int lastDot = name.lastIndexOf('.');
+    if (lastDot >= 0) {
+      name = name.substring(lastDot + 1);
+    }
+    b.append(name);
+    if (null != messagePart) {
+      b.append(": ").append(messagePart);
+    }
+  }
+  
   public static class JCasGenProgressMonitor implements
           org.apache.uima.tools.jcasgen.IProgressMonitor {
     IProgressMonitor m_progressMonitor;
@@ -2917,7 +2941,7 @@
     
     StringBuffer sb = new StringBuffer(100);
     for (int i = 0; i < names.size(); i++) {
-      sb.append(names.get(i))
+      sb.append("Component key-name(s): ").append(names.get(i))
         .append(": ")
         .append(getMessagesToRootCause((Exception)exceptions.get(i)))
         .append("\n");