当前位置: 首页>>代码示例>>Java>>正文


Java UmbrellaException类代码示例

本文整理汇总了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();
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:22,代码来源:OdeLog.java

示例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;
}
 
开发者ID:ArloJamesBarnes,项目名称:walkaround,代码行数:27,代码来源:Logs.java

示例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();
		}
	});
}
 
开发者ID:jcricket,项目名称:gwt-syncproxy,代码行数:18,代码来源:ExceptionsTest.java

示例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();
		}
	});
}
 
开发者ID:jcricket,项目名称:gwt-syncproxy,代码行数:19,代码来源:ExceptionsTest.java

示例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());
            }
        }
    });

}
 
开发者ID:rkfg,项目名称:gwtutil,代码行数:24,代码来源:ClientUtils.java

示例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("Произошла клиентская ошибка. Информация отправлена разработчику.");
            }
        }
    });
}
 
开发者ID:rkfg,项目名称:gwtutil,代码行数:18,代码来源:ClientUtils.java

示例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);
		}
	});
}
 
开发者ID:burakince,项目名称:open-course-organizer,代码行数:17,代码来源:DesktopApp.java

示例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;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:11,代码来源:ToolBox.java

示例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;  
}
 
开发者ID:openremote,项目名称:WebConsole,代码行数:10,代码来源:WebConsole.java

示例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;  
}
 
开发者ID:opendata-euskadi,项目名称:r01fb,代码行数:16,代码来源:GWTThrowables.java

示例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);
	}
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:10,代码来源:UmbrellaExceptionHandler.java

示例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;
}
 
开发者ID:DavidWhitlock,项目名称:PortlandStateJava,代码行数:12,代码来源:AirlineGwt.java

示例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);
}
 
开发者ID:DavidWhitlock,项目名称:PortlandStateJava,代码行数:29,代码来源:AirlineGwtIT.java

示例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);
}
 
开发者ID:ggeorgovassilis,项目名称:flatbus,代码行数:42,代码来源:AbstractEventBus.java


注:本文中的com.google.gwt.event.shared.UmbrellaException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。