List of usage examples for java.lang Throwable toString
public String toString()
From source file:com.vmware.photon.controller.nsxclient.apis.DhcpServiceApiTest.java
@Test public void testDeleteDhcpRelayProfile() throws IOException, InterruptedException { setupMocks(null, HttpStatus.SC_OK);// w w w . j a v a 2s. c o m DhcpServiceApi client = new DhcpServiceApi(restClient); final CountDownLatch latch = new CountDownLatch(1); client.deleteDhcpRelayProfile("id", new com.google.common.util.concurrent.FutureCallback<Void>() { @Override public void onSuccess(Void result) { latch.countDown(); } @Override public void onFailure(Throwable t) { fail(t.toString()); latch.countDown(); } }); assertThat(latch.await(COUNTDOWNLATCH_AWAIT_TIMEOUT, TimeUnit.SECONDS), is(true)); }
From source file:com.vmware.photon.controller.nsxclient.apis.DhcpServiceApiTest.java
@Test public void testDeleteDhcpRelayService() throws IOException, InterruptedException { setupMocks(null, HttpStatus.SC_OK);//from w ww . j ava2 s .c o m DhcpServiceApi client = new DhcpServiceApi(restClient); final CountDownLatch latch = new CountDownLatch(1); client.deleteDhcpRelayService("id", new com.google.common.util.concurrent.FutureCallback<Void>() { @Override public void onSuccess(Void result) { latch.countDown(); } @Override public void onFailure(Throwable t) { fail(t.toString()); latch.countDown(); } }); assertThat(latch.await(COUNTDOWNLATCH_AWAIT_TIMEOUT, TimeUnit.SECONDS), is(true)); }
From source file:com.pagecrumb.proxy.ProxyFilter.java
/** * TODO Add hander for null baseURL /*from w ww. jav a 2 s .c o m*/ * @param ServletRequest servletrequest - request from client * @param ervletResponse servletresponse - response from server */ @Override public void doFilter(ServletRequest servletrequest, final ServletResponse servletresponse, FilterChain chain) throws IOException, ServletException { log.info("Before invoking chain"); try { String baseURL = ((HttpServletRequest) servletrequest).getQueryString(); if (baseURL != null) { log.info(this.getClass().toString() + " " + "Requested URL: " + baseURL); // TODO Must not pass request to .css or .ico etc. to the GenericResponseWrapper // Must use regex here, every thing that ends with ".*" must not be passed except //if (baseURL.matches(".*?\\.css.*")) { // GenericResponseWrapper responseWrapper // = new GenericResponseWrapper((HttpServletResponse) servletresponse, baseURL, "css"); // chain.doFilter(servletrequest, responseWrapper); //} if (baseURL.matches(".*?\\.png.*") || baseURL.matches(".*?\\.ico.*") || baseURL.matches(".*?\\.gif.*") || baseURL.matches(".*?\\.jpeg.*") || baseURL.matches(".*?\\.jpg.*") || baseURL.matches(".*?\\.js.*")) { // Do not process Javascript for now // Pass the wrapper on to the next filter or servlet log.info("Bypassing Parser - Just do Filter"); chain.doFilter(servletrequest, servletresponse); } else { String gwtModuleBase = (String) servletrequest.getAttribute("X-GWT-Module-Base"); log.info("Module-Base: " + gwtModuleBase); GenericResponseWrapper responseWrapper = new GenericResponseWrapper( (HttpServletResponse) servletresponse, baseURL); chain.doFilter(servletrequest, responseWrapper); log.info("Content type was " + responseWrapper.getContentType()); } } else { PrintWriter pw = servletresponse.getWriter(); pw.println("<html><body><p>Oops, query URL is missing.</p></body></html>"); } } catch (ServletException e) { log.error("Caught Servlet Exception"); Throwable rootCause = e.getRootCause(); log.error("Root cause is " + rootCause.toString()); if (rootCause instanceof RuntimeException) { // This is true for any FacesException. log.error("Rethrowing exception as RuntimeException" + rootCause.toString()); throw (RuntimeException) rootCause; // Throw wrapped RuntimeException instead of ServletException. } else { throw e; } } log.info("After invoking chain"); }
From source file:fr.xebia.demo.wicket.blog.view.BasePage.java
protected final void addErrorMessage(Throwable t) { if (t == null) { return;//from w w w. jav a 2s .c o m } String errorMessage = StringUtils.isEmpty(t.getMessage()) ? t.toString() : t.getMessage(); feedbackPanel.error(errorMessage); }
From source file:com.vmware.photon.controller.nsxclient.apis.DhcpServiceApiTest.java
@Test public void testGetDhcpRelayProfile() throws IOException, InterruptedException { final DhcpRelayProfile mockResponse = new DhcpRelayProfile(); mockResponse.setId("id"); mockResponse.setResourceType(ServiceProfileResourceType.DHCP_RELAY_PROFILE); setupMocks(objectMapper.writeValueAsString(mockResponse), HttpStatus.SC_OK); DhcpServiceApi client = new DhcpServiceApi(restClient); final CountDownLatch latch = new CountDownLatch(1); client.getDhcpRelayProfile("id", new com.google.common.util.concurrent.FutureCallback<DhcpRelayProfile>() { @Override// www.ja v a 2s .com public void onSuccess(DhcpRelayProfile result) { assertEquals(result, mockResponse); latch.countDown(); } @Override public void onFailure(Throwable t) { fail(t.toString()); latch.countDown(); } }); assertThat(latch.await(COUNTDOWNLATCH_AWAIT_TIMEOUT, TimeUnit.SECONDS), is(true)); }
From source file:com.vmware.photon.controller.nsxclient.apis.DhcpServiceApiTest.java
@Test public void testGetDhcpRelayService() throws IOException, InterruptedException { final DhcpRelayService mockResponse = new DhcpRelayService(); mockResponse.setId("id"); mockResponse.setResourceType(LogicalServiceResourceType.DHCP_RELAY_SERVICE); setupMocks(objectMapper.writeValueAsString(mockResponse), HttpStatus.SC_OK); DhcpServiceApi client = new DhcpServiceApi(restClient); final CountDownLatch latch = new CountDownLatch(1); client.getDhcpRelayService("id", new com.google.common.util.concurrent.FutureCallback<DhcpRelayService>() { @Override/* w ww.j av a2s . c om*/ public void onSuccess(DhcpRelayService result) { assertEquals(result, mockResponse); latch.countDown(); } @Override public void onFailure(Throwable t) { fail(t.toString()); latch.countDown(); } }); assertThat(latch.await(COUNTDOWNLATCH_AWAIT_TIMEOUT, TimeUnit.SECONDS), is(true)); }
From source file:fi.jumi.core.api.StackTraceTest.java
@Test public void has_same_toString_as_original_exception() { Throwable original = new Throwable("original message"); StackTrace copy = StackTrace.from(original); assertThat(copy.toString(), is(original.toString())); }
From source file:org.ireland.jnetty.dispatch.filter.FilterManager.java
public void destroy() { ArrayList<Filter> filterList = new ArrayList<Filter>(); for (int i = 0; i < filterList.size(); i++) { Filter filter = filterList.get(i); try {/*from w w w . ja v a 2 s .com*/ filter.destroy(); } catch (Throwable e) { log.warn(e.toString(), e); } } }
From source file:com.haulmont.cuba.gui.exception.DeletePolicyHandler.java
@Override public boolean handle(Throwable exception, WindowManager windowManager) { Throwable t = exception; try {/*from w ww .ja v a 2s.c o m*/ while (t != null) { if (t.toString().contains(getMarker())) { doHandle(t.toString(), windowManager); return true; } t = t.getCause(); } return false; } catch (Exception e) { return false; } }
From source file:com.streamsets.datacollector.websockets.LogMessageWebSocket.java
@Override public void onWebSocketError(Throwable cause) { super.onWebSocketError(cause); LOG.warn("LogMessageWebSocket error: {}", cause.toString(), cause); if (tailer != null) { tailer.stop();/*from ww w .j a va 2 s .c o m*/ } SDCWebSocketServlet.webSocketClients--; }