List of usage examples for java.lang RuntimeException printStackTrace
public void printStackTrace()
From source file:edu.upc.tutorial.jaxrs.android.data.LibraryResteasyClient.java
@Override public Book getBook(String isbn) { Book result = null;/*from w w w .ja va 2 s .c om*/ try { result = getLibraryClient().getBook(isbn); } catch (RuntimeException ex) { ex.printStackTrace(); } Log.i(LOG_TAG, "getBook: " + result); return result; }
From source file:edu.upc.tutorial.jaxrs.android.data.LibraryResteasyClient.java
@Override public Book addBook(String isbn, String title) { Book result = null;/*from w w w. ja v a 2s . c o m*/ try { result = getLibraryClient().addBook(isbn, title); } catch (RuntimeException ex) { ex.printStackTrace(); } Log.i(LOG_TAG, "addBook: " + result); return result; }
From source file:edu.upc.tutorial.jaxrs.android.data.LibraryResteasyClient.java
@Override public Book updateBook(String isbn, String title) { Book result = null;/*from www .ja va 2s . co m*/ try { result = getLibraryClient().updateBook(isbn, title); } catch (RuntimeException ex) { ex.printStackTrace(); } Log.i(LOG_TAG, "updateBook: " + result); return result; }
From source file:edu.upc.tutorial.jaxrs.android.data.LibraryResteasyClient.java
@Override public Book removeBook(String isbn) { Book result = null;/*from www. j av a2s . c o m*/ try { result = getLibraryClient().removeBook(isbn); } catch (RuntimeException ex) { ex.printStackTrace(); } Log.i(LOG_TAG, "removeBook: " + result); return result; }
From source file:org.apache.safe.servlet.SafeServlet.java
/** * Return information about SLA Events./*from w w w .ja va2s.com*/ */ @SuppressWarnings("unchecked") public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { if (!INITED) { throw new SafeServletException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.E0200); } String action = request.getParameter(Constants.ACTION_PARAM); if (action.equals(Constants.SAFE_GET_KEY)) { String keyId = request.getParameter(Constants.SAFE_KEY_ID); ParamChecker.notEmpty(keyId, Constants.SAFE_KEY_ID); byte[] key = SAFE_INSTANCE.getKey(getUser(request), keyId); Element eKey = new Element("key"); eKey.setAttribute(new Attribute("id", keyId)); String strKey = Base64.encodeBase64String(key); eKey.setText(strKey); response.setStatus(HttpServletResponse.SC_OK); response.getWriter().write(XmlUtils.prettyPrint(eKey) + "\n"); } else if (action.equals(Constants.SAFE_GET_KEYS)) { String keyNames = request.getParameter(Constants.SAFE_KEY_ID); ParamChecker.notEmpty(keyNames, Constants.SAFE_KEY_ID); //get the list of key names String[] keyIds = keyNames.split("\\s*,\\s*"); Element eKeys = new Element("keys"); for (String keyId : keyIds) { byte[] key = SAFE_INSTANCE.getKey(getUser(request), keyId); Element eKey = new Element("key"); eKey.setAttribute(new Attribute("id", keyId)); String strKey = Base64.encodeBase64String(key); eKey.setText(strKey); eKeys.addContent(eKey); } response.getWriter().write(XmlUtils.prettyPrint(eKeys) + "\n"); response.setStatus(HttpServletResponse.SC_OK); } } catch (SafeException e) { throw new SafeServletException(HttpServletResponse.SC_UNAUTHORIZED, e.getErrorCode(), e.getMessage()); } catch (RuntimeException re) { re.printStackTrace(); LOG.error("Runtime error ", re); throw new SafeServletException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.E0307, re.getMessage()); } }
From source file:com.test.zhangyue.zeus.service.HiveTableServiceTest.java
@Test public void findHivePageTable() { HiveTableEntity entity = new HiveTableEntity(); entity.setPageSize(10);//from w ww . jav a 2 s . c o m entity.setPageNo(2); hiveTableService.setHiveTableEntity(entity); try { Page<HiveTableEntity> page = hiveTableService.findHivePageTable(); page.getTotalCount(); } catch (RuntimeException e) { e.printStackTrace(); } }
From source file:org.axonframework.eventhandling.saga.SagaManagerTest.java
@Test public void testExceptionPropagated() throws Exception { testSubject.setSuppressExceptions(false); EventMessage event = new GenericEventMessage<>(new Object()); doThrow(new MockException()).when(mockSaga1).handle(event); try {/*from w w w . j a v a2 s .c om*/ testSubject.handle(event); fail("Expected exception to be propagated"); } catch (RuntimeException e) { e.printStackTrace(); assertEquals("Mock", e.getMessage()); } verify(mockSaga1, times(1)).handle(event); }
From source file:org.mili.ant.PropertiesReplacerCLITest.java
/** * Test main_failure.//w ww . j a v a 2 s . co m * * @throws Exception the exception */ @Test public void testMain_failure() throws Exception { try { PropertiesReplacerCLI.main(new String[] { "-propfile", "aaa", "-propdesc", "b" }); Assert.fail("exception expected!"); } catch (RuntimeException e) { e.printStackTrace(); } }
From source file:org.wso2.event.adaptor.mqtt.internal.ds.MQTTEventAdaptorServiceDS.java
/** * initialize the agent service here service here. * * @param context//from w ww . j a v a 2 s. co m */ protected void activate(ComponentContext context) { try { InputEventAdaptorFactory mqttEventAdaptorFactory = new MQTTEventAdaptorFactory(); context.getBundleContext().registerService(InputEventAdaptorFactory.class.getName(), mqttEventAdaptorFactory, null); log.info("Successfully deployed the MQTT input event adaptor service"); } catch (RuntimeException e) { log.error("Can not create the MQTT input event adaptor service ", e); e.printStackTrace(); } }
From source file:com.expedia.client.WunderGroundClient.java
@Override public ResponseEntity<Response> getXMLResponse(Object request) { ResponseEntity<Response> responseEntity = null; Weather weather = null;// w ww . j a va 2 s .c om if (request instanceof Weather) { weather = (Weather) request; List<MediaType> mediaTypes = new ArrayList<MediaType>(); mediaTypes.add(MediaType.APPLICATION_XML); HttpHeaders headers = new HttpHeaders(); headers.setAccept(mediaTypes); HttpEntity<Weather> httpEntity = new HttpEntity<Weather>(null, headers); try { System.out.println("Hitting weather service!"); responseEntity = restTemplate.exchange(weatherServiceXmlUrl, HttpMethod.GET, httpEntity, Response.class, weatherApiKey, weather.getZipCode()); } catch (RuntimeException e) { e.printStackTrace(); weather.setErrorDesc("Get failed" + e.getMessage()); } } return responseEntity; }