List of usage examples for java.io PrintWriter toString
public String toString()
From source file:jenkins.plugins.coverity.CoverityUtils.java
/** * getCovBuild/*w w w .j av a 2 s.com*/ * * Retrieves the location of cov-build executable/sh from the system and returns the string of the * path * @return string of cov-build's path */ public static String getCovBuild(TaskListener listener, Node node) { AbstractBuild build = getBuild(); AbstractProject project = build.getProject(); CoverityPublisher publisher = (CoverityPublisher) project.getPublishersList().get(CoverityPublisher.class); InvocationAssistance invocationAssistance = publisher.getInvocationAssistance(); if (listener == null) { try { throw new Exception("Listener used by getCovBuild() is null."); } catch (Exception e) { e.printStackTrace(); return null; } } String covBuild = "cov-build"; String home = null; try { home = publisher.getDescriptor().getHome(node, build.getEnvironment(listener)); } catch (Exception e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); listener.getLogger().println("[Error] " + pw.toString()); e.printStackTrace(); } if (invocationAssistance != null) { if (invocationAssistance.getSaOverride() != null) { try { home = new CoverityInstallation(invocationAssistance.getSaOverride()) .forEnvironment(build.getEnvironment(listener)).getHome(); CoverityUtils.checkDir(node.getChannel(), home); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } } if (home != null) { covBuild = new FilePath(node.getChannel(), home).child("bin").child(covBuild).getRemote(); } return covBuild; }
From source file:be.solidx.hot.web.deprecated.HotControllerImpl.java
protected String extractStackTrace(Exception e) { StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); e.printStackTrace(printWriter);/*from ww w . j a v a 2 s. c om*/ printWriter.flush(); return printWriter.toString(); }
From source file:com.taobao.adfs.database.tdhsocket.client.response.TDHSResponse.java
public String getErrorMessage() { try {/*from w w w. j a v a 2 s . c om*/ return "status=" + getStatus() + ", errorCode=" + getErrorCode() + ", dbErrorCode=" + getDbErrorCode(); } catch (TDHSException e) { PrintWriter pw = new PrintWriter(new StringWriter()); e.printStackTrace(pw); return "TDHSResponse parse failed!\n" + pw.toString(); } }
From source file:com.taobao.adfs.database.tdhsocket.client.response.TDHSResponse.java
@Override public String toString() { try {//from w w w. ja v a 2 s.c o m return "TDHSResponse{" + "status=" + getStatus() + ", errorCode=" + getErrorCode() + ", dbErrorCode=" + getDbErrorCode() + ", fieldNumber=" + getFieldNumber() + ", fieldTypes=" + getFieldTypes() + ", fieldData=" + getFieldData() + '}'; } catch (TDHSException e) { PrintWriter pw = new PrintWriter(new StringWriter()); e.printStackTrace(pw); return "TDHSResponse parse failed!\n" + pw.toString(); } }
From source file:com.taobao.tdhs.client.response.TDHSResponse.java
/** * Method getErrorMessage returns the errorMessage of this TDHSResponse object. * * @return the errorMessage (type String) of this TDHSResponse object. */// w ww .j a v a 2 s . c om public String getErrorMessage() { try { return "status=" + getStatus() + ", errorCode=" + getErrorCode() + ", dbErrorCode=" + getDbErrorCode() + ", MySQLHandlerErrorCode=" + getMySQLHandlerErrorCode(); } catch (TDHSException e) { PrintWriter pw = new PrintWriter(new StringWriter()); e.printStackTrace(pw); return "TDHSResponse parse failed!\n" + pw.toString(); } }
From source file:com.taobao.tdhs.client.response.TDHSResponse.java
/** * Method toString .../* ww w. j av a2s . co m*/ * * @return String */ @Override public String toString() { try { return "TDHSResponse{" + "status=" + getStatus() + ", errorCode=" + getErrorCode() + ", dbErrorCode=" + getDbErrorCode() + ", MySQLHandlerErrorCode=" + getMySQLHandlerErrorCode() + ", fieldNumber=" + getFieldNumber() + ", fieldTypes=" + getFieldTypes() + ", fieldData=" + getFieldData() + '}'; } catch (TDHSException e) { PrintWriter pw = new PrintWriter(new StringWriter()); e.printStackTrace(pw); return "TDHSResponse parse failed!\n" + pw.toString(); } }
From source file:com.adobe.acs.tools.test_page_generator.impl.Parameters.java
public final String toString() { StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); printWriter.println("Template: " + this.getTemplate()); printWriter.println("Total Pages to Create: " + this.getTotal()); printWriter.println("Bucket Size: " + this.getBucketSize()); printWriter.println("Bucket Type: " + this.getBucketType()); printWriter.println("Save Threshold: " + this.getSaveThreshold()); return printWriter.toString(); }
From source file:id.ac.idu.webui.logging.loginlog.SecLoginlogStatisticCtrl.java
public void onCreate$windowTabPanelLoginStatistic(Event event) throws Exception { /**/*from w ww .java 2s. com*/ * Calculate how many rows have been place in the listbox. Get the * currentDesktopHeight from a hidden Intbox from the index.zul that are * filled by onClientInfo() in the indexCtroller */ final int height = ((Intbox) Path.getComponent("/outerIndexWindow/currentDesktopHeight")).getValue() .intValue(); this.maxPanelHeight = height - 140; this.maxlistBoxHeight = this.maxPanelHeight - 25; this.panelSecLoginLogStatistikCenter.setHeight(String.valueOf(this.maxPanelHeight) + "px"); final Calendar aDate = Calendar.getInstance(); aDate.setTime(new Date()); final int currentYear = aDate.get(Calendar.YEAR); final int currentMonth = aDate.get(Calendar.MONTH); try { // boxSecLoginLogStatistikCenter.appendChild(doGetTotalCountByCountries()); } catch (final Exception e) { final StringWriter sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); ZksampleMessageUtils.showErrorMessage(pw.toString()); Logger.getLogger(getClass()).error("", e); } this.boxSecLoginLogStatistikCenter.appendChild(doGetTotalCountByCountries()); this.boxSecLoginLogStatistikCenter.appendChild(doGetMonthlyCountByCountries(currentMonth, currentYear)); this.boxSecLoginLogStatistikCenter.appendChild(doGetDailyCountByCountries(new Date())); }
From source file:org.apache.asterix.api.http.servlet.QueryServiceServlet.java
private static void printError(PrintWriter pw, Throwable e) { Throwable rootCause = ResultUtil.getRootCause(e); if (rootCause == null) { rootCause = e;/*w ww . j a v a 2 s . c o m*/ } final boolean addStack = false; pw.print("\t\""); pw.print(ResultFields.ERRORS.str()); pw.print("\": [{ \n"); printField(pw, ErrorField.CODE.str(), "1"); final String msg = rootCause.getMessage(); printField(pw, ErrorField.MSG.str(), JSONUtil.escape(msg != null ? msg : rootCause.getClass().getSimpleName()), addStack); if (addStack) { StringWriter sw = new StringWriter(); PrintWriter stackWriter = new PrintWriter(sw); LOGGER.info(stackWriter.toString()); stackWriter.close(); printField(pw, ErrorField.STACK.str(), JSONUtil.escape(sw.toString()), false); } pw.print("\t}],\n"); }
From source file:org.codice.ddf.registry.federationadmin.service.impl.FederationAdminServiceImpl.java
private String stringifyProcessingErrors(Set<ProcessingDetails> details) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); for (ProcessingDetails detail : details) { pw.append(detail.getSourceId()); pw.append(":"); if (detail.hasException()) { detail.getException().printStackTrace(pw); }//from w w w.j a va2 s .co m pw.append(System.lineSeparator()); } return pw.toString(); }