热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

hudson.AbortException类的使用及代码示例

本文整理了Java中hudson.AbortException类的一些代码示例,展示了AbortException类的具体用法。这些代码示例主

本文整理了Java中hudson.AbortException类的一些代码示例,展示了AbortException类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbortException类的具体详情如下:
包路径:hudson.AbortException
类名称:AbortException

AbortException介绍

[英]Signals a failure where the error was anticipated and diagnosed. When this exception is caught, the stack trace will not be printed, and the build will be marked as a failure.
[中]在预期和诊断错误时发出故障信号。捕获此异常时,将不会打印堆栈跟踪,并且生成将标记为失败。

代码示例

代码示例来源:origin: jenkinsci/jenkins

final Jenkins jenkins = Jenkins.getActiveInstance();
final HashSet hs = new HashSet<>();
hs.addAll(jobs);
job = (AbstractItem) jenkins.getItemByFullName(job_s);
job.delete();
} catch (Exception e) {
if(hs.size() == 1) {
throw e;
throw new AbortException(CLI_LISTPARAM_SUMMARY_ERROR_TEXT);

代码示例来源:origin: jenkinsci/jenkins

PrintStream log = taskListener.getLogger();
"Launcher {0}'s afterDisconnect method propagated an exception when {1}'s connection was closed: {2}");
lr.setThrown(t);
lr.setParameters(new Object[]{launcher, SlaveComputer.this.getName(), t.getMessage()});
logger.log(lr);
log.println("WARNING: "+remoteFS
+" looks suspiciously like Windows path. Maybe you meant "+remoteFS.replace('\\','/')+"?");
FilePath root = new FilePath(channel,remoteFS);
Jenkins.get().getQueue().scheduleMaintenance();

代码示例来源:origin: jenkinsci/jenkins

protected int run() throws Exception {
Jenkins h = Jenkins.getActiveInstance();
h.checkPermission(PluginManager.UPLOAD_PLUGINS);
PluginManager pm = h.getPluginManager();
FilePath f = new FilePath(channel, source);
if (f.exists()) {
stdout.println(Messages.InstallPluginCommand_InstallingPluginFromLocalFile(f));
String n = name != null ? name : f.getBaseName();
f.copyTo(getTargetFilePath(n));
if (dynamicLoad)
Throwable e = p.deploy(dynamicLoad).get().getError();
if (e!=null) {
AbortException myException = new AbortException("Failed to install plugin " + source);
myException.initCause(e);
throw myException;
stdout.println(Messages.InstallPluginCommand_NoUpdateCenterDefined());
} else {
Set candidates = new HashSet<>();
for (UpdateSite s : h.getUpdateCenter().getSites()) {
Data dt = s.getData();
throw new AbortException("Error occurred, see previous output.");

代码示例来源:origin: jenkinsci/jenkins

final Jenkins jenkins = Jenkins.getActiveInstance();
final HashSet hs = new HashSet<>();
hs.addAll(nodes);
node = jenkins.getNode(node_s);
node.toComputer().doDoDelete();
} catch (Exception e) {
if(hs.size() == 1) {
throw e;
throw new AbortException(CLI_LISTPARAM_SUMMARY_ERROR_TEXT);

代码示例来源:origin: jenkinsci/jenkins

@Override
protected int run() throws Exception {
boolean errorOccurred = false;
final Jenkins jenkins = Jenkins.getActiveInstance();
final HashSet hs = new HashSet<>();
hs.addAll(nodes);
computer = jenkins.getComputer(node_s);
computer.cliConnect(force);
} catch (Exception e) {
if (hs.size() == 1) {
throw e;
throw new AbortException(CLI_LISTPARAM_SUMMARY_ERROR_TEXT);

代码示例来源:origin: jenkinsci/jenkins

@Override
protected int run() throws Exception {
boolean errorOccurred = false;
final Jenkins jenkins = Jenkins.getActiveInstance();
final HashSet hs = new HashSet<>();
hs.addAll(nodes);
computer = jenkins.getComputer(node_s);
computer.cliDisconnect(cause);
} catch (Exception e) {
if (hs.size() == 1) {
throw e;
throw new AbortException(CLI_LISTPARAM_SUMMARY_ERROR_TEXT);

代码示例来源:origin: jenkinsci/jenkins

@Override
protected int run() throws Exception {
boolean errorOccurred = false;
final Jenkins jenkins = Jenkins.getActiveInstance();
final HashSet hs = new HashSet<>(nodes);
List names = null;
computer = jenkins.getComputer(node_s);
if (computer == null) {
if (names == null) {
hudson.model.Messages.Computer_NoSuchSlaveExists(node_s, adv));
computer.cliOnline();
} catch (Exception e) {
if (hs.size() == 1) {
throw e;
throw new AbortException(CLI_LISTPARAM_SUMMARY_ERROR_TEXT);

代码示例来源:origin: jenkinsci/jenkins

@Override
protected int run() throws Exception {
boolean errorOccurred = false;
final Jenkins jenkins = Jenkins.get();
final HashSet hs = new HashSet<>(nodes);
List names = null;
Computer computer = jenkins.getComputer(node_s);
if (computer == null) {
if (names == null) {
hudson.model.Messages.Computer_NoSuchSlaveExists(node_s, adv));
computer.cliOffline(cause);
} catch (Exception e) {
if (hs.size() == 1) {
throw e;
throw new AbortException(CLI_LISTPARAM_SUMMARY_ERROR_TEXT);

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

@Override
protected int run() throws Exception {
boolean errorOccurred = false;
final Jenkins jenkins = Jenkins.getInstance();
final HashSet hs = new HashSet(nodes);
List names = null;
Computer computer = jenkins.getComputer(node_s);
if (computer == null) {
if (names == null) {
hudson.model.Messages.Computer_NoSuchSlaveExists(node_s, adv));
computer.cliOffline(cause);
} catch (Exception e) {
if (hs.size() == 1) {
throw e;
throw new AbortException(CLI_LISTPARAM_SUMMARY_ERROR_TEXT);

代码示例来源:origin: jenkinsci/workflow-cps-plugin

Node node = Jenkins.get();
if (build.getParent() instanceof TopLevelItem) {
dir = new FilePath(owner.getRootDir());
listener.getLogger().println("Checking out " + scm.getKey() + " into " + dir + " to read " + expandedScriptPath);
String script = null;
Computer computer = node.toComputer();
delegate.setChangelog(true);
FilePath acquiredDir;
try (WorkspaceList.Lease lease = computer.getWorkspaceList().acquire(dir)) {
for (int retryCount = Jenkins.get().getScmCheckoutRetryCount(); retryCount >= 0; retryCount--) {
try {
delegate.checkout(build, dir, listener, node.createLauncher(listener));
if (e.getMessage() != null) {
listener.error(e.getMessage());
throw new AbortException("Maximum checkout retry attempts reached, aborting");
FilePath scriptFile = dir.child(expandedScriptPath);
if (!scriptFile.absolutize().getRemote().replace('\\', '/').startsWith(dir.absolutize().getRemote().replace('\\', '/') + '/')) { // TODO JENKINS-26838
throw new IOException(scriptFile + " is not inside " + dir);
throw new AbortException(scriptFile + " not found");

代码示例来源:origin: org.jenkins-ci.plugins.workflow/workflow-cps-global-lib

FilePath libDir = new FilePath(execution.getOwner().getRootDir()).child("libs/" + name);
retriever.retrieve(name, version, changelog, libDir, run, listener);
for (String root : new String[] {"src", "vars"}) {
String rel = root + "/" + clazz.replace('.', '/') + ".groovy";
FilePath f = libDir.child(rel);
if (f.exists()) {
String replacement = ReplayAction.replace(execution, clazz);
if (replacement != null) {
listener.getLogger().println("Replacing contents of " + rel);
f.write(replacement, null); // TODO as below, unsure of encoding used by Groovy compiler
throw new AbortException("Library " + name + " expected to contain at least one of src or vars directories");

代码示例来源:origin: jenkinsci/mercurial-plugin

private void update(Run build, Launcher launcher, FilePath repository, Node node, TaskListener listener, String toRevision, StandardUsernameCredentials credentials)
throws IOException, InterruptedException {
HgExe hg = new HgExe(findInstallation(getInstallation()), credentials, launcher, node, listener, build.getEnvironment(listener));
EnvVars env = build.getEnvironment(listener);
try {
int pullExitCode;
throw new AbortException("Failed to pull");
listener.error("Failed to pull");
throw new AbortException("Failed to pull");
listener.error("Failed to update");
e.printStackTrace(listener.getLogger());
throw new AbortException("Failed to update");
listener.error("Failed to update");
throw new AbortException("Failed to update");
if (build.getNumber() % 100 == 0) {
CachedRepo cachedSource = cachedSource(node, env, launcher, listener, true, credentials);
if (cachedSource != null && !cachedSource.isUseSharing()) {
if (hg.cleanAll().pwd(repository).join() != 0) {
listener.error("Failed to clean unversioned files");
throw new AbortException("Failed to clean unversioned files");

代码示例来源:origin: jenkinsci/nunit-plugin

@Override
public void perform(@Nonnull Run run, @Nonnull FilePath ws, @Nonnull Launcher launcher, @Nonnull TaskListener listener) throws InterruptedException, IOException {
if (debug) {
listener.getLogger().println("NUnit publisher running in debug mode.");
EnvVars env = run.getEnvironment(listener);
String resolvedTestResultsPattern = env.expand(testResultsPattern);
listener.getLogger().println("Recording NUnit tests results");
NUnitArchiver transformer = new NUnitArchiver(ws.getRemote(), listener, resolvedTestResultsPattern, new NUnitReportTransformer(), failIfNoResults);
result = ws.act(transformer);
listener.getLogger().println("Skipping feeding JUnit reports to JUnitArchiver");
} else {
listener.getLogger().println("Skipping deletion of temporary JUnit reports.");
} else {
ws.child(NUnitArchiver.JUNIT_REPORTS_PATH).deleteRecursive();
run.setResult(Result.FAILURE);
} catch (IOException e) {
listener.getLogger().println("Error in NUnit processing: " + e.getMessage());
throw new AbortException("Could not read the XSL XML file. Please report this issue to the plugin author");

代码示例来源:origin: org.jenkins-ci.plugins.workflow/workflow-job

@SuppressFBWarnings(value="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE", justification="TODO 1.653+ switch to Jenkins.getInstanceOrNull")
@Override public PollingResult poll(TaskListener listener) {
if (!isBuildable()) {
listener.getLogger().println("Build disabled");
return PollingResult.NO_CHANGES;
listener.getLogger().println("no previous build to compare to");
for (WorkflowRun.SCMCheckout co : perhapsCompleteBuild.checkouts(listener)) {
if (!co.scm.supportsPolling()) {
listener.getLogger().println("polling not supported from " + co.workspace + " on " + co.node);
continue;
Computer c = j.getComputer(co.node);
if (c == null) {
listener.error("no such computer " + co.node);
continue;
workspace = new FilePath(c.getChannel(), co.workspace);
launcher = workspace.createLauncher(listener).decorateByEnv(getEnvironment(c.getNode(), listener));
lease = c.getWorkspaceList().acquire(workspace, !isConcurrentBuild());
} else {
workspace = null;
listener.error("polling failed in " + co.workspace + " on " + co.node + ": " + x.getMessage());
} catch (Exception x) {
listener.error("polling failed in " + co.workspace + " on " + co.node).println(Functions.printThrowable(x).trim()); // TODO 2.43+ use Functions.printStackTrace

代码示例来源:origin: jenkinsci/jenkins

@Override
public void perform(Run build, FilePath ws, Launcher launcher, TaskListener listener) throws IOException, InterruptedException {
if(artifacts.length()==0) {
throw new AbortException(Messages.ArtifactArchiver_NoIncludes());
Result result = build.getResult();
if (onlyIfSuccessful && result != null && result.isWorseThan(Result.UNSTABLE)) {
listener.getLogger().println(Messages.ArtifactArchiver_SkipBecauseOnlyIfSuccessful());
return;
listener.getLogger().println(Messages.ArtifactArchiver_ARCHIVING_ARTIFACTS());
try {
String artifacts = build.getEnvironment(listener).expand(this.artifacts);
Map files = ws.act(new ListFiles(artifacts, excludes, defaultExcludes, caseSensitive));
if (!files.isEmpty()) {
build.pickArtifactManager().archive(ws, launcher, BuildListenerAdapter.wrap(listener), files);
if (fingerprint) {
new Fingerprinter(artifacts).perform(build, ws, launcher, listener);
listener.getLogger().println(Messages.ArtifactArchiver_NoMatchFound(artifacts));
} else {
throw new AbortException(Messages.ArtifactArchiver_NoMatchFound(artifacts));
throw new AbortException(e.toString()); // Message is not enough as that is the filename only

代码示例来源:origin: org.jenkins-ci.plugins/ssh-slaves

/**
* Makes sure that SSH connection won't produce any unwanted text, which will interfere with sftp execution.
*/
private void verifyNoHeaderJunk(TaskListener listener) throws IOException, InterruptedException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
connection.exec("true",baos);
final String s;
//TODO: Seems we need to retrieve the encoding from the connection destination
try {
s = baos.toString(Charset.defaultCharset().name());
} catch (UnsupportedEncodingException ex) { // Should not happen
throw new IOException("Default encoding is unsupported", ex);
}

if (s.length()!=0) {
listener.getLogger().println(Messages.SSHLauncher_SSHHeaderJunkDetected());
listener.getLogger().println(s);
throw new AbortException();
}
}

代码示例来源:origin: jenkinsci/mercurial-plugin

TaskListener listener, SCMRevisionState _baseline) throws IOException, InterruptedException {
final Jenkins jenkins = Jenkins.getInstance();
if (jenkins == null) {
throw new IOException("Jenkins instance is not ready");
PrintStream output = listener.getLogger();
EnvVars env = project.getEnvironment(jenkins, listener);
StandardUsernameCredentials credentials = getCredentials(project, env);
launcher = jenkins.createLauncher(listener);
CachedRepo possiblyCachedRepo = cachedSource(Jenkins.getInstance(), env, launcher, listener, true, credentials);
if (possiblyCachedRepo == null) {
throw new IOException("Could not use cache to poll for changes. See error messages above for more details");
FilePath repositoryCache = new FilePath(new File(possiblyCachedRepo.getRepoLocation()));
return compare(launcher, listener, baseline, output, jenkins, repositoryCache, project);
} catch(IOException e) {
if (causedByMissingHg(e)) {
listener.error(Messages.MercurialSCM_failed_to_compare_with_remote_repository());
throw new AbortException("Failed to compare with remote repository");

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

@Override
public void perform(Run build, FilePath ws, Launcher launcher, TaskListener listener) throws InterruptedException, AbortException {
if(artifacts.length()==0) {
listener.error(Messages.ArtifactArchiver_NoIncludes());
build.setResult(Result.FAILURE);
return;
Result result = build.getResult();
if (onlyIfSuccessful && result != null && result.isWorseThan(Result.UNSTABLE)) {
listener.getLogger().println(Messages.ArtifactArchiver_SkipBecauseOnlyIfSuccessful());
return;
listener.getLogger().println(Messages.ArtifactArchiver_ARCHIVING_ARTIFACTS());
try {
String artifacts = build.getEnvironment(listener).expand(this.artifacts);
Map files = ws.act(new ListFiles(artifacts, excludes, defaultExcludes, caseSensitive));
if (!files.isEmpty()) {
build.pickArtifactManager().archive(ws, launcher, BuildListenerAdapter.wrap(listener), files);
String msg = null;
try {
msg = ws.validateAntFileMask(artifacts, FilePath.VALIDATE_ANT_FILE_MASK_BOUND, caseSensitive);
} catch (Exception e) {
listenerWarnOrError(listener, e.getMessage());
throw new AbortException(e.toString()); // Message is not enough as that is the filename only
} catch (IOException e) {
Util.displayIOException(e,listener);

代码示例来源:origin: jenkinsci/external-workspace-manager-plugin

ExternalWorkspace exws = step.getExternalWorkspace();
if (exws == null) {
throw new AbortException("No external workspace provided. Did you run the exwsAllocate step?");
Node node = computer.getNode();
if (node == null) {
throw new Exception("The node is not live due to some unexpected conditions: the node might have been taken offline, or may have been removed");
NodeDiskPool nodeDiskPool;
listener.getLogger().println("Searching for disk definitions in the External Workspace Templates from Jenkins global config");
Template template = findTemplate(node.getLabelString(), step.getDescriptor().getTemplates());
if (nodeDiskPool == null) {
String message = format("No Disk Pool Ref ID matching '%s' was found in the External Workspace Template config labeled '%s'", diskPoolId, template.getLabel());
throw new AbortException(message);
listener.getLogger().println("Searching for disk definitions in the Node config");
ExternalWorkspaceProperty exwsNodeProperty = findNodeProperty(node);
if (nodeDiskPool == null) {
String message = format("No Disk Pool Ref ID matching '%s' was found in Node '%s' config", diskPoolId, node.getDisplayName());
throw new AbortException(message);
FilePath diskFilePath = new FilePath(node.getChannel(), nodeDisk.getNodeMountPoint());
FilePath workspace = diskFilePath.child(exws.getPathOnDisk());

代码示例来源:origin: jenkinsci/junit-plugin

public static TestResultAction parseAndAttach(@Nonnull JUnitTask task, PipelineTestDetails pipelineTestDetails,
Run build, FilePath workspace, Launcher launcher, TaskListener listener)
throws InterruptedException, IOException {
listener.getLogger().println(Messages.JUnitResultArchiver_Recording());
final String testResults = build.getEnvironment(listener).expand(task.getTestResults());
TestResultAction action = build.getAction(TestResultAction.class);
boolean appending;
if (action == null) {
if (build.getResult() == Result.FAILURE) {
listener.getLogger().println(Messages.JUnitResultArchiver_ResultIsEmpty());
return null;
throw new AbortException(Messages.JUnitResultArchiver_ResultIsEmpty());

推荐阅读
  • Java容器中的compareto方法排序原理解析
    本文从源码解析Java容器中的compareto方法的排序原理,讲解了在使用数组存储数据时的限制以及存储效率的问题。同时提到了Redis的五大数据结构和list、set等知识点,回忆了作者大学时代的Java学习经历。文章以作者做的思维导图作为目录,展示了整个讲解过程。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • XML介绍与使用的概述及标签规则
    本文介绍了XML的基本概念和用途,包括XML的可扩展性和标签的自定义特性。同时还详细解释了XML标签的规则,包括标签的尖括号和合法标识符的组成,标签必须成对出现的原则以及特殊标签的使用方法。通过本文的阅读,读者可以对XML的基本知识有一个全面的了解。 ... [详细]
  • 如何自行分析定位SAP BSP错误
    The“BSPtag”Imentionedintheblogtitlemeansforexamplethetagchtmlb:configCelleratorbelowwhichi ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • 开发笔记:加密&json&StringIO模块&BytesIO模块
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了加密&json&StringIO模块&BytesIO模块相关的知识,希望对你有一定的参考价值。一、加密加密 ... [详细]
  • 目录实现效果:实现环境实现方法一:基本思路主要代码JavaScript代码总结方法二主要代码总结方法三基本思路主要代码JavaScriptHTML总结实 ... [详细]
  • JavaSE笔试题-接口、抽象类、多态等问题解答
    本文解答了JavaSE笔试题中关于接口、抽象类、多态等问题。包括Math类的取整数方法、接口是否可继承、抽象类是否可实现接口、抽象类是否可继承具体类、抽象类中是否可以有静态main方法等问题。同时介绍了面向对象的特征,以及Java中实现多态的机制。 ... [详细]
  • Android JSON基础,音视频开发进阶指南目录
    Array里面的对象数据是有序的,json字符串最外层是方括号的,方括号:[]解析jsonArray代码try{json字符串最外层是 ... [详细]
  • 自动轮播,反转播放的ViewPagerAdapter的使用方法和效果展示
    本文介绍了如何使用自动轮播、反转播放的ViewPagerAdapter,并展示了其效果。该ViewPagerAdapter支持无限循环、触摸暂停、切换缩放等功能。同时提供了使用GIF.gif的示例和github地址。通过LoopFragmentPagerAdapter类的getActualCount、getActualItem和getActualPagerTitle方法可以实现自定义的循环效果和标题展示。 ... [详细]
  • Java太阳系小游戏分析和源码详解
    本文介绍了一个基于Java的太阳系小游戏的分析和源码详解。通过对面向对象的知识的学习和实践,作者实现了太阳系各行星绕太阳转的效果。文章详细介绍了游戏的设计思路和源码结构,包括工具类、常量、图片加载、面板等。通过这个小游戏的制作,读者可以巩固和应用所学的知识,如类的继承、方法的重载与重写、多态和封装等。 ... [详细]
  • 在Docker中,将主机目录挂载到容器中作为volume使用时,常常会遇到文件权限问题。这是因为容器内外的UID不同所导致的。本文介绍了解决这个问题的方法,包括使用gosu和suexec工具以及在Dockerfile中配置volume的权限。通过这些方法,可以避免在使用Docker时出现无写权限的情况。 ... [详细]
  • 本文分享了一个关于在C#中使用异步代码的问题,作者在控制台中运行时代码正常工作,但在Windows窗体中却无法正常工作。作者尝试搜索局域网上的主机,但在窗体中计数器没有减少。文章提供了相关的代码和解决思路。 ... [详细]
  • 本文介绍了OC学习笔记中的@property和@synthesize,包括属性的定义和合成的使用方法。通过示例代码详细讲解了@property和@synthesize的作用和用法。 ... [详细]
author-avatar
赵博钧石博
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有