List of usage examples for org.apache.commons.lang3.exception ExceptionUtils getStackTrace
public static String getStackTrace(final Throwable throwable)
Gets the stack trace from a Throwable as a String.
The result of this method vary by JDK version as this method uses Throwable#printStackTrace(java.io.PrintWriter) .
From source file:com.aurel.track.persist.TDashboardScreenPeer.java
@Override public TDashboardScreenBean loadByPrimaryKey(Integer objectID) { TDashboardScreen tobject = null;/*from w w w . ja va2 s . c o m*/ try { tobject = retrieveByPK(objectID); } catch (Exception e) { LOGGER.info( "Loading of a dashboard screen by primary key " + objectID + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (tobject != null) { return tobject.getBean(); } return null; }
From source file:com.aurel.track.admin.customize.lists.importList.ImportListBL.java
/** * Imports a list from an xml file/*ww w .j av a 2 s.c o m*/ * @param uploadFile * @return */ public static void importList(File uploadFile, String node, boolean overwriteExisting, boolean clearChildren) { ListOptionIDTokens listOptionIDTokens = ListBL.decodeNode(node); Integer repository = listOptionIDTokens.getRepository(); Integer projectID = null; if (ListBL.REPOSITORY_TYPE.PROJECT == repository) { projectID = listOptionIDTokens.getProjectID(); } boolean contained = false; Map<Integer, Integer> listObjectIdMap = new HashMap<Integer, Integer>(); try { EntityImporter entityImporter = new EntityImporter(); Map<String, String> extraAttributes = new HashMap<String, String>(); if (projectID != null) { extraAttributes.put("project", projectID.toString()); extraAttributes.put("repositoryType", TListBean.REPOSITORY_TYPE.PROJECT + ""); } else { extraAttributes.put("project", null); extraAttributes.put("repositoryType", TListBean.REPOSITORY_TYPE.PUBLIC + ""); } ImportContext importContext = new ImportContext(); importContext.setEntityType("TListBean"); importContext.setOverrideExisting(overwriteExisting); importContext.setClearChildren(clearChildren); importContext.setAttributeMap(extraAttributes); entityImporter.importFile(uploadFile, importContext); } catch (EntityImporterException e) { LOGGER.debug(ExceptionUtils.getStackTrace(e)); JSONUtility.encodeJSONFailure(e.getMessage()); } catch (Exception e) { LOGGER.debug(ExceptionUtils.getStackTrace(e)); JSONUtility.encodeJSONFailure(e.getMessage()); } }
From source file:com.daou.terracelicense.controller.MachineController.java
/** * Machine-Controller-03//w w w .j av a 2 s. co m * Get Machine List Data */ @RequestMapping(value = "/list", method = RequestMethod.GET) @ResponseBody public MachineList getMachineList(@RequestParam(value = "page", defaultValue = "1") String page, @RequestParam(value = "sortType", defaultValue = "createdate") String sortType) { MachineList machineList = new MachineList(); try { machineList = machineService.getMachineList(page, sortType); } catch (Exception e) { logger.error(ExceptionUtils.getStackTrace(e)); } return machineList; }
From source file:com.jwebmp.plugins.datatable.DataTablesServlet.java
@Override @SuppressWarnings("unchecked") public void perform() { HttpServletRequest request = GuiceContext.get(GuicedServletKeys.getHttpServletRequestKey()); StringBuilder output = new StringBuilder(); Set<Class<? extends DataTableDataFetchEvent>> allEvents = new HashSet(GuiceContext.instance() .getScanResult().getSubclasses(DataTableDataFetchEvent.class.getCanonicalName()).loadClasses()); Map<String, String[]> params = request.getParameterMap(); String className = params.get("c")[0]; allEvents.removeIf(a -> !a.getCanonicalName().equals(className.replace(CHAR_UNDERSCORE, CHAR_DOT))); if (allEvents.isEmpty()) { writeOutput(output, HTML_HEADER_JAVASCRIPT, UTF8_CHARSET); DataTablesServlet.log.fine("DataTablesServlet could not find any specified data search class"); } else {/*ww w.ja v a 2s . co m*/ DataTableSearchRequest searchRequest = new DataTableSearchRequest(); searchRequest.fromRequestMap(params); try { Class<? extends DataTableDataFetchEvent> event = allEvents.iterator().next(); DataTableDataFetchEvent dtd = GuiceContext.get(event); DataTableData d = dtd.returnData(searchRequest); output.append(d.toString()); writeOutput(output, HTML_HEADER_JSON, UTF8_CHARSET); } catch (Exception e) { output.append(ExceptionUtils.getStackTrace(e)); writeOutput(output, HTML_HEADER_JAVASCRIPT, UTF8_CHARSET); DataTablesServlet.log.log(Level.SEVERE, "Unable to execute datatables ajax data fetch", e); } } }
From source file:com.linkedin.pinot.controller.api.restlet.resources.PinotInstance.java
@Override @Post("json")/*from w w w .j av a2 s. c om*/ public Representation post(Representation entity) { StringRepresentation presentation = null; try { final Instance instance = mapper.readValue(ByteStreams.toByteArray(entity.getStream()), Instance.class); final PinotResourceManagerResponse resp = manager.addInstance(instance); LOGGER.info("instace create request recieved for instance : " + instance.toInstanceId()); presentation = new StringRepresentation(resp.toJSON().toString()); } catch (final Exception e) { presentation = new StringRepresentation(e.getMessage() + "\n" + ExceptionUtils.getStackTrace(e)); LOGGER.error("Caught exception while processing post request", e); setStatus(Status.SERVER_ERROR_INTERNAL); } return presentation; }
From source file:com.aurel.track.persist.TDashboardParameterPeer.java
public static List getByDashboardField(Integer fieldID, Connection con) { List torqueList = new ArrayList(); Criteria crit = new Criteria(); crit.add(DASHBOARDFIELD, fieldID);//from w w w.j a v a 2s .c o m try { torqueList = doSelect(crit, con); } catch (TorqueException e) { LOGGER.debug(ExceptionUtils.getStackTrace(e)); } return torqueList; }
From source file:com.aurel.track.admin.customize.category.filter.tree.io.TreeFilterParser.java
private void parse(String xml) { //get a factory SAXParserFactory spf = SAXParserFactory.newInstance(); try {// w ww .j a va 2s. co m //get a new instance of parser SAXParser sp = spf.newSAXParser(); //parse the file and also register this class for call backs InputSource is = new InputSource(new StringReader(xml)); sp.parse(is, this); } catch (SAXException se) { LOGGER.warn("Parsing expression: " + xml + " failed with " + se.getMessage()); if (LOGGER.isDebugEnabled()) { LOGGER.debug(ExceptionUtils.getStackTrace(se)); } } catch (ParserConfigurationException pce) { LOGGER.warn("Parsing expression: " + xml + " failed with " + pce.getMessage()); if (LOGGER.isDebugEnabled()) { LOGGER.debug(ExceptionUtils.getStackTrace(pce)); } } catch (IOException ie) { LOGGER.warn("Reading expression: " + xml + " failed with " + ie.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(ie)); } }
From source file:jp.co.ipublishing.esnavi.impl.gcm.GcmIntentService.java
/** * ??/* www . j ava2 s.co m*/ * * @param extras ? */ @Override protected void onReceivedMessage(Bundle extras) { try { final String message = extras.getString("message"); final Alert alert = convertToAlert(message); // ? sendNotification(alert); // EventBus.getDefault().post(new AlertUpdatedAlertEvent(alert)); mAlertManager.storeAlert(alert).subscribe(new Subscriber<Alert>() { @Override public void onCompleted() { // Nothing to do } @Override public void onError(Throwable e) { Log.e(TAG, ExceptionUtils.getStackTrace(e)); } @Override public void onNext(Alert alert) { // Nothing to do } }); } catch (JSONException | ParseException e) { Log.e(TAG, ExceptionUtils.getStackTrace(e)); } }
From source file:ke.co.tawi.babblesms.server.persistence.geolocation.CountryDAO.java
/** * * @param name// w w w.jav a 2 s . c o m * @return network * Returns * */ @Override public Country getCountryByName(String name) { Country network = null; Connection conn = null; PreparedStatement pstmt = null; ResultSet rset = null; BeanProcessor b = new BeanProcessor(); try { conn = dbCredentials.getConnection(); pstmt = conn.prepareStatement("SELECT * FROM Country WHERE LOWER(name) like LOWER(?);"); pstmt.setString(1, "%" + name + "%"); rset = pstmt.executeQuery(); if (rset.next()) { network = b.toBean(rset, Country.class); } } catch (SQLException e) { logger.error("SQL Exception when getting network with uuid: " + name); logger.error(ExceptionUtils.getStackTrace(e)); } return network; }
From source file:com.aurel.track.fieldType.runtime.matchers.run.StringMatcherRT.java
/** * Whether the value matches or not//w ww .jav a2 s. c om * @param attributeValue * @return */ @Override public boolean match(Object attributeValue) { Boolean nullMatch = nullMatcher(attributeValue); if (nullMatch != null) { return nullMatch.booleanValue(); } if (attributeValue == null || matchValue == null) { return false; } String attributeValueString = null; String matcherValueString = null; try { attributeValueString = (String) attributeValue; } catch (Exception e) { LOGGER.warn("Converting the attribute value " + attributeValue + " of type " + attributeValue.getClass().getName() + " to String failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); return false; } try { matcherValueString = (String) matchValue; } catch (Exception e) { LOGGER.warn("Converting the matcher value " + matchValue + " of type " + matchValue.getClass().getName() + " to String failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); return false; } switch (relation) { case MatchRelations.EQUAL: return attributeValueString.equals(matcherValueString); case MatchRelations.NOT_EQUAL: return !attributeValueString.equals(matcherValueString); case MatchRelations.EQUAL_IGNORE_CASE: return attributeValueString.equalsIgnoreCase(matcherValueString); case MatchRelations.PERL_PATTERN: if (pattern == null) { try { setPattern(matcherValueString); } catch (PatternSyntaxException e) { return false; } } Matcher matcher = pattern.matcher(attributeValueString); return matcher.find(); default: return false; } }