Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
a3cc7780
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,发现更多精彩内容 >>
提交
a3cc7780
编写于
9月 21, 2018
作者:
O
Oleg Nenashev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
JDK11 support: refactor code to avoid underscore variable names
上级
5b8d41e6
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
42 addition
and
42 deletion
+42
-42
core/src/main/java/hudson/ClassicPluginStrategy.java
core/src/main/java/hudson/ClassicPluginStrategy.java
+1
-1
core/src/main/java/hudson/FilePath.java
core/src/main/java/hudson/FilePath.java
+2
-2
core/src/main/java/hudson/PluginManager.java
core/src/main/java/hudson/PluginManager.java
+1
-1
core/src/main/java/hudson/cli/handlers/GenericItemOptionHandler.java
...in/java/hudson/cli/handlers/GenericItemOptionHandler.java
+1
-1
core/src/main/java/hudson/model/Fingerprint.java
core/src/main/java/hudson/model/Fingerprint.java
+2
-2
core/src/main/java/hudson/model/ListView.java
core/src/main/java/hudson/model/ListView.java
+2
-2
core/src/main/java/hudson/model/UpdateCenter.java
core/src/main/java/hudson/model/UpdateCenter.java
+1
-1
core/src/main/java/hudson/model/queue/Executables.java
core/src/main/java/hudson/model/queue/Executables.java
+1
-1
core/src/main/java/hudson/os/solaris/ZFSInstaller.java
core/src/main/java/hudson/os/solaris/ZFSInstaller.java
+1
-1
core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java
...main/java/hudson/security/HudsonPrivateSecurityRealm.java
+4
-4
core/src/main/java/hudson/tasks/BuildTrigger.java
core/src/main/java/hudson/tasks/BuildTrigger.java
+1
-1
core/src/main/java/hudson/util/ProcessTree.java
core/src/main/java/hudson/util/ProcessTree.java
+6
-6
core/src/main/java/jenkins/model/Jenkins.java
core/src/main/java/jenkins/model/Jenkins.java
+1
-1
core/src/main/java/jenkins/slaves/restarter/JnlpSlaveRestarterInstaller.java
...jenkins/slaves/restarter/JnlpSlaveRestarterInstaller.java
+1
-1
core/src/main/java/jenkins/triggers/ReverseBuildTrigger.java
core/src/main/java/jenkins/triggers/ReverseBuildTrigger.java
+2
-2
test/src/test/java/hudson/PluginManagerTest.java
test/src/test/java/hudson/PluginManagerTest.java
+3
-3
test/src/test/java/hudson/cli/ComputerStateTest.java
test/src/test/java/hudson/cli/ComputerStateTest.java
+1
-1
test/src/test/java/hudson/model/FingerprintTest.java
test/src/test/java/hudson/model/FingerprintTest.java
+8
-8
test/src/test/java/hudson/model/ListViewTest.java
test/src/test/java/hudson/model/ListViewTest.java
+1
-1
test/src/test/java/hudson/search/SearchTest.java
test/src/test/java/hudson/search/SearchTest.java
+1
-1
test/src/test/java/jenkins/security/ApiTokenPropertyTest.java
.../src/test/java/jenkins/security/ApiTokenPropertyTest.java
+1
-1
未找到文件。
core/src/main/java/hudson/ClassicPluginStrategy.java
浏览文件 @
a3cc7780
...
...
@@ -788,7 +788,7 @@ public class ClassicPluginStrategy implements PluginStrategy {
if
(
p
!=
null
)
try
{
return
p
.
classLoader
.
loadClass
(
name
);
}
catch
(
ClassNotFoundException
_
)
{
}
catch
(
ClassNotFoundException
ex
)
{
// try next
}
}
...
...
core/src/main/java/hudson/FilePath.java
浏览文件 @
a3cc7780
...
...
@@ -2309,7 +2309,7 @@ public final class FilePath implements Serializable {
// legacy agent.jar. Handle this gracefully
try
{
LOGGER
.
log
(
Level
.
WARNING
,
"Looks like an old agent.jar. Please update "
+
Which
.
jarFile
(
Channel
.
class
)+
" to the new version"
,
e
);
}
catch
(
IOException
_
)
{
}
catch
(
IOException
ex
)
{
// really ignore this time
}
}
...
...
@@ -2427,7 +2427,7 @@ public final class FilePath implements Serializable {
// report both errors
e
.
addSuppressed
(
x
);
throw
e
;
}
catch
(
TimeoutException
_
)
{
}
catch
(
TimeoutException
ex
)
{
// remote is hanging
throw
e
;
}
...
...
core/src/main/java/hudson/PluginManager.java
浏览文件 @
a3cc7780
...
...
@@ -1493,7 +1493,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
}
updateCenter
.
persistInstallStatus
();
if
(!
failures
)
{
try
(
ACLContext
_
=
ACL
.
as
(
currentAuth
))
{
try
(
ACLContext
acl
=
ACL
.
as
(
currentAuth
))
{
InstallUtil
.
proceedToNextStateFrom
(
InstallState
.
INITIAL_PLUGINS_INSTALLING
);
}
}
...
...
core/src/main/java/hudson/cli/handlers/GenericItemOptionHandler.java
浏览文件 @
a3cc7780
...
...
@@ -62,7 +62,7 @@ public abstract class GenericItemOptionHandler<T extends Item> extends OptionHan
T
s
=
j
.
getItemByFullName
(
src
,
type
());
if
(
s
==
null
)
{
final
Authentication
who
=
Jenkins
.
getAuthentication
();
try
(
ACLContext
_
=
ACL
.
as
(
ACL
.
SYSTEM
))
{
try
(
ACLContext
acl
=
ACL
.
as
(
ACL
.
SYSTEM
))
{
Item
actual
=
j
.
getItemByFullName
(
src
);
if
(
actual
==
null
)
{
LOGGER
.
log
(
Level
.
FINE
,
"really no item exists named {0}"
,
src
);
...
...
core/src/main/java/hudson/model/Fingerprint.java
浏览文件 @
a3cc7780
...
...
@@ -822,7 +822,7 @@ public class Fingerprint implements ModelObject, Saveable {
public
static
final
class
ProjectRenameListener
extends
ItemListener
{
@Override
public
void
onLocationChanged
(
final
Item
item
,
final
String
oldName
,
final
String
newName
)
{
try
(
ACLContext
_
=
ACL
.
as
(
ACL
.
SYSTEM
))
{
try
(
ACLContext
acl
=
ACL
.
as
(
ACL
.
SYSTEM
))
{
locationChanged
(
item
,
oldName
,
newName
);
}
}
...
...
@@ -1438,7 +1438,7 @@ public class Fingerprint implements ModelObject, Saveable {
// Probably it failed due to the missing Item.DISCOVER
// We try to retrieve the job using SYSTEM user and to check permissions manually.
final
Authentication
userAuth
=
Jenkins
.
getAuthentication
();
try
(
ACLContext
_
=
ACL
.
as
(
ACL
.
SYSTEM
))
{
try
(
ACLContext
acl
=
ACL
.
as
(
ACL
.
SYSTEM
))
{
final
Item
itemBySystemUser
=
jenkins
.
getItemByFullName
(
fullName
);
if
(
itemBySystemUser
==
null
)
{
return
false
;
...
...
core/src/main/java/hudson/model/ListView.java
浏览文件 @
a3cc7780
...
...
@@ -518,7 +518,7 @@ public class ListView extends View implements DirectlyModifiableView {
public
static
final
class
Listener
extends
ItemListener
{
@Override
public
void
onLocationChanged
(
final
Item
item
,
final
String
oldFullName
,
final
String
newFullName
)
{
try
(
ACLContext
_
=
ACL
.
as
(
ACL
.
SYSTEM
))
{
try
(
ACLContext
acl
=
ACL
.
as
(
ACL
.
SYSTEM
))
{
locationChanged
(
oldFullName
,
newFullName
);
}
}
...
...
@@ -563,7 +563,7 @@ public class ListView extends View implements DirectlyModifiableView {
@Override
public
void
onDeleted
(
final
Item
item
)
{
try
(
ACLContext
_
=
ACL
.
as
(
ACL
.
SYSTEM
))
{
try
(
ACLContext
acl
=
ACL
.
as
(
ACL
.
SYSTEM
))
{
deleted
(
item
);
}
}
...
...
core/src/main/java/hudson/model/UpdateCenter.java
浏览文件 @
a3cc7780
...
...
@@ -1401,7 +1401,7 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
status
=
new
Running
();
try
{
// safeRestart records the current authentication for the log, so set it to the managing user
try
(
ACLContext
_
=
ACL
.
as
(
User
.
get
(
authentication
,
false
,
Collections
.
emptyMap
())))
{
try
(
ACLContext
acl
=
ACL
.
as
(
User
.
get
(
authentication
,
false
,
Collections
.
emptyMap
())))
{
Jenkins
.
getInstance
().
safeRestart
();
}
}
catch
(
RestartNotSupportedException
exception
)
{
...
...
core/src/main/java/hudson/model/queue/Executables.java
浏览文件 @
a3cc7780
...
...
@@ -46,7 +46,7 @@ public class Executables {
throws
Error
,
RuntimeException
{
try
{
return
e
.
getParent
();
}
catch
(
AbstractMethodError
_
)
{
}
catch
(
AbstractMethodError
ex
)
{
try
{
Method
m
=
e
.
getClass
().
getMethod
(
"getParent"
);
m
.
setAccessible
(
true
);
...
...
core/src/main/java/hudson/os/solaris/ZFSInstaller.java
浏览文件 @
a3cc7780
...
...
@@ -219,7 +219,7 @@ public class ZFSInstaller extends AdministrativeMonitor implements Serializable
// revert the file system creation
try
{
hudson
.
destory
();
}
catch
(
Exception
_
)
{
}
catch
(
Exception
ex
)
{
// but ignore the error and let the original error thrown
}
throw
e
;
...
...
core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java
浏览文件 @
a3cc7780
...
...
@@ -739,11 +739,11 @@ public class HudsonPrivateSecurityRealm extends AbstractPasswordBasedSecurityRea
/*package*/
static
final
PasswordEncoder
CLASSIC
=
new
PasswordEncoder
()
{
private
final
PasswordEncoder
passwordEncoder
=
new
ShaPasswordEncoder
(
256
);
public
String
encodePassword
(
String
rawPass
,
Object
_
)
throws
DataAccessException
{
public
String
encodePassword
(
String
rawPass
,
Object
obj
)
throws
DataAccessException
{
return
hash
(
rawPass
);
}
public
boolean
isPasswordValid
(
String
encPass
,
String
rawPass
,
Object
_
)
throws
DataAccessException
{
public
boolean
isPasswordValid
(
String
encPass
,
String
rawPass
,
Object
obj
)
throws
DataAccessException
{
// pull out the sale from the encoded password
int
i
=
encPass
.
indexOf
(
':'
);
if
(
i
<
0
)
return
false
;
...
...
@@ -779,11 +779,11 @@ public class HudsonPrivateSecurityRealm extends AbstractPasswordBasedSecurityRea
* {@link PasswordEncoder} that uses jBCrypt.
*/
private
static
final
PasswordEncoder
JBCRYPT_ENCODER
=
new
PasswordEncoder
()
{
public
String
encodePassword
(
String
rawPass
,
Object
_
)
throws
DataAccessException
{
public
String
encodePassword
(
String
rawPass
,
Object
obj
)
throws
DataAccessException
{
return
BCrypt
.
hashpw
(
rawPass
,
BCrypt
.
gensalt
());
}
public
boolean
isPasswordValid
(
String
encPass
,
String
rawPass
,
Object
_
)
throws
DataAccessException
{
public
boolean
isPasswordValid
(
String
encPass
,
String
rawPass
,
Object
obj
)
throws
DataAccessException
{
return
BCrypt
.
checkpw
(
rawPass
,
encPass
);
}
};
...
...
core/src/main/java/hudson/tasks/BuildTrigger.java
浏览文件 @
a3cc7780
...
...
@@ -431,7 +431,7 @@ public class BuildTrigger extends Recorder implements DependencyDeclarer {
public
static
class
ItemListenerImpl
extends
ItemListener
{
@Override
public
void
onLocationChanged
(
final
Item
item
,
final
String
oldFullName
,
final
String
newFullName
)
{
try
(
ACLContext
_
=
ACL
.
as
(
ACL
.
SYSTEM
))
{
try
(
ACLContext
acl
=
ACL
.
as
(
ACL
.
SYSTEM
))
{
locationChanged
(
item
,
oldFullName
,
newFullName
);
}
}
...
...
core/src/main/java/hudson/util/ProcessTree.java
浏览文件 @
a3cc7780
...
...
@@ -1253,18 +1253,18 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
kinfo_proc_ppid_offset
=
kinfo_proc_ppid_offset_32
;
}
try
{
IntByReference
_
=
new
IntByReference
(
sizeOfInt
);
IntByReference
ref
=
new
IntByReference
(
sizeOfInt
);
IntByReference
size
=
new
IntByReference
(
sizeOfInt
);
Memory
m
;
int
nRetry
=
0
;
while
(
true
)
{
// find out how much memory we need to do this
if
(
LIBC
.
sysctl
(
MIB_PROC_ALL
,
3
,
NULL
,
size
,
NULL
,
_
)!=
0
)
if
(
LIBC
.
sysctl
(
MIB_PROC_ALL
,
3
,
NULL
,
size
,
NULL
,
ref
)!=
0
)
throw
new
IOException
(
"Failed to obtain memory requirement: "
+
LIBC
.
strerror
(
Native
.
getLastError
()));
// now try the real call
m
=
new
Memory
(
size
.
getValue
());
if
(
LIBC
.
sysctl
(
MIB_PROC_ALL
,
3
,
m
,
size
,
NULL
,
_
)!=
0
)
{
if
(
LIBC
.
sysctl
(
MIB_PROC_ALL
,
3
,
m
,
size
,
NULL
,
ref
)!=
0
)
{
if
(
Native
.
getLastError
()==
ENOMEM
&&
nRetry
++<
16
)
continue
;
// retry
throw
new
IOException
(
"Failed to call kern.proc.all: "
+
LIBC
.
strerror
(
Native
.
getLastError
()));
...
...
@@ -1324,14 +1324,14 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
arguments
=
new
ArrayList
<
String
>();
envVars
=
new
EnvVars
();
IntByReference
_
=
new
IntByReference
();
IntByReference
intByRef
=
new
IntByReference
();
IntByReference
argmaxRef
=
new
IntByReference
(
0
);
IntByReference
size
=
new
IntByReference
(
sizeOfInt
);
// for some reason, I was never able to get sysctlbyname work.
// if(LIBC.sysctlbyname("kern.argmax", argmaxRef.getPointer(), size, NULL, _)!=0)
if
(
LIBC
.
sysctl
(
new
int
[]{
CTL_KERN
,
KERN_ARGMAX
},
2
,
argmaxRef
.
getPointer
(),
size
,
NULL
,
_
)!=
0
)
if
(
LIBC
.
sysctl
(
new
int
[]{
CTL_KERN
,
KERN_ARGMAX
},
2
,
argmaxRef
.
getPointer
(),
size
,
NULL
,
intByRef
)!=
0
)
throw
new
IOException
(
"Failed to get kern.argmax: "
+
LIBC
.
strerror
(
Native
.
getLastError
()));
int
argmax
=
argmaxRef
.
getValue
();
...
...
@@ -1369,7 +1369,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
}
StringArrayMemory
m
=
new
StringArrayMemory
(
argmax
);
size
.
setValue
(
argmax
);
if
(
LIBC
.
sysctl
(
new
int
[]{
CTL_KERN
,
KERN_PROCARGS2
,
pid
},
3
,
m
,
size
,
NULL
,
_
)!=
0
)
if
(
LIBC
.
sysctl
(
new
int
[]{
CTL_KERN
,
KERN_PROCARGS2
,
pid
},
3
,
m
,
size
,
NULL
,
intByRef
)!=
0
)
throw
new
IOException
(
"Failed to obtain ken.procargs2: "
+
LIBC
.
strerror
(
Native
.
getLastError
()));
...
...
core/src/main/java/jenkins/model/Jenkins.java
浏览文件 @
a3cc7780
...
...
@@ -5030,7 +5030,7 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
if
(
idx
>
0
)
{
return
new
VersionNumber
(
versionString
.
substring
(
0
,
idx
));
}
}
catch
(
NumberFormatException
_
)
{
}
catch
(
NumberFormatException
ex
)
{
// fall through
}
...
...
core/src/main/java/jenkins/slaves/restarter/JnlpSlaveRestarterInstaller.java
浏览文件 @
a3cc7780
...
...
@@ -77,7 +77,7 @@ public class JnlpSlaveRestarterInstaller extends ComputerListener implements Ser
try
{
Engine
.
class
.
getMethod
(
"addListener"
,
EngineListener
.
class
);
}
catch
(
NoSuchMethodException
_
)
{
}
catch
(
NoSuchMethodException
ex
)
{
return
null
;
// running with older version of remoting that doesn't support adding listener
}
...
...
core/src/main/java/jenkins/triggers/ReverseBuildTrigger.java
浏览文件 @
a3cc7780
...
...
@@ -251,7 +251,7 @@ public final class ReverseBuildTrigger extends Trigger<Job> implements Dependenc
}
private
Map
<
Job
,
Collection
<
ReverseBuildTrigger
>>
calculateCache
()
{
try
(
ACLContext
_
=
ACL
.
as
(
ACL
.
SYSTEM
))
{
try
(
ACLContext
acl
=
ACL
.
as
(
ACL
.
SYSTEM
))
{
final
Map
<
Job
,
Collection
<
ReverseBuildTrigger
>>
result
=
new
WeakHashMap
<>();
for
(
Job
<?,
?>
downstream
:
Jenkins
.
getInstance
().
allItems
(
Job
.
class
))
{
ReverseBuildTrigger
trigger
=
...
...
@@ -312,7 +312,7 @@ public final class ReverseBuildTrigger extends Trigger<Job> implements Dependenc
public
static
class
ItemListenerImpl
extends
ItemListener
{
@Override
public
void
onLocationChanged
(
Item
item
,
final
String
oldFullName
,
final
String
newFullName
)
{
try
(
ACLContext
_
=
ACL
.
as
(
ACL
.
SYSTEM
))
{
try
(
ACLContext
acl
=
ACL
.
as
(
ACL
.
SYSTEM
))
{
for
(
Job
<?,
?>
p
:
Jenkins
.
getInstance
().
allItems
(
Job
.
class
))
{
ReverseBuildTrigger
t
=
ParameterizedJobMixIn
.
getTrigger
(
p
,
ReverseBuildTrigger
.
class
);
if
(
t
!=
null
)
{
...
...
test/src/test/java/hudson/PluginManagerTest.java
浏览文件 @
a3cc7780
...
...
@@ -293,7 +293,7 @@ public class PluginManagerTest {
try
{
callDependerValue
();
fail
();
}
catch
(
ClassNotFoundException
_
)
{
}
catch
(
ClassNotFoundException
ex
)
{
}
// No extensions exist.
...
...
@@ -331,7 +331,7 @@ public class PluginManagerTest {
try
{
r
.
jenkins
.
getExtensionList
(
"org.jenkinsci.plugins.dependencytest.dependee.DependeeExtensionPoint"
);
fail
();
}
catch
(
ClassNotFoundException
_
){
}
catch
(
ClassNotFoundException
ex
){
}
// Load dependee.
...
...
@@ -380,7 +380,7 @@ public class PluginManagerTest {
try
{
r
.
jenkins
.
getExtensionList
(
"org.jenkinsci.plugins.dependencytest.dependee.DependeeExtensionPoint"
);
fail
();
}
catch
(
ClassNotFoundException
_
){
}
catch
(
ClassNotFoundException
ex
){
}
}
...
...
test/src/test/java/hudson/cli/ComputerStateTest.java
浏览文件 @
a3cc7780
...
...
@@ -168,6 +168,6 @@ public class ComputerStateTest {
try
{
page
.
getAnchorByText
(
text
);
fail
(
text
+
" link should not exist"
);
}
catch
(
ElementNotFoundException
_
)
{
/*expected*/
}
}
catch
(
ElementNotFoundException
ex
)
{
/*expected*/
}
}
}
test/src/test/java/hudson/model/FingerprintTest.java
浏览文件 @
a3cc7780
...
...
@@ -160,7 +160,7 @@ public class FingerprintTest {
setJobPermissionsOnce
(
project1
,
"user1"
,
Item
.
READ
,
Item
.
DISCOVER
);
setJobPermissionsOnce
(
project2
,
"user2"
,
Item
.
READ
,
Item
.
DISCOVER
);
try
(
ACLContext
_
=
ACL
.
as
(
user1
))
{
try
(
ACLContext
acl
=
ACL
.
as
(
user1
))
{
Fingerprint
.
BuildPtr
original
=
fp
.
getOriginal
();
assertThat
(
"user1 should be able to see the origin"
,
fp
.
getOriginal
(),
notNullValue
());
assertEquals
(
"user1 should be able to see the origin's project name"
,
project1
.
getName
(),
original
.
getName
());
...
...
@@ -169,13 +169,13 @@ public class FingerprintTest {
assertEquals
(
"Only project1 should be visible to user1"
,
project1
.
getFullName
(),
fp
.
_getUsages
().
get
(
0
).
name
);
}
try
(
ACLContext
_
=
ACL
.
as
(
user2
))
{
try
(
ACLContext
acl
=
ACL
.
as
(
user2
))
{
assertThat
(
"user2 should be unable to see the origin"
,
fp
.
getOriginal
(),
nullValue
());
assertEquals
(
"Only one usage should be visible to user2"
,
1
,
fp
.
_getUsages
().
size
());
assertEquals
(
"Only project2 should be visible to user2"
,
project2
.
getFullName
(),
fp
.
_getUsages
().
get
(
0
).
name
);
}
try
(
ACLContext
_
=
ACL
.
as
(
user3
))
{
try
(
ACLContext
acl
=
ACL
.
as
(
user3
))
{
Fingerprint
.
BuildPtr
original
=
fp
.
getOriginal
();
assertThat
(
"user3 should be unable to see the origin"
,
fp
.
getOriginal
(),
nullValue
());
assertEquals
(
"All usages should be invisible for user3"
,
0
,
fp
.
_getUsages
().
size
());
...
...
@@ -193,7 +193,7 @@ public class FingerprintTest {
User
user1
=
User
.
get
(
"user1"
);
setupProjectMatrixAuthStrategy
(
Jenkins
.
READ
,
Item
.
DISCOVER
);
try
(
ACLContext
_
=
ACL
.
as
(
user1
))
{
try
(
ACLContext
acl
=
ACL
.
as
(
user1
))
{
Fingerprint
.
BuildPtr
original
=
fingerprint
.
getOriginal
();
assertThat
(
"user1 should able to see the origin"
,
fingerprint
.
getOriginal
(),
notNullValue
());
assertEquals
(
"user1 sees the wrong original name with Item.DISCOVER"
,
project
.
getFullName
(),
original
.
getName
());
...
...
@@ -216,7 +216,7 @@ public class FingerprintTest {
folder
.
setPermissions
(
"user1"
,
Item
.
READ
);
// Ensure we can read the original from user account
try
(
ACLContext
_
=
ACL
.
as
(
user1
))
{
try
(
ACLContext
acl
=
ACL
.
as
(
user1
))
{
assertTrue
(
"Test framework issue: User1 should be able to read the folder"
,
folder
.
hasPermission
(
Item
.
READ
));
Fingerprint
.
BuildPtr
original
=
fingerprint
.
getOriginal
();
...
...
@@ -241,7 +241,7 @@ public class FingerprintTest {
setupProjectMatrixAuthStrategy
(
Jenkins
.
READ
,
Item
.
DISCOVER
);
// Ensure we can read the original from user account
try
(
ACLContext
_
=
ACL
.
as
(
user1
))
{
try
(
ACLContext
acl
=
ACL
.
as
(
user1
))
{
assertFalse
(
"Test framework issue: User1 should be unable to read the folder"
,
folder
.
hasPermission
(
Item
.
READ
));
assertThat
(
"user1 should be unable to see the origin"
,
fingerprint
.
getOriginal
(),
nullValue
());
assertEquals
(
"No jobs should be visible to user1"
,
0
,
fingerprint
.
_getUsages
().
size
());
...
...
@@ -266,7 +266,7 @@ public class FingerprintTest {
setupProjectMatrixAuthStrategy
(
Jenkins
.
READ
,
Item
.
READ
,
Item
.
DISCOVER
);
project
.
delete
();
try
(
ACLContext
_
=
ACL
.
as
(
user1
))
{
try
(
ACLContext
acl
=
ACL
.
as
(
user1
))
{
assertThat
(
"user1 should be unable to see the origin"
,
fp
.
getOriginal
(),
nullValue
());
assertEquals
(
"No jobs should be visible to user1"
,
0
,
fp
.
_getUsages
().
size
());
}
...
...
@@ -284,7 +284,7 @@ public class FingerprintTest {
setupProjectMatrixAuthStrategy
(
Jenkins
.
ADMINISTER
);
project
.
delete
();
try
(
ACLContext
_
=
ACL
.
as
(
user1
))
{
try
(
ACLContext
acl
=
ACL
.
as
(
user1
))
{
Fingerprint
.
BuildPtr
original
=
fingerprint
.
getOriginal
();
assertThat
(
"user1 should able to see the origin"
,
fingerprint
.
getOriginal
(),
notNullValue
());
assertThat
(
"Job has been deleted, so Job reference should return null"
,
fingerprint
.
getOriginal
().
getJob
(),
nullValue
());
...
...
test/src/test/java/hudson/model/ListViewTest.java
浏览文件 @
a3cc7780
...
...
@@ -234,7 +234,7 @@ public class ListViewTest {
ListView
v
=
new
ListView
(
"v"
,
j
.
jenkins
);
v
.
add
(
p
);
j
.
jenkins
.
addView
(
v
);
try
(
ACLContext
_
=
ACL
.
as
(
User
.
get
(
"alice"
)))
{
try
(
ACLContext
acl
=
ACL
.
as
(
User
.
get
(
"alice"
)))
{
p
.
renameTo
(
"p2"
);
}
assertEquals
(
Collections
.
singletonList
(
p
),
v
.
getItems
());
...
...
test/src/test/java/hudson/search/SearchTest.java
浏览文件 @
a3cc7780
...
...
@@ -440,7 +440,7 @@ public class SearchTest {
mas
.
grant
(
Jenkins
.
READ
).
onRoot
().
toEveryone
();
j
.
jenkins
.
setAuthorizationStrategy
(
mas
);
try
(
ACLContext
_
=
ACL
.
as
(
User
.
get
(
"alice"
)))
{
try
(
ACLContext
acl
=
ACL
.
as
(
User
.
get
(
"alice"
)))
{
List
<
SearchItem
>
results
=
new
ArrayList
<>();
j
.
jenkins
.
getSearchIndex
().
find
(
"config"
,
results
);
j
.
jenkins
.
getSearchIndex
().
find
(
"manage"
,
results
);
...
...
test/src/test/java/jenkins/security/ApiTokenPropertyTest.java
浏览文件 @
a3cc7780
...
...
@@ -69,7 +69,7 @@ public class ApiTokenPropertyTest {
final
String
token
=
t
.
getApiToken
();
// Make sure that user is able to get the token via the interface
try
(
ACLContext
_
=
ACL
.
as
(
u
))
{
try
(
ACLContext
acl
=
ACL
.
as
(
u
))
{
assertEquals
(
"User is unable to get its own token"
,
token
,
t
.
getApiToken
());
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录