Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
90f29f8c
J
jenkins
项目概览
xxadev
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
90f29f8c
编写于
7月 23, 2015
作者:
O
Oliver Gondža
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Null safety for hudson.model.Result
上级
ed2988fc
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
19 deletion
+25
-19
core/src/main/java/hudson/model/Result.java
core/src/main/java/hudson/model/Result.java
+25
-19
未找到文件。
core/src/main/java/hudson/model/Result.java
浏览文件 @
90f29f8c
...
...
@@ -25,9 +25,11 @@ package hudson.model;
import
com.thoughtworks.xstream.converters.SingleValueConverter
;
import
com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter
;
import
hudson.cli.declarative.OptionHandlerExtension
;
import
hudson.init.Initializer
;
import
hudson.util.EditDistance
;
import
org.apache.commons.beanutils.Converter
;
import
org.kohsuke.args4j.CmdLineException
;
import
org.kohsuke.args4j.CmdLineParser
;
...
...
@@ -40,6 +42,9 @@ import java.io.Serializable;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.annotation.Nonnegative
;
import
javax.annotation.Nonnull
;
/**
* The build outcome.
*
...
...
@@ -49,42 +54,42 @@ public final class Result implements Serializable, CustomExportedBean {
/**
* The build had no errors.
*/
public
static
final
Result
SUCCESS
=
new
Result
(
"SUCCESS"
,
BallColor
.
BLUE
,
0
,
true
);
public
static
final
@Nonnull
Result
SUCCESS
=
new
Result
(
"SUCCESS"
,
BallColor
.
BLUE
,
0
,
true
);
/**
* The build had some errors but they were not fatal.
* For example, some tests failed.
*/
public
static
final
Result
UNSTABLE
=
new
Result
(
"UNSTABLE"
,
BallColor
.
YELLOW
,
1
,
true
);
public
static
final
@Nonnull
Result
UNSTABLE
=
new
Result
(
"UNSTABLE"
,
BallColor
.
YELLOW
,
1
,
true
);
/**
* The build had a fatal error.
*/
public
static
final
Result
FAILURE
=
new
Result
(
"FAILURE"
,
BallColor
.
RED
,
2
,
true
);
public
static
final
@Nonnull
Result
FAILURE
=
new
Result
(
"FAILURE"
,
BallColor
.
RED
,
2
,
true
);
/**
* The module was not built.
* <p>
* This status code is used in a multi-stage build (like maven2)
* where a problem in earlier stage prevented later stages from building.
*/
public
static
final
Result
NOT_BUILT
=
new
Result
(
"NOT_BUILT"
,
BallColor
.
NOTBUILT
,
3
,
false
);
public
static
final
@Nonnull
Result
NOT_BUILT
=
new
Result
(
"NOT_BUILT"
,
BallColor
.
NOTBUILT
,
3
,
false
);
/**
* The build was manually aborted.
*
* If you are catching {@link InterruptedException} and interpreting it as {@link #ABORTED},
* you should check {@link Executor#abortResult()} instead (starting 1.417.)
*/
public
static
final
Result
ABORTED
=
new
Result
(
"ABORTED"
,
BallColor
.
ABORTED
,
4
,
false
);
public
static
final
@Nonnull
Result
ABORTED
=
new
Result
(
"ABORTED"
,
BallColor
.
ABORTED
,
4
,
false
);
private
final
String
name
;
private
final
@Nonnull
String
name
;
/**
* Bigger numbers are worse.
*/
public
final
int
ordinal
;
public
final
@Nonnegative
int
ordinal
;
/**
* Default ball color for this status.
*/
public
final
BallColor
color
;
public
final
@Nonnull
BallColor
color
;
/**
* Is this a complete build - i.e. did it run to the end (not aborted)?
...
...
@@ -92,7 +97,7 @@ public final class Result implements Serializable, CustomExportedBean {
*/
public
final
boolean
completeBuild
;
private
Result
(
String
name
,
BallColor
color
,
int
ordinal
,
boolean
complete
)
{
private
Result
(
@Nonnull
String
name
,
@Nonnull
BallColor
color
,
@Nonnegative
int
ordinal
,
boolean
complete
)
{
this
.
name
=
name
;
this
.
color
=
color
;
this
.
ordinal
=
ordinal
;
...
...
@@ -102,26 +107,26 @@ public final class Result implements Serializable, CustomExportedBean {
/**
* Combines two {@link Result}s and returns the worse one.
*/
public
Result
combine
(
Result
that
)
{
public
@Nonnull
Result
combine
(
@Nonnull
Result
that
)
{
if
(
this
.
ordinal
<
that
.
ordinal
)
return
that
;
else
return
this
;
}
public
boolean
isWorseThan
(
Result
that
)
{
public
boolean
isWorseThan
(
@Nonnull
Result
that
)
{
return
this
.
ordinal
>
that
.
ordinal
;
}
public
boolean
isWorseOrEqualTo
(
Result
that
)
{
public
boolean
isWorseOrEqualTo
(
@Nonnull
Result
that
)
{
return
this
.
ordinal
>=
that
.
ordinal
;
}
public
boolean
isBetterThan
(
Result
that
)
{
public
boolean
isBetterThan
(
@Nonnull
Result
that
)
{
return
this
.
ordinal
<
that
.
ordinal
;
}
public
boolean
isBetterOrEqualTo
(
Result
that
)
{
public
boolean
isBetterOrEqualTo
(
@Nonnull
Result
that
)
{
return
this
.
ordinal
<=
that
.
ordinal
;
}
...
...
@@ -133,24 +138,23 @@ public final class Result implements Serializable, CustomExportedBean {
return
this
.
completeBuild
;
}
@Override
public
String
toString
()
{
public
@Nonnull
String
toString
()
{
return
name
;
}
public
String
toExportedObject
()
{
public
@Nonnull
String
toExportedObject
()
{
return
name
;
}
public
static
Result
fromString
(
String
s
)
{
public
static
@Nonnull
Result
fromString
(
@Nonnull
String
s
)
{
for
(
Result
r
:
all
)
if
(
s
.
equalsIgnoreCase
(
r
.
name
))
return
r
;
return
FAILURE
;
}
private
static
List
<
String
>
getNames
()
{
private
static
@Nonnull
List
<
String
>
getNames
()
{
List
<
String
>
l
=
new
ArrayList
<
String
>();
for
(
Result
r
:
all
)
l
.
add
(
r
.
name
);
...
...
@@ -170,10 +174,12 @@ public final class Result implements Serializable, CustomExportedBean {
private
static
final
Result
[]
all
=
new
Result
[]
{
SUCCESS
,
UNSTABLE
,
FAILURE
,
NOT_BUILT
,
ABORTED
};
public
static
final
SingleValueConverter
conv
=
new
AbstractSingleValueConverter
()
{
@Override
public
boolean
canConvert
(
Class
clazz
)
{
return
clazz
==
Result
.
class
;
}
@Override
public
Object
fromString
(
String
s
)
{
return
Result
.
fromString
(
s
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录