List of usage examples for java.lang.reflect InvocationTargetException printStackTrace
public void printStackTrace(PrintStream s)
From source file:com.ibm.team.build.internal.hjplugin.RTCScm.java
@Override protected PollingResult compareRemoteRevisionWith(AbstractProject<?, ?> project, Launcher launcher, FilePath workspacePath, TaskListener listener, SCMRevisionState revisionState) throws IOException, InterruptedException { // if #requiresWorkspaceForPolling is false, expect that launcher and workspacePath are null listener.getLogger().println(Messages.RTCScm_checking_for_changes()); // check to see if there are incoming changes try {// w w w .j av a2 s . co m RTCFacadeWrapper facade = RTCFacadeFactory .getFacade(getDescriptor().getMasterBuildToolkit(getBuildTool(), listener), null); Boolean changesIncoming = (Boolean) facade.invoke("incomingChanges", //$NON-NLS-1$ new Class[] { String.class, // serverURI String.class, // userId String.class, // password File.class, // passwordFile int.class, // timeout String.class, // buildWorkspace Object.class, }, // listener getServerURI(), getUserId(), getPassword(), getPasswordFileFile(), getTimeout(), getBuildWorkspace(), listener); if (changesIncoming.equals(Boolean.TRUE)) { listener.getLogger().println(Messages.RTCScm_changes_found()); return PollingResult.SIGNIFICANT; } else { listener.getLogger().println(Messages.RTCScm_no_changes_found()); return PollingResult.NO_CHANGES; } } catch (InvocationTargetException e) { Throwable eToReport = e.getCause(); if (eToReport == null) { eToReport = e; } PrintWriter writer = listener .fatalError(Messages.RTCScm_checking_for_changes_failure(eToReport.getMessage())); eToReport.printStackTrace(writer); // if we can't check for changes then we can't build it throw new AbortException(Messages.RTCScm_checking_for_changes_failure2(eToReport.getMessage())); } catch (Exception e) { PrintWriter writer = listener.error(Messages.RTCScm_checking_for_changes_failure3(e.getMessage())); e.printStackTrace(writer); // if we can't check for changes then we can't build it throw new AbortException(Messages.RTCScm_checking_for_changes_failure3(e.getMessage())); } }
From source file:com.ibm.team.build.internal.hjplugin.RTCScm.java
@Override public boolean checkout(AbstractBuild<?, ?> build, Launcher arg1, FilePath workspacePath, BuildListener listener, File changeLogFile) throws IOException, InterruptedException { listener.getLogger().println(Messages.RTCScm_checkout_started()); File passwordFileFile = getPasswordFileFile(); String baselineSetName = getBaselineSetName(build); String localBuildToolKit;/*from w ww . j a v a2s .c o m*/ String nodeBuildToolKit; String passwordToUse = null; try { localBuildToolKit = getDescriptor().getMasterBuildToolkit(getBuildTool(), listener); nodeBuildToolKit = getDescriptor().getBuildToolkit(getBuildTool(), build.getBuiltOn(), listener); if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("checkout : " + build.getProject().getName() + " " + build.getDisplayName() + " " //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + build.getBuiltOnStr() + " Load directory=\"" + workspacePath.getRemote() + "\"" + //$NON-NLS-2$ " Build tool=\"" + getBuildTool() + "\"" + //$NON-NLS-1$ //$NON-NLS-2$ " Local Build toolkit=\"" + localBuildToolKit + "\"" + //$NON-NLS-1$ //$NON-NLS-2$ " Node Build toolkit=\"" + nodeBuildToolKit + "\"" + //$NON-NLS-1$ //$NON-NLS-2$ " Server URI=\"" + getServerURI() + "\"" + //$NON-NLS-1$ //$NON-NLS-2$ " Userid=\"" + getUserId() + "\"" + //$NON-NLS-1$ //$NON-NLS-2$ " Authenticating with " //$NON-NLS-1$ + (passwordFileFile == null ? " configured password " : passwordFileFile.getAbsolutePath()) //$NON-NLS-1$ + " Build workspace=\"" + getBuildWorkspace() + "\"" + //$NON-NLS-2$ " Baseline Set name=\"" + baselineSetName + "\""); //$NON-NLS-1$ //$NON-NLS-2$ } RTCFacadeWrapper facade = RTCFacadeFactory.getFacade(localBuildToolKit, null); passwordToUse = (String) facade.invoke("determinePassword", new Class[] { //$NON-NLS-1$ String.class, // password, File.class, // passwordFile, }, getPassword(), getPasswordFileFile()); } catch (InvocationTargetException e) { Throwable eToReport = e.getCause(); if (eToReport == null) { eToReport = e; } PrintWriter writer = listener.fatalError(Messages.RTCScm_checkout_failure(eToReport.getMessage())); eToReport.printStackTrace(writer); LOGGER.log(Level.FINER, "determinePassword had invocation failure " + eToReport.getMessage(), //$NON-NLS-1$ eToReport); // if we can't check out then we can't build it throw new AbortException(Messages.RTCScm_checkout_failure2(eToReport.getMessage())); } catch (Exception e) { PrintWriter writer = listener.fatalError(Messages.RTCScm_checkout_failure3(e.getMessage())); e.printStackTrace(writer); LOGGER.log(Level.FINER, "determinePassword failure " + e.getMessage(), e); //$NON-NLS-1$ // if we can't check out then we can't build it throw new AbortException(Messages.RTCScm_checkout_failure4(e.getMessage())); } OutputStream changeLogStream = new FileOutputStream(changeLogFile); RemoteOutputStream changeLog = new RemoteOutputStream(changeLogStream); if (workspacePath.isRemote()) { sendJarsToSlave(workspacePath); } boolean debug = Boolean.parseBoolean(build.getEnvironment(listener).get(DEBUG_PROPERTY)); RTCCheckoutTask checkout = new RTCCheckoutTask( build.getProject().getName() + " " + build.getDisplayName() + " " + build.getBuiltOnStr(), //$NON-NLS-1$ //$NON-NLS-2$ nodeBuildToolKit, getServerURI(), getUserId(), passwordToUse, getTimeout(), getBuildWorkspace(), baselineSetName, listener, changeLog, workspacePath.isRemote(), debug); workspacePath.act(checkout); return true; }