本文整理汇总了Java中com.google.gwt.event.shared.UmbrellaException类的典型用法代码示例。如果您正苦于以下问题:Java UmbrellaException类的具体用法?Java UmbrellaException怎么用?Java UmbrellaException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UmbrellaException类属于com.google.gwt.event.shared包,在下文中一共展示了UmbrellaException类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareStackTrace
import com.google.gwt.event.shared.UmbrellaException; //导入依赖的package包/类
private static String prepareStackTrace(Throwable throwable) {
StringBuilder html = new StringBuilder();
html.append("<ul>");
for (StackTraceElement element : throwable.getStackTrace()) {
html.append("<li>").append(StringUtils.escape(element.toString())).append("</li>");
}
html.append(prepareCause(throwable.getCause()));
if (throwable instanceof UmbrellaException) {
Set<Throwable> causes = ((UmbrellaException) throwable).getCauses();
if (causes != null && !causes.isEmpty()) {
for (Throwable cause : causes) {
html.append(prepareCause(cause));
}
}
}
html.append("</ul>");
return html.toString();
}
示例2: getThrowable
import com.google.gwt.event.shared.UmbrellaException; //导入依赖的package包/类
/**
* Extracts the Throwable from the entry (and caches it).
* Has the side effect of unwrapping the first UmbrellaException.
*/
private Throwable getThrowable(Entry e) {
if (e.firstThrowable == null) {
e.firstThrowable = NO_THROWABLE_INSTANCE;
Object[] objects = e.objects;
for (int i = 0; i < objects.length; i++) {
if (objects[i] instanceof Throwable) {
Throwable t = (Throwable) objects[i];
// Replace annoying umbrella exceptions with the real one
if (t instanceof UmbrellaException && t.getCause() != null) {
t = t.getCause();
objects[i] = t;
}
e.firstThrowable = t;
break;
}
}
}
return e.firstThrowable != NO_THROWABLE_INSTANCE ? e.firstThrowable : null;
}
示例3: testUmbrellaException
import com.google.gwt.event.shared.UmbrellaException; //导入依赖的package包/类
public void testUmbrellaException() {
final UmbrellaException expected = TestSetFactory
.createUmbrellaException();
checkException(expected, new AsyncCallback<UmbrellaException>() {
@Override
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
}
@Override
public void onSuccess(UmbrellaException result) {
assertNotNull(result);
assertTrue(TestSetValidator.isValid(expected, result));
finishTest();
}
});
}
示例4: testUmbrellaException
import com.google.gwt.event.shared.UmbrellaException; //导入依赖的package包/类
public void testUmbrellaException() {
fail("IRSE Illegal Access Exception for JRE Fields");
final UmbrellaException expected = TestSetFactory
.createUmbrellaException();
checkException(expected, new AsyncCallback<UmbrellaException>() {
@Override
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
}
@Override
public void onSuccess(UmbrellaException result) {
assertNotNull(result);
assertTrue(TestSetValidator.isValid(expected, result));
finishTest();
}
});
}
示例5: setupExceptionHandler
import com.google.gwt.event.shared.UmbrellaException; //导入依赖的package包/类
public static void setupExceptionHandler() {
GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
@Override
public void onUncaughtException(Throwable e) {
while (e instanceof UmbrellaException) {
e = e.getCause();
}
if (e instanceof AlertRuntimeException) {
Window.alert(e.getMessage());
} else {
StackTraceElement[] stackTraceElements = e.getStackTrace();
StringBuilder trace = new StringBuilder();
trace.append(e).append('\n');
for (StackTraceElement element : stackTraceElements) {
trace.append(element.toString()).append('\n');
}
Window.alert(trace.toString());
}
}
});
}
示例6: setupTelemetryExceptionHandler
import com.google.gwt.event.shared.UmbrellaException; //导入依赖的package包/类
public static void setupTelemetryExceptionHandler() {
GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
@Override
public void onUncaughtException(Throwable e) {
while (e instanceof UmbrellaException) {
e = e.getCause();
}
if (e instanceof AlertRuntimeException) {
Window.alert(e.getMessage());
} else {
sendErrorTelemetry(e);
Window.alert("Произошла клиентская ошибка. Информация отправлена разработчику.");
}
}
});
}
示例7: setUncaughtExceptionHandler
import com.google.gwt.event.shared.UmbrellaException; //导入依赖的package包/类
private void setUncaughtExceptionHandler() {
GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
@Override
public void onUncaughtException(Throwable e) {
while (e instanceof UmbrellaException) {
e = ((UmbrellaException) e).getCauses().iterator().next();
}
String message = e.getMessage();
if (message == null) {
message = e.toString();
}
Window.alert("An unexpected error occurred: " + message);
}
});
}
示例8: unwrap
import com.google.gwt.event.shared.UmbrellaException; //导入依赖的package包/类
public static Throwable unwrap(Throwable e) {
if (e == null) return null;
if (e instanceof UmbrellaException) {
UmbrellaException ue = (UmbrellaException) e;
if (ue.getCauses().size() == 1) {
return unwrap(ue.getCauses().iterator().next());
}
}
return e;
}
示例9: unwrap
import com.google.gwt.event.shared.UmbrellaException; //导入依赖的package包/类
public Throwable unwrap(Throwable e) {
if(e instanceof UmbrellaException) {
UmbrellaException ue = (UmbrellaException) e;
if(ue.getCauses().size() == 1) {
return unwrap(ue.getCauses().iterator().next());
}
}
return e;
}
示例10: unwrap
import com.google.gwt.event.shared.UmbrellaException; //导入依赖的package包/类
/**
* Sometimes GWT exceptions as {@link UmbrellaException}. This method unwraps the {@link UmbrellaException}
* to find the original exception
* @param e exception
* @return the original exception
*/
public static Throwable unwrap(final Throwable e) {
if(e instanceof UmbrellaException) {
UmbrellaException ue = (UmbrellaException)e;
if (ue.getCauses().size() == 1) {
return unwrap(ue.getCauses().iterator().next());
}
}
return e;
}
示例11: displayThrowable
import com.google.gwt.event.shared.UmbrellaException; //导入依赖的package包/类
private void displayThrowable(Throwable error) {
if (error instanceof UmbrellaException) {
for (Throwable cause : ((UmbrellaException) error).getCauses()) {
this.displayThrowable(cause);
}
} else {
ErrorManager.get().getErrorDisplayer().display(error, Severity.DANGER);
}
}
示例12: unwrapUmbrellaException
import com.google.gwt.event.shared.UmbrellaException; //导入依赖的package包/类
private Throwable unwrapUmbrellaException(Throwable throwable) {
if (throwable instanceof UmbrellaException) {
UmbrellaException umbrella = (UmbrellaException) throwable;
if (umbrella.getCauses().size() == 1) {
return unwrapUmbrellaException(umbrella.getCauses().iterator().next());
}
}
return throwable;
}
示例13: testClickingShowClientSideExceptionButtonAlertsWithExpectedMessage
import com.google.gwt.event.shared.UmbrellaException; //导入依赖的package包/类
@Test
public void testClickingShowClientSideExceptionButtonAlertsWithExpectedMessage() {
final CapturingAlerter alerter = new CapturingAlerter();
final AirlineGwt ui = new AirlineGwt(alerter);
ui.onModuleLoad();
// Wait for UI widgets to be created
waitBeforeRunning(500, new Runnable() {
@Override
public void run() {
try {
click(ui.showClientSideExceptionButton);
fail("Should have thrown an UmbrellaException");
} catch (UmbrellaException ex) {
Throwable cause = ex.getCause();
assertTrue(cause instanceof IllegalStateException);
IllegalStateException ise = (IllegalStateException) cause;
assertTrue(ise.getMessage().contains("Expected exception on the client side"));
finishTest();
}
}
});
// Wait up to 1000 milliseconds for the validation to complete
delayTestFinish(1000);
}
示例14: invokeListeners
import com.google.gwt.event.shared.UmbrellaException; //导入依赖的package包/类
/**
* Finds all listeners that implement the interface denoted by
* "interfaceName" and runs "executable" on them.
*
* @param interfaceName
* @param executable
* @param returnsResults
* The caller needs to know whether the method invoked on the
* listener declares a return type or not and denote this here
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void invokeListeners(String interfaceName, Executable executable, boolean returnsResults) {
List<BusListener> specificListeners = getListenersFor(interfaceName, listeners);
if (returnsResults && specificListeners == null)
throw new IllegalArgumentException("Cannot return results when no listeners are registered for "
+ interfaceName);
if (specificListeners == null)
return;
// create unmodifiable copy so that additions/removals of listeners
// during an invocations don't mingle with the order of listeners
specificListeners = new ArrayList<BusListener>(specificListeners);
boolean oldCallActive = callActive;
callActive = true;
Set<Throwable> exceptions = null;
for (BusListener listener : specificListeners) {
if (!callActive)
break;
try {
Object result = executable.execute(listener);
executable.addItemToResults(result);
} catch (Throwable t) {
if (exceptions == null)
exceptions = new HashSet<Throwable>();
exceptions.add(t);
}
}
callActive = oldCallActive;
lastInvocationResults = executable.results;
if (exceptions != null)
throw new UmbrellaException(exceptions);
}