List of usage examples for java.lang Throwable getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:com.mtgi.analytics.BehaviorEvent.java
public void setError(Throwable t) { setError(t.getClass().getName() + ": " + t.getMessage()); }
From source file:com.telefonica.euro_iaas.sdc.manager.async.impl.NodeAsyncManagerImpl.java
private void updateErrorTask(Task task, String message, Throwable t) { TaskError error = new TaskError(message); error.setMajorErrorCode(t.getMessage()); error.setMinorErrorCode(t.getClass().getSimpleName()); task.setEndTime(new Date()); task.setStatus(TaskStates.ERROR);/*from w w w .j ava 2 s .com*/ task.setError(error); taskManager.updateTask(task); LOGGER.info("An error occurs while deleting a node . See task " + task.getHref() + "for more information"); }
From source file:com.accentrix.bugcrum.exception.DefaultExceptionHandler.java
@Override public void handle(Throwable t, String[] update, String message, String messageKeyPrefix) { log.info("handling Throwable: {}, update: {}", t.getMessage(), update); String exClassName = t.getClass().getName(); if (t instanceof WsRuntimeException) { log.debug("it is WsRuntimeException"); WsRuntimeException wsEx = (WsRuntimeException) t; exClassName = wsEx.getCauseClassName(); }// w w w .j av a 2 s . co m log.debug("exClassName: {}", exClassName); log.debug("exception msg: {}", t.getMessage()); if (StringUtils.isNotBlank(message)) { UIUtil.addErrorMessage(null, message); } else { String detail = getDetail(t, exClassName); String localizedMessage = getLocalizedMessage(exClassName, messageKeyPrefix, detail); UIUtil.addErrorMessage(null, localizedMessage); } for (String up : update) { RequestContext.getCurrentInstance().update(up); } }
From source file:org.archive.modules.extractor.Extractor.java
private void handleException(CrawlURI uri, Throwable t) { // both annotate (to highlight in crawl log) & add as local-error uri.getAnnotations().add("err=" + t.getClass().getName()); uri.getNonFatalFailures().add(t);//from w w w . ja va2 s . co m // also log as INFO // TODO: remove as redundant, given nonfatal logging? logger.log(Level.INFO, "Exception", t); }
From source file:com.sinosoft.one.mvc.web.impl.module.ErrorHandlerDispatcher.java
public Object onError(Invocation inv, Throwable ex) throws Throwable { for (ErrorHandlerDelegate delegate : delegates) { if (delegate.getMethod().getParameterTypes()[THROWABLE_INDEX].isAssignableFrom(ex.getClass())) { return delegate.onError(inv, ex); }/*from ww w . j a v a2 s. c o m*/ } throw new Error("not found errorHandlerMethod for exceptionClass" + ex.getClass().getName(), ex); }
From source file:de.micromata.genome.junittools.wicket.WicketPageBuilder.java
protected <X extends WicketPageBuilder<?>> X wrappExpected(CallableX<X, RuntimeException> callable) { if (expectedExceptionClass == null) { return callable.call(); }/* w w w. j a v a 2 s . c o m*/ try { callable.call(); Class<? extends Throwable> excl = expectedExceptionClass; expectedExceptionClass = null; throw new AssertionFailedException("Expected Exception " + excl + " but none thrown"); } catch (Throwable ex) { // NOSONAR "Illegal Catch" framework if (expectedExceptionClass.isAssignableFrom(ex.getClass()) == true) { expectedExceptionClass = null; return (X) getBuilder(); } else { ex.printStackTrace(); Class<? extends Throwable> excl = expectedExceptionClass; expectedExceptionClass = null; throw new AssertionFailedException("Expected Exception " + excl + " but got " + ex.getClass()); } } }
From source file:org.biokoframework.http.exception.impl.ExceptionResponseBuilderImpl.java
private int chooseStatusCode(Throwable cause) { while (cause != null && cause != cause.getCause()) { if (cause instanceof BiokoException) { Integer code = fStatusCodesMap.get(cause.getClass()); if (code != null) { return code; }//from w w w . j a va 2s . c o m } cause = cause.getCause(); } return HttpStatus.SC_INTERNAL_SERVER_ERROR; }
From source file:com.laxser.blitz.web.impl.module.ErrorHandlerDispatcher.java
@Override public Object onError(Invocation inv, Throwable ex) throws Throwable { for (ErrorHandlerDelegate delegate : delegates) { if (delegate.getMethod().getParameterTypes()[THROWABLE_INDEX].isAssignableFrom(ex.getClass())) { return delegate.onError(inv, ex); }//from w w w .ja v a2 s . c o m } throw new Error("not found errorHandlerMethod for exceptionClass" + ex.getClass().getName(), ex); }
From source file:com.moss.bdbwrap.bdbsession.WorkAtom.java
public final void run() { Transaction tx = e.begin();//from w w w.j ava 2 s .com try { doWork(tx); tx.commit(); } catch (Throwable t) { tx.abort(); throw new RuntimeException( getClass().getSimpleName() + " aborted due to uncaught " + t.getClass().getSimpleName(), t); } }
From source file:com.telefonica.euro_iaas.sdc.manager.async.impl.ChefClientAsyncManagerImpl.java
private void updateErrorTask(Task task, String message, Throwable t) { TaskError error = new TaskError(message); error.setMajorErrorCode(t.getMessage()); error.setMinorErrorCode(t.getClass().getSimpleName()); task.setEndTime(new Date()); task.setStatus(TaskStates.ERROR);//from w w w .ja v a 2s. c o m task.setError(error); taskManager.updateTask(task); LOGGER.info("An error occurs while deleting a node fromChef Server. See task " + task.getHref() + "for more information"); }