List of usage examples for java.lang StackTraceElement toString
public String toString()
From source file:net.anotheria.moskito.webui.producers.action.ShowProducerAction.java
private void inspectProducer(HttpServletRequest req, ProducerAO producer) { if (!(producer.isInspectable())) return;//from ww w .j a va 2s . c o m CreationInfo cInfo = producer.getCreationInfo(); req.setAttribute("creationTimestamp", cInfo.getTimestamp()); req.setAttribute("creationTime", NumberUtils.makeISO8601TimestampString(cInfo.getTimestamp())); List<String> stackTraceList = new ArrayList<String>(cInfo.getStackTrace().length); for (StackTraceElement elem : cInfo.getStackTrace()) stackTraceList.add(elem.toString()); req.setAttribute("creationTrace", stackTraceList); }
From source file:org.openhab.binding.denonmarantz.internal.connector.http.DenonMarantzHttpConnector.java
/** * Set up the connection to the receiver by starting to poll the HTTP API. *//*from w w w .j a v a 2s. c o m*/ @Override public void connect() { if (!isPolling()) { logger.debug("HTTP polling started."); try { setConfigProperties(); } catch (IOException e) { logger.debug("IO error while retrieving document:", e); state.connectionError("IO error while connecting to AVR: " + e.getMessage()); return; } pollingJob = scheduler.scheduleWithFixedDelay(() -> { try { refreshHttpProperties(); } catch (IOException e) { logger.debug("IO error while retrieving document: {}", e); state.connectionError("IO error while connecting to AVR: " + e.getMessage()); stopPolling(); } catch (RuntimeException e) { /** * We need to catch this RuntimeException, as otherwise the polling stops. * Log as error as it could be a user configuration error. */ StringBuilder sb = new StringBuilder(); for (StackTraceElement s : e.getStackTrace()) { sb.append(s.toString()).append("\n"); } logger.error("Error while polling Http: \"{}\". Stacktrace: \n{}", e.getMessage(), sb.toString()); } }, 0, config.httpPollingInterval, TimeUnit.SECONDS); } }
From source file:com.nextep.designer.core.dao.impl.IdentifiableDAO.java
/** * Displays 4 call stack elements when debugging */// w ww . j a v a 2 s .c o m private void debugStack() { if (Designer.isDebugging()) { StackTraceElement[] stack = Thread.currentThread().getStackTrace(); int i = 0; for (StackTraceElement e : stack) { log.debug(" " + e.toString()); if (i++ >= 10) { break; } } } }
From source file:org.wso2.carbon.logging.service.provider.InMemoryLogProvider.java
private String getStacktrace(Throwable e) { StringBuilder stackTrace = new StringBuilder(); StackTraceElement[] stackTraceElements = e.getStackTrace(); for (StackTraceElement ele : stackTraceElements) { stackTrace.append(ele.toString()).append("\n"); }//from w w w .j a v a 2 s . com return stackTrace.toString(); }
From source file:net.scran24.user.server.services.HelpServiceImpl.java
@Override public void reportUncaughtException(String strongName, List<String> classNames, List<String> messages, List<StackTraceElement[]> stackTraces, String surveyState) { Subject subject = SecurityUtils.getSubject(); ScranUserId userId = (ScranUserId) subject.getPrincipal(); if (userId == null) throw new RuntimeException("User must be logged in"); String rateKey = userId.survey + "#" + userId.username; RateInfo rateInfo = rateMap.get(rateKey); boolean rateExceeded = false; long time = System.currentTimeMillis(); if (rateInfo == null) { rateMap.put(rateKey, new RateInfo(1, time)); } else {/*from w w w . j av a2s. c om*/ long timeSinceLastRequest = time - rateInfo.lastRequestTime; if (timeSinceLastRequest > 10000) { rateMap.put(rateKey, new RateInfo(1, time)); } else if (rateInfo.requestCount >= 10) { rateExceeded = true; } else { rateMap.put(rateKey, new RateInfo(rateInfo.requestCount + 1, time)); } } if (!rateExceeded) { System.out.println(String.format("Sending email", userId.survey, userId.username)); Email email = new SimpleEmail(); email.setHostName(smtpHostName); email.setSmtpPort(smtpPort); email.setCharset(EmailConstants.UTF_8); email.setAuthenticator(new DefaultAuthenticator(smtpUserName, smtpPassword)); email.setSSLOnConnect(true); StringBuilder sb = new StringBuilder(); for (int i = 0; i < classNames.size(); i++) { sb.append(String.format("%s: %s\n", classNames.get(i), messages.get(i))); StackTraceElement[] deobfStackTrace = deobfuscator.resymbolize(stackTraces.get(i), strongName); for (StackTraceElement ste : deobfStackTrace) { sb.append(String.format(" %s\n", ste.toString())); } sb.append("\n"); } sb.append("Survey state:\n"); sb.append(surveyState); sb.append("\n"); try { email.setFrom("no-reply@intake24.co.uk", "Intake24"); email.setSubject(String.format("Client exception (%s/%s): %s", userId.survey, userId.username, messages.get(0))); email.setMsg(sb.toString()); email.addTo("bugs@intake24.co.uk"); email.send(); } catch (EmailException ee) { log.error("Failed to send e-mail notification", ee); } } }
From source file:org.eclipse.swt.examples.watchdog.TimedEventWatchdog.java
/** * If the duration of any single event was longer than a client's duration threshold, this * callback is invoked after the event completes and before {@link #endEvent}. If the event * completed faster than the threshold, this callback is not invoked. * <p>/*from w w w.j a v a 2 s . co m*/ * When an event at depth > 0 is longer than a client's threshold, the enclosing event will * also be longer and will be reported separately as the call stack unwinds. * <p> * This example simply logs stack traces for off-line analysis. * <p> * Example output: * <pre> * !ENTRY org.eclipse.swt.examples.watchdog 1 0 2013-05-20 11:43:59.253 * !MESSAGE Event #217-#217: 250ms from 11:43:59.002 [depth = 1, max = 1] * Trace 11:43:59.150 (+148.0ms) * org.eclipse.swt.examples.watchdog.WatchdogPlugin.longExample(WatchdogPlugin.java:68) * org.eclipse.swt.examples.watchdog.WatchdogPlugin$1.run(WatchdogPlugin.java:62) * org.eclipse.swt.widgets.Synchronizer.instrumentedRun(Synchronizer.java:247) * org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:223) * org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150) * org.eclipse.swt.widgets.Display.syncExec(Display.java:4491) * org.eclipse.swt.examples.watchdog.WatchdogPlugin$2.run(WatchdogPlugin.java:78) * ... 27 more * </pre> * @param event captured information about the long event */ public void onLongEvent(LongEventInfo event) { grabStackAt = Long.MAX_VALUE; // Linearization point StackTrace trace = stackTrace; stackTrace = null; if (trace != null) { String msg = String.format(EVENT_STR_FORMAT, event.startingSequenceNumber, event.endingSequenceNumber, event.duration, TIME_FORMAT.format(new Date(event.start)), event.depth, event.maxDepth); StringBuilder str = new StringBuilder(msg); str.append('\n'); str.append('\t').append("Trace ").append(TIME_FORMAT.format(trace.captureTime)); // Calculate when the stack trace happened relative to the start of the dispatch. double deltaTimeFromEventStart = trace.captureTime.getTime() - event.start; String unit = "ms"; if (deltaTimeFromEventStart > 1000.0) { deltaTimeFromEventStart /= 1000.0; unit = "s"; } deltaTimeFromEventStart = Math.round(deltaTimeFromEventStart * 10.0) / 10.0; str.append(" (+").append(deltaTimeFromEventStart).append(unit).append(')').append('\n'); final String displayClassName = Display.class.getName(); final String syncClassName = Synchronizer.class.getName(); int numPrinted = 0; int maxToPrint = -1; for (StackTraceElement e : trace.stack) { str.append('\t').append('\t').append(e.toString()).append('\n'); ++numPrinted; // Limit number of stack elements printed to reasonable size if (traceElementIs(e, displayClassName, "readAndDispatch")) { maxToPrint = 0; } else if (traceElementIs(e, displayClassName, "syncExec")) { maxToPrint = 3; } else if (traceElementIs(e, syncClassName, "syncExec")) { maxToPrint = 3; } if (maxToPrint == 0) { str.append('\t').append('\t').append("... ").append(trace.stack.length - numPrinted) .append(" more").append('\n'); break; } else if (maxToPrint > 0) { maxToPrint--; } } WatchdogPlugin.getDefault().getLog().log(new Status(IStatus.INFO, WatchdogPlugin.getDefault().getBundle().getSymbolicName(), str.toString())); } }
From source file:com.mtomczak.nausicaa.MainActivity.java
private void establishConnection() { try {//w w w . j av a 2 s.c o m Log.i("Nausicaa", "Establishing connection to " + telemachusAddress.getPath()); alert("Establishing connection to " + telemachusAddress.getPath()); URI uri = new URI("ws://" + telemachusAddress.getPath() + "/datalink"); telemachus.establishConnection(uri, // message handler new OutputInterface() { @Override public void output(String msg) { if (msg.equals("{}")) { alert("((Awaiting data...))"); } else { try { final JSONObject telemetry = (JSONObject) (new JSONTokener(msg).nextValue()); // Doctor telemetry with state values of the app itself telemetry.put(StatusView.TIME_WARP_KEY, timeWarpHalt.getEnabled()); runOnUiThread(new Runnable() { @Override public void run() { for (TelemetryViewer viewer : telemetryViewers) { viewer.update(telemetry); } try { for (StateNotifier notifier : notifiers) { notifier.check(telemetry); } } catch (JSONException e) { Log.e("Nausicaa", e.toString()); String trace = ""; for (StackTraceElement el : e.getStackTrace()) { trace += el.toString(); } Log.e("Nausicaa", trace); alert("<<PARSE ERROR>>"); } } }); } catch (JSONException e) { Log.e("Nausicaa", e.toString()); String trace = ""; for (StackTraceElement el : e.getStackTrace()) { trace += el.toString(); } Log.e("Nausicaa", trace); alert("<<PARSE ERROR>>"); } } } }, // close handler new OutputInterface() { @Override public void output(String msg) { alert(msg); } }, // error handler new OutputInterface() { @Override public void output(String msg) { alert(msg); } }); } catch (final URISyntaxException e) { alert("Error:\n" + e.toString()); } }
From source file:edu.uiowa.icts.bluebutton.controller.LabResultSynonymController.java
@ResponseBody @RequestMapping(value = "datatable", produces = "application/json") public DataTable datatable(HttpServletRequest request, @RequestParam(value = "length", required = false) Integer limit, @RequestParam(value = "start", required = false) Integer start, @RequestParam(value = "draw", required = false) String draw, @RequestParam(value = "search[regex]", required = false, defaultValue = "false") Boolean searchRegularExpression, @RequestParam(value = "search[value]", required = false) String search, @RequestParam(value = "columnCount", required = false, defaultValue = "0") Integer columnCount, @RequestParam(value = "individualSearch", required = false, defaultValue = "false") Boolean individualSearch, @RequestParam(value = "display", required = false, defaultValue = "list") String display) { String contextPath = request.getContextPath(); List<DataTableHeader> headers = new ArrayList<DataTableHeader>(); for (int i = 0; i < columnCount; i++) { DataTableHeader dth = new DataTableHeader(); dth.setData(request.getParameter("columns[" + i + "][data]")); dth.setName(request.getParameter("columns[" + i + "][name]")); dth.setOrderable(Boolean.valueOf(request.getParameter("columns[" + i + "][orderable]"))); dth.setSearchable(Boolean.valueOf(request.getParameter("columns[" + i + "][searchable]"))); dth.setSearchValue(request.getParameter("columns[" + i + "][search][value]")); dth.setSearchRegex(Boolean.valueOf(request.getParameter("columns[" + i + "][search][regex]"))); headers.add(dth);//from ww w .j av a 2 s. co m } ArrayList<SortColumn> sorts = new ArrayList<SortColumn>(); DataTable dt = new DataTable(); try { for (int i = 0; i < columnCount; i++) { Integer columnIndex = null; String columnIndexString = request.getParameter("order[" + i + "][column]"); if (columnIndexString != null) { try { columnIndex = Integer.parseInt(columnIndexString); } catch (NumberFormatException e) { continue; } if (columnIndex != null) { sorts.add(new SortColumn(headers.get(columnIndex).getName(), request.getParameter("order[" + i + "][dir]"))); } } } GenericDaoListOptions options = new GenericDaoListOptions(); if (!individualSearch) { ArrayList<String> searchColumns = new ArrayList<String>(); for (int i = 0; i < columnCount; i++) { if (headers.get(i).getSearchable()) { searchColumns.add(headers.get(i).getName()); } } options.setSearch(search); options.setSearchColumns(searchColumns); } else { Map<String, List<Object>> likes = new HashMap<String, List<Object>>(); for (DataTableHeader header : headers) { if (header.getSearchable() && header.getSearchValue() != null) { List<Object> values = new ArrayList<Object>(); for (String splitColumnValue : StringUtils.split(header.getSearchValue().trim(), ' ')) { values.add(splitColumnValue.trim()); } likes.put(header.getName(), values); } } options.setLikes(likes); } Integer count = bluebuttonDaoService.getLabResultSynonymService().count(options); options.setLimit(limit); options.setStart(start); options.setSorts(sorts); List<LabResultSynonym> labResultSynonymList = bluebuttonDaoService.getLabResultSynonymService() .list(options); List<LinkedHashMap<String, Object>> data = new ArrayList<LinkedHashMap<String, Object>>(); for (LabResultSynonym labResultSynonym : labResultSynonymList) { LinkedHashMap<String, Object> tableRow = new LinkedHashMap<String, Object>(); for (DataTableHeader header : headers) { String headerName = header.getName(); String dataName = header.getData(); if (StringUtils.equals("labResultSynonymId", headerName)) { tableRow.put(dataName, labResultSynonym.getLabResultSynonymId()); } else if (StringUtils.equals("officialName", headerName)) { tableRow.put(dataName, labResultSynonym.getOfficialName()); } else if (StringUtils.equals("unofficialName", headerName)) { tableRow.put(dataName, labResultSynonym.getUnofficialName()); } else if (StringUtils.equals("panel", headerName)) { tableRow.put(dataName, labResultSynonym.getPanel()); } else if (StringUtils.equals("urls", headerName)) { String urls = ""; if (StringUtils.equals("list", display)) { urls += "<a href=\"" + contextPath + "/labresultsynonym/show?" + "labResultSynonymId=" + labResultSynonym.getLabResultSynonymId() + "\"><span class=\"glyphicon glyphicon-eye-open\"></a>"; urls += "<a href=\"" + contextPath + "/labresultsynonym/edit?" + "labResultSynonymId=" + labResultSynonym.getLabResultSynonymId() + "\"><span class=\"glyphicon glyphicon-pencil\"></a>"; urls += "<a href=\"" + contextPath + "/labresultsynonym/delete?" + "labResultSynonymId=" + labResultSynonym.getLabResultSynonymId() + "\"><span class=\"glyphicon glyphicon-trash\"></a>"; } else { } tableRow.put(dataName, urls); } else { tableRow.put("error", "[error: column " + headerName + " not supported]"); } } data.add(tableRow); } dt.setDraw(draw); dt.setRecordsFiltered(count); dt.setRecordsTotal(count); dt.setData(data); } catch (Exception e) { log.error("error builing datatable json object for LabResultSynonym", e); String stackTrace = e.getMessage() + String.valueOf('\n'); for (StackTraceElement ste : e.getStackTrace()) { stackTrace += ste.toString() + String.valueOf('\n'); } DataTable error = new DataTable(); error.setDraw(draw); error.setRecordsFiltered(0); error.setRecordsTotal(0); error.setError(stackTrace); return error; } return dt; }
From source file:edu.uiowa.icts.bluebutton.controller.LabTestRangeController.java
@ResponseBody @RequestMapping(value = "datatable", produces = "application/json") public String datatable(HttpServletRequest request, @RequestParam(value = "length", required = false) Integer limit, @RequestParam(value = "start", required = false) Integer start, @RequestParam(value = "draw", required = false) String draw, @RequestParam(value = "search[regex]", required = false, defaultValue = "false") Boolean searchRegularExpression, @RequestParam(value = "search[value]", required = false) String search, @RequestParam(value = "columnCount", required = false, defaultValue = "0") Integer columnCount, @RequestParam(value = "individualSearch", required = false, defaultValue = "false") Boolean individualSearch, @RequestParam(value = "display", required = false, defaultValue = "list") String display) { List<DataTableHeader> headers = new ArrayList<DataTableHeader>(); for (int i = 0; i < columnCount; i++) { DataTableHeader dth = new DataTableHeader(); dth.setData(request.getParameter("columns[" + i + "][data]")); dth.setName(request.getParameter("columns[" + i + "][name]")); dth.setOrderable(Boolean.valueOf(request.getParameter("columns[" + i + "][orderable]"))); dth.setSearchable(Boolean.valueOf(request.getParameter("columns[" + i + "][searchable]"))); dth.setSearchValue(request.getParameter("columns[" + i + "][search][value]")); dth.setSearchRegex(Boolean.valueOf(request.getParameter("columns[" + i + "][search][regex]"))); headers.add(dth);/*w w w . java2 s.c o m*/ } ArrayList<SortColumn> sorts = new ArrayList<SortColumn>(); JSONObject ob = new JSONObject(); try { for (int i = 0; i < columnCount; i++) { Integer columnIndex = null; String columnIndexString = request.getParameter("order[" + i + "][column]"); if (columnIndexString != null) { try { columnIndex = Integer.parseInt(columnIndexString); } catch (NumberFormatException e) { continue; } if (columnIndex != null) { sorts.add(new SortColumn(headers.get(columnIndex).getName(), request.getParameter("order[" + i + "][dir]"))); } } } GenericDaoListOptions options = new GenericDaoListOptions(); if (!individualSearch) { ArrayList<String> searchColumns = new ArrayList<String>(); for (int i = 0; i < columnCount; i++) { if (headers.get(i).getSearchable()) { searchColumns.add(headers.get(i).getName()); } } options.setSearch(search); options.setSearchColumns(searchColumns); } else { Map<String, Object> likes = new HashMap<String, Object>(); for (DataTableHeader header : headers) { if (header.getSearchable() && header.getSearchValue() != null) { for (String splitColumnValue : StringUtils.split(header.getSearchValue().trim(), ' ')) { likes.put(header.getName(), splitColumnValue); } } } options.setIndividualLikes(likes); } Integer count = bluebuttonDaoService.getLabTestRangeService().count(options); options.setLimit(limit); options.setStart(start); options.setSorts(sorts); List<LabTestRange> labTestRangeList = bluebuttonDaoService.getLabTestRangeService().list(options); ob.put("draw", draw); ob.put("recordsFiltered", count); ob.put("recordsTotal", count); JSONArray jsonArray = new JSONArray(); for (LabTestRange labTestRange : labTestRangeList) { JSONArray tableRow = new JSONArray(); for (DataTableHeader header : headers) { String headerName = header.getName(); if (StringUtils.equals("labTestRangeId", headerName)) { tableRow.put(labTestRange.getLabTestRangeId()); } else if (StringUtils.equals("sex", headerName)) { tableRow.put(labTestRange.getSex()); } else if (StringUtils.equals("minAgeYears", headerName)) { tableRow.put(labTestRange.getMinAgeYears()); } else if (StringUtils.equals("maxAgeYears", headerName)) { tableRow.put(labTestRange.getMaxAgeYears()); } else if (StringUtils.equals("minNormal", headerName)) { tableRow.put(labTestRange.getMinNormal()); } else if (StringUtils.equals("maxNormal", headerName)) { tableRow.put(labTestRange.getMaxNormal()); } else if (StringUtils.equals("labTest", headerName)) { tableRow.put(labTestRange.getLabTest().getName()); } else if (StringUtils.equals("urls", headerName)) { String urls = ""; if (StringUtils.equals("list", display)) { urls += "<a href=\"show?" + "labTestRangeId=" + labTestRange.getLabTestRangeId() + "\"><span class=\"glyphicon glyphicon-eye-open\"></a>"; //urls += "<a href=\"edit?"+"labTestRangeId="+labTestRange.getLabTestRangeId()+"\"><span class=\"glyphicon glyphicon-pencil\"></a>"; urls += "<a href=\"delete?" + "labTestRangeId=" + labTestRange.getLabTestRangeId() + "\"><span class=\"glyphicon glyphicon-trash\"></a>"; } else { } tableRow.put(urls); } else { tableRow.put("[error: column " + headerName + " not supported]"); } } jsonArray.put(tableRow); } ob.put("data", jsonArray); } catch (Exception e) { log.error("error builing datatable json object for LabTestRange", e); try { String stackTrace = e.getMessage() + String.valueOf('\n'); for (StackTraceElement ste : e.getStackTrace()) { stackTrace += ste.toString() + String.valueOf('\n'); } ob = new JSONObject(); ob.put("draw", draw); ob.put("recordsFiltered", 0); ob.put("recordsTotal", 0); ob.put("error", stackTrace); } catch (JSONException je) { log.error("error building json error object for LabTestRange", je); } } return ob.toString(); }
From source file:edu.uiowa.icts.bluebutton.controller.LoincCodeCategoryController.java
@ResponseBody @RequestMapping(value = "datatable", produces = "application/json") public String datatable(HttpServletRequest request, @RequestParam(value = "length", required = false) Integer limit, @RequestParam(value = "start", required = false) Integer start, @RequestParam(value = "draw", required = false) String draw, @RequestParam(value = "search[regex]", required = false, defaultValue = "false") Boolean searchRegularExpression, @RequestParam(value = "search[value]", required = false) String search, @RequestParam(value = "columnCount", required = false, defaultValue = "0") Integer columnCount, @RequestParam(value = "individualSearch", required = false, defaultValue = "false") Boolean individualSearch, @RequestParam(value = "display", required = false, defaultValue = "list") String display) { List<DataTableHeader> headers = new ArrayList<DataTableHeader>(); for (int i = 0; i < columnCount; i++) { DataTableHeader dth = new DataTableHeader(); dth.setData(request.getParameter("columns[" + i + "][data]")); dth.setName(request.getParameter("columns[" + i + "][name]")); dth.setOrderable(Boolean.valueOf(request.getParameter("columns[" + i + "][orderable]"))); dth.setSearchable(Boolean.valueOf(request.getParameter("columns[" + i + "][searchable]"))); dth.setSearchValue(request.getParameter("columns[" + i + "][search][value]")); dth.setSearchRegex(Boolean.valueOf(request.getParameter("columns[" + i + "][search][regex]"))); headers.add(dth);//from w w w .j av a2 s . c o m } ArrayList<SortColumn> sorts = new ArrayList<SortColumn>(); JSONObject ob = new JSONObject(); try { for (int i = 0; i < columnCount; i++) { Integer columnIndex = null; String columnIndexString = request.getParameter("order[" + i + "][column]"); if (columnIndexString != null) { try { columnIndex = Integer.parseInt(columnIndexString); } catch (NumberFormatException e) { continue; } if (columnIndex != null) { sorts.add(new SortColumn(headers.get(columnIndex).getName(), request.getParameter("order[" + i + "][dir]"))); } } } GenericDaoListOptions options = new GenericDaoListOptions(); if (!individualSearch) { ArrayList<String> searchColumns = new ArrayList<String>(); for (int i = 0; i < columnCount; i++) { if (headers.get(i).getSearchable()) { searchColumns.add(headers.get(i).getName()); } } options.setSearch(search); options.setSearchColumns(searchColumns); } else { Map<String, List<Object>> likes = new HashMap<String, List<Object>>(); for (DataTableHeader header : headers) { if (header.getSearchable() && header.getSearchValue() != null) { List<Object> values = new ArrayList<Object>(); for (String splitColumnValue : StringUtils.split(header.getSearchValue().trim(), ' ')) { values.add(splitColumnValue.trim()); } likes.put(header.getName(), values); } } options.setLikes(likes); } Integer count = bluebuttonDaoService.getLoincCodeCategoryService().count(options); options.setLimit(limit); options.setStart(start); options.setSorts(sorts); List<LoincCodeCategory> loincCodeCategoryList = bluebuttonDaoService.getLoincCodeCategoryService() .list(options); ob.put("draw", draw); ob.put("recordsFiltered", count); ob.put("recordsTotal", count); JSONArray jsonArray = new JSONArray(); for (LoincCodeCategory loincCodeCategory : loincCodeCategoryList) { JSONArray tableRow = new JSONArray(); for (DataTableHeader header : headers) { String headerName = header.getName(); if (StringUtils.equals("id", headerName)) { tableRow.put(loincCodeCategory.getId()); } else if (StringUtils.equals("loincCode", headerName)) { tableRow.put(loincCodeCategory.getLoincCode()); } else if (StringUtils.equals("name", headerName)) { tableRow.put(loincCodeCategory.getName()); } else if (StringUtils.equals("rootCategoryName", headerName)) { tableRow.put(loincCodeCategory.getRootCategoryName()); } else if (StringUtils.equals("subrootCategoryName", headerName)) { tableRow.put(loincCodeCategory.getSubrootCategoryName()); } else if (StringUtils.equals("urls", headerName)) { String urls = ""; if (StringUtils.equals("list", display)) { urls += "<a href=\"show?" + "id=" + loincCodeCategory.getId() + "\"><span class=\"glyphicon glyphicon-eye-open\"></a>"; urls += "<a href=\"edit?" + "id=" + loincCodeCategory.getId() + "\"><span class=\"glyphicon glyphicon-pencil\"></a>"; urls += "<a href=\"delete?" + "id=" + loincCodeCategory.getId() + "\"><span class=\"glyphicon glyphicon-trash\"></a>"; } else { } tableRow.put(urls); } else { tableRow.put("[error: column " + headerName + " not supported]"); } } jsonArray.put(tableRow); } ob.put("data", jsonArray); } catch (Exception e) { log.error("error builing datatable json object for LoincCodeCategory", e); try { String stackTrace = e.getMessage() + String.valueOf('\n'); for (StackTraceElement ste : e.getStackTrace()) { stackTrace += ste.toString() + String.valueOf('\n'); } JSONObject error = new JSONObject(); error.put("draw", draw); error.put("recordsFiltered", 0); error.put("recordsTotal", 0); error.put("error", stackTrace); return error.toString(); } catch (JSONException je) { log.error("error building json error object for LoincCodeCategory", je); } } return ob.toString(); }