Author: [EMAIL PROTECTED]
Date: Wed Sep 3 14:22:53 2008
New Revision: 3609
Modified:
trunk/dev/core/src/com/google/gwt/dev/util/log/AbstractTreeLogger.java
trunk/dev/core/src/com/google/gwt/dev/util/log/TreeItemLogger.java
trunk/dev/core/src/com/google/gwt/dev/util/log/TreeLoggerWidget.java
Log:
Fixes issue #2607; TreeItemLogger now eagerly grabs exception info from a
thrown exception to break lingering dependency on user code. Partial
back-port from OOPHM.
Suggested by: zundel
Review by: zundel
Modified:
trunk/dev/core/src/com/google/gwt/dev/util/log/AbstractTreeLogger.java
==============================================================================
--- trunk/dev/core/src/com/google/gwt/dev/util/log/AbstractTreeLogger.java
(original)
+++ trunk/dev/core/src/com/google/gwt/dev/util/log/AbstractTreeLogger.java
Wed Sep 3 14:22:53 2008
@@ -16,6 +16,7 @@
package com.google.gwt.dev.util.log;
import com.google.gwt.core.ext.TreeLogger;
+import com.google.gwt.core.ext.UnableToCompleteException;
import java.util.HashSet;
@@ -45,8 +46,12 @@
+ "amount of memory, use the -Xmx flag at startup (java
-Xmx128M ...)";
public static String getStackTraceAsString(Throwable e) {
- // For each cause, print the requested number of entries of its stack
trace,
- // being careful to avoid getting stuck in an infinite loop.
+ // Show the exception info for anything other than "UnableToComplete".
+ if (e == null || e instanceof UnableToCompleteException) {
+ return null;
+ }
+ // For each cause, print the requested number of entries of its stack
+ // trace, being careful to avoid getting stuck in an infinite loop.
//
StringBuffer message = new StringBuffer();
Throwable currentCause = e;
@@ -70,6 +75,13 @@
currentCause = currentCause.getCause();
}
return message.toString();
+ }
+
+ protected static String getExceptionName(Throwable e) {
+ if (e == null || e instanceof UnableToCompleteException) {
+ return null;
+ }
+ return e.getClass().getSimpleName();
}
public int indexWithinMyParent;
Modified: trunk/dev/core/src/com/google/gwt/dev/util/log/TreeItemLogger.java
==============================================================================
--- trunk/dev/core/src/com/google/gwt/dev/util/log/TreeItemLogger.java
(original)
+++ trunk/dev/core/src/com/google/gwt/dev/util/log/TreeItemLogger.java Wed
Sep 3 14:22:53 2008
@@ -41,7 +41,9 @@
* Represents an individual log event.
*/
public static class LogEvent {
- public final Throwable caught;
+ public final String exceptionDetail;
+
+ public final String exceptionName;
public final HelpInfo helpInfo;
@@ -57,12 +59,13 @@
public LogEvent(TreeItemLogger logger, boolean isBranchCommit, int
index,
Type type, String message, Throwable caught, HelpInfo helpInfo) {
+ this.exceptionDetail =
AbstractTreeLogger.getStackTraceAsString(caught);
+ this.exceptionName = AbstractTreeLogger.getExceptionName(caught);
this.logger = logger;
this.isBranchCommit = isBranchCommit;
this.index = index;
this.type = type;
this.message = message;
- this.caught = caught;
this.helpInfo = helpInfo;
}
@@ -161,13 +164,8 @@
//
String label = message;
if (label == null) {
- if (caught != null) {
- label = caught.getMessage();
-
- if (label == null || label.trim().length() == 0) {
- label = caught.toString();
- }
- }
+ assert (exceptionName != null);
+ label = exceptionName;
}
treeItem.setText(label);
Modified:
trunk/dev/core/src/com/google/gwt/dev/util/log/TreeLoggerWidget.java
==============================================================================
--- trunk/dev/core/src/com/google/gwt/dev/util/log/TreeLoggerWidget.java
(original)
+++ trunk/dev/core/src/com/google/gwt/dev/util/log/TreeLoggerWidget.java
Wed Sep 3 14:22:53 2008
@@ -15,7 +15,6 @@
*/
package com.google.gwt.dev.util.log;
-import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.core.ext.TreeLogger.HelpInfo;
import com.google.gwt.dev.shell.BrowserWidget;
import com.google.gwt.dev.util.log.TreeItemLogger.LogEvent;
@@ -317,11 +316,8 @@
// Show the exception info for anything other than "UnableToComplete".
//
- if (logEvent != null && logEvent.caught != null) {
- if (!(logEvent.caught instanceof UnableToCompleteException)) {
- String stackTrace =
AbstractTreeLogger.getStackTraceAsString(logEvent.caught);
- sb.append(stackTrace);
- }
+ if (logEvent != null && logEvent.exceptionDetail != null) {
+ sb.append(logEvent.exceptionDetail);
}
details.setText(sb.toString());
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---