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.fieldType.runtime.matchers.run.IntegerBasedBooleanMatcherRT.java
/** * Whether the value matches or not//from w ww.jav a 2 s . c om * @param attributeValue * @return */ public boolean match(Object attributeValue) { if (attributeValue == null) { attributeValue = new Integer(0); } Integer attributeValueInteger = null; try { attributeValueInteger = (Integer) attributeValue; } catch (Exception e) { LOGGER.warn("Converting the attribute value " + attributeValue + " of type " + attributeValue.getClass().getName() + " to Integer failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); return false; } switch (relation) { case MatchRelations.SET: return TWorkItemBean.ACCESS_LEVEL_PRIVATE.equals(attributeValueInteger.intValue()); case MatchRelations.RESET: return !TWorkItemBean.ACCESS_LEVEL_PRIVATE.equals(attributeValueInteger.intValue()); default: return false; } }
From source file:com.twosigma.beaker.core.rest.PublishRest.java
@POST @Path("github") @Produces(MediaType.APPLICATION_JSON)/*from w w w . ja v a 2 s . co m*/ public String notebook(@FormParam("json") String json, @FormParam("type") String type) throws IOException, ClientProtocolException { String files = "{\"Beaker Share\":{\"content\":\"" + JSONObject.escape(json) + "\"}}"; String body = "{\"description\":\"Beaker Share\",\"public\":true,\"files\":" + files + "}\n"; String response = null; try { response = Request.Post(this.gistUrl).useExpectContinue().version(HttpVersion.HTTP_1_1) .bodyString(body, ContentType.APPLICATION_JSON).execute().returnContent().asString(); } catch (Throwable t) { throw new GistPublishException(ExceptionUtils.getStackTrace(t)); } JSONObject parsed = (JSONObject) JSONValue.parse(response); String githubUrl = (String) parsed.get("html_url"); int slash = githubUrl.lastIndexOf("/"); if (slash < 0) { System.err.println("no slash found in github url: " + githubUrl); return githubUrl; } return this.sharingUrl + githubUrl.substring(slash); }
From source file:com.aurel.track.fieldType.runtime.matchers.converter.BooleanMatcherConverter.java
/** * Convert the xml string to object value after load * @param value/*from ww w . j a v a2 s .com*/ * @param matcherRelation * @return */ @Override public Object fromXMLString(String value, Integer matcherRelation) { if (value == null || value.trim().length() == 0) { return null; } else { try { return Boolean.valueOf(value); } catch (Exception e) { LOGGER.warn("Converting the " + value + " to Boolean failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); return Boolean.FALSE; } } }
From source file:com.aurel.track.persist.TCardFieldPeer.java
@Override public TCardFieldBean loadByPrimaryKey(Integer objectID) { TCardField tobject = null;/*from w w w . ja v a 2 s.c o m*/ try { tobject = retrieveByPK(objectID); } catch (Exception e) { LOGGER.info("Loading of a cardField 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.persist.TBasketPeer.java
/** * Loads a basketBean by primary key //from w w w. j a v a 2s . co m * @param objectID * @return */ @Override public TBasketBean loadByPrimaryKey(Integer objectID) { TBasket tBasket = null; try { tBasket = retrieveByPK(objectID); } catch (Exception e) { LOGGER.warn("Loading the basket by primary key " + objectID + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (tBasket != null) { return tBasket.getBean(); } return null; }
From source file:com.aurel.track.lucene.index.associatedFields.textExctractor.PdfExtractor.java
/** * Gets the text from file content // ww w . ja v a2 s . c om * @param file * @param fileExtension * @return */ @Override public String getText(File file, String fileExtension) { FileInputStream fis = null; PDDocument pdDoc = null; StringWriter stringWriter = null; try { fis = new FileInputStream(file); PDFParser parser = new PDFParser(fis); parser.parse(); pdDoc = parser.getPDDocument(); PDFTextStripper stripper = new PDFTextStripper(); stripper.setLineSeparator("\n"); stringWriter = new StringWriter(); stripper.writeText(pdDoc, stringWriter); return stringWriter.toString(); } catch (Exception e) { if (LOGGER.isDebugEnabled()) { LOGGER.debug( "Extracting text from the .pdf file " + file.getName() + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } finally { try { if (stringWriter != null) { stringWriter.close(); } } catch (Exception e) { } try { if (pdDoc != null) { pdDoc.close(); } } catch (Exception e) { LOGGER.info("Closing pdDoc for " + file + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } try { if (fis != null) { fis.close(); } } catch (Exception e) { LOGGER.info("Closing the FileInputStream for " + file + " failed with " + e.getMessage()); } } return null; }
From source file:jp.co.ipublishing.esnavi.impl.alert.AlertClient.java
@NonNull @Override/*from ww w. j a v a 2s . co m*/ public Observable<Alert> downloadAlert() { return Observable.create(new Observable.OnSubscribe<Alert>() { @Override public void call(Subscriber<? super Alert> subscriber) { final ApiMethod apiMethod = mApi.downloadAlert(); try { final Request request = new Request.Builder().url(apiMethod.getUrl()).get().build(); final Response response = mClient.newCall(request).execute(); final String result = response.body().string(); final Alert alert = AlertFactory.create(result); subscriber.onNext(alert); subscriber.onCompleted(); } catch (IOException | JSONException | ParseException e) { Log.e(TAG, ExceptionUtils.getStackTrace(e)); subscriber.onError(e); } } }); }
From source file:com.aurel.track.persist.TScreenPanelPeer.java
/** * Loads the screenPanel by primary key/*ww w. j av a 2s. c om*/ * @param objectID * @return */ @Override public TScreenPanelBean loadByPrimaryKey(Integer objectID) { TScreenPanel tobject = null; try { tobject = retrieveByPK(objectID); } catch (Exception e) { LOGGER.warn("Loading of a screenPanel 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.exchange.docx.exporter.ImageUtil.java
static int addAttachments(WordprocessingMLPackage wordMLPackage, List<TAttachmentBean> attachmentBeanList, Integer workItemID, String captionStyleId, int id, Locale locale) { if (attachmentBeanList != null) { for (TAttachmentBean attachmentBean : attachmentBeanList) { Integer attachmentID = attachmentBean.getObjectID(); boolean isImage = AttachBL.isImage(attachmentBean); if (isImage) { String realNameWithPath = AttachBL.getFullFileName(null, attachmentBean.getObjectID(), workItemID);// w ww . j av a2 s . c om String originalFilename = attachmentBean.getFileName(); try { addImage(wordMLPackage, realNameWithPath, originalFilename, attachmentBean.getDescription(), attachmentID, captionStyleId, id, locale); id = id + 1; } catch (Exception e) { LOGGER.warn("Adding the file " + originalFilename + " for item " + workItemID + " and attachmentID " + attachmentID + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } } } return id; }
From source file:com.aurel.track.persist.TWorkflowDefPeer.java
/** * Loads the screen by primary key/*from w w w . jav a 2 s . com*/ * @param objectID * @return */ @Override public TWorkflowDefBean loadByPrimaryKey(Integer objectID) { TWorkflowDef tobject = null; try { tobject = retrieveByPK(objectID); } catch (Exception e) { LOGGER.warn("Loading of a workflow by primary key " + objectID + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (tobject != null) { return tobject.getBean(); } return null; }