Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
4825967f
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,发现更多精彩内容 >>
提交
4825967f
编写于
11月 15, 2013
作者:
J
Jesse Glick
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Deleting code using @IgnoreJRERequirement for Java 5 compatibility.
上级
24052ea5
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
10 addition
and
95 deletion
+10
-95
cli/src/main/java/hudson/cli/CLI.java
cli/src/main/java/hudson/cli/CLI.java
+0
-7
core/src/main/java/hudson/Functions.java
core/src/main/java/hudson/Functions.java
+3
-11
core/src/main/java/hudson/Util.java
core/src/main/java/hudson/Util.java
+4
-18
core/src/main/java/hudson/diagnosis/HudsonHomeDiskUsageChecker.java
...ain/java/hudson/diagnosis/HudsonHomeDiskUsageChecker.java
+0
-8
core/src/main/java/hudson/node_monitors/DiskSpaceMonitor.java
.../src/main/java/hudson/node_monitors/DiskSpaceMonitor.java
+1
-3
core/src/main/java/hudson/node_monitors/DiskSpaceMonitorDescriptor.java
...java/hudson/node_monitors/DiskSpaceMonitorDescriptor.java
+0
-8
core/src/main/java/hudson/node_monitors/TemporarySpaceMonitor.java
...main/java/hudson/node_monitors/TemporarySpaceMonitor.java
+1
-10
core/src/main/java/hudson/security/AbstractPasswordBasedSecurityRealm.java
...a/hudson/security/AbstractPasswordBasedSecurityRealm.java
+0
-2
core/src/main/java/hudson/tools/ZipExtractionInstaller.java
core/src/main/java/hudson/tools/ZipExtractionInstaller.java
+1
-15
core/src/main/java/hudson/util/RemotingDiagnostics.java
core/src/main/java/hudson/util/RemotingDiagnostics.java
+0
-11
core/src/main/java/jenkins/PluginSubtypeMarker.java
core/src/main/java/jenkins/PluginSubtypeMarker.java
+0
-2
未找到文件。
cli/src/main/java/hudson/cli/CLI.java
浏览文件 @
4825967f
...
...
@@ -32,7 +32,6 @@ import hudson.remoting.RemoteInputStream;
import
hudson.remoting.RemoteOutputStream
;
import
hudson.remoting.SocketInputStream
;
import
hudson.remoting.SocketOutputStream
;
import
org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
;
import
javax.crypto.SecretKey
;
import
javax.crypto.spec.SecretKeySpec
;
...
...
@@ -592,10 +591,7 @@ public class CLI {
return
pemString
.
contains
(
"4,ENCRYPTED"
);
}
@SuppressWarnings
(
"Since15"
)
@IgnoreJRERequirement
private
static
String
askForPasswd
(
String
filePath
){
try
{
Console
cons
=
System
.
console
();
String
passwd
=
null
;
if
(
cons
!=
null
){
...
...
@@ -603,9 +599,6 @@ public class CLI {
passwd
=
String
.
valueOf
(
p
);
}
return
passwd
;
}
catch
(
LinkageError
e
)
{
throw
new
Error
(
"Your private key is encrypted, but we need Java6 to ask you password safely"
,
e
);
}
}
/**
...
...
core/src/main/java/hudson/Functions.java
浏览文件 @
4825967f
...
...
@@ -140,7 +140,6 @@ import org.apache.commons.jelly.XMLOutput;
import
org.apache.commons.jexl.parser.ASTSizeFunction
;
import
org.apache.commons.jexl.util.Introspector
;
import
org.apache.commons.lang.StringUtils
;
import
org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
;
import
org.jvnet.tiger_types.Types
;
import
org.kohsuke.stapler.Ancestor
;
import
org.kohsuke.stapler.Stapler
;
...
...
@@ -1126,7 +1125,6 @@ public class Functions {
return
sorted
;
}
@IgnoreJRERequirement
public
static
ThreadInfo
[]
getThreadInfos
()
{
ThreadMXBean
mbean
=
ManagementFactory
.
getThreadMXBean
();
return
mbean
.
dumpAllThreads
(
mbean
.
isObjectMonitorUsageSupported
(),
mbean
.
isSynchronizerUsageSupported
());
...
...
@@ -1190,20 +1188,14 @@ public class Functions {
}
/**
*
Are we running on JRE6 or above?
*
@deprecated Now always true.
*/
@
IgnoreJRERequirement
@
Deprecated
public
static
boolean
isMustangOrAbove
()
{
try
{
System
.
console
();
return
true
;
}
catch
(
LinkageError
e
)
{
return
false
;
}
return
true
;
}
// ThreadInfo.toString() truncates the stack trace by first 8, so needed my own version
@IgnoreJRERequirement
public
static
String
dumpThreadInfo
(
ThreadInfo
ti
,
ThreadGroupMap
map
)
{
String
grp
=
map
.
getThreadGroup
(
ti
);
StringBuilder
sb
=
new
StringBuilder
(
"\""
+
ti
.
getThreadName
()
+
"\""
+
...
...
core/src/main/java/hudson/Util.java
浏览文件 @
4825967f
...
...
@@ -42,7 +42,6 @@ import org.apache.tools.ant.taskdefs.Copy;
import
org.apache.tools.ant.types.FileSet
;
import
jnr.posix.FileStat
;
import
jnr.posix.POSIX
;
import
org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
;
import
javax.crypto.SecretKey
;
import
javax.crypto.spec.SecretKeySpec
;
...
...
@@ -259,16 +258,11 @@ public class Util {
/**
* Makes the given file writable by any means possible.
*/
@IgnoreJRERequirement
private
static
void
makeWritable
(
File
f
)
{
// try JDK6-way of doing it.
try
{
if
(
f
.
setWritable
(
true
))
{
return
;
}
}
catch
(
NoSuchMethodError
e
)
{
// not JDK6
if
(
f
.
setWritable
(
true
))
{
return
;
}
// TODO do we still need to try anything else?
// try chmod. this becomes no-op if this is not Unix.
try
{
...
...
@@ -1378,17 +1372,9 @@ public class Util {
* Loads a key/value pair string as {@link Properties}
* @since 1.392
*/
@IgnoreJRERequirement
public
static
Properties
loadProperties
(
String
properties
)
throws
IOException
{
Properties
p
=
new
Properties
();
try
{
p
.
load
(
new
StringReader
(
properties
));
}
catch
(
NoSuchMethodError
e
)
{
// load(Reader) method is only available on JDK6.
// this fall back version doesn't work correctly with non-ASCII characters,
// but there's no other easy ways out it seems.
p
.
load
(
new
ByteArrayInputStream
(
properties
.
getBytes
()));
}
p
.
load
(
new
StringReader
(
properties
));
return
p
;
}
...
...
core/src/main/java/hudson/diagnosis/HudsonHomeDiskUsageChecker.java
浏览文件 @
4825967f
...
...
@@ -26,7 +26,6 @@ package hudson.diagnosis;
import
hudson.Extension
;
import
jenkins.model.Jenkins
;
import
hudson.model.PeriodicWork
;
import
org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
;
import
java.util.logging.Logger
;
...
...
@@ -42,9 +41,7 @@ public class HudsonHomeDiskUsageChecker extends PeriodicWork {
return
HOUR
;
}
@IgnoreJRERequirement
protected
void
doRun
()
{
try
{
long
free
=
Jenkins
.
getInstance
().
getRootDir
().
getUsableSpace
();
long
total
=
Jenkins
.
getInstance
().
getRootDir
().
getTotalSpace
();
if
(
free
<=
0
||
total
<=
0
)
{
...
...
@@ -61,11 +58,6 @@ public class HudsonHomeDiskUsageChecker extends PeriodicWork {
// it's AND and not OR so that small Hudson home won't get a warning,
// and similarly, if you have a 1TB disk, you don't get a warning when you still have 100GB to go.
HudsonHomeDiskUsageMonitor
.
get
().
activated
=
(
total
/
free
>
10
&&
free
<
FREE_SPACE_THRESHOLD
);
}
catch
(
LinkageError
_
)
{
// pre Mustang
LOGGER
.
info
(
"Not on JDK6. Cannot monitor JENKINS_HOME disk usage"
);
cancel
();
}
}
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
HudsonHomeDiskUsageChecker
.
class
.
getName
());
...
...
core/src/main/java/hudson/node_monitors/DiskSpaceMonitor.java
浏览文件 @
4825967f
...
...
@@ -25,7 +25,6 @@ package hudson.node_monitors;
import
hudson.Extension
;
import
hudson.FilePath
;
import
hudson.Functions
;
import
hudson.model.Computer
;
import
hudson.remoting.Callable
;
import
jenkins.model.Jenkins
;
...
...
@@ -76,7 +75,6 @@ public class DiskSpaceMonitor extends AbstractDiskSpaceMonitor {
@Extension
public
static
DiskSpaceMonitorDescriptor
install
()
{
if
(
Functions
.
isMustangOrAbove
())
return
DESCRIPTOR
;
return
null
;
return
DESCRIPTOR
;
}
}
core/src/main/java/hudson/node_monitors/DiskSpaceMonitorDescriptor.java
浏览文件 @
4825967f
...
...
@@ -24,12 +24,10 @@
package
hudson.node_monitors
;
import
hudson.FilePath.FileCallable
;
import
hudson.model.Computer
;
import
hudson.remoting.VirtualChannel
;
import
hudson.Util
;
import
hudson.slaves.OfflineCause
;
import
hudson.node_monitors.DiskSpaceMonitorDescriptor.DiskSpace
;
import
org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
;
import
java.io.File
;
import
java.io.IOException
;
...
...
@@ -161,16 +159,10 @@ public abstract class DiskSpaceMonitorDescriptor extends AbstractAsyncNodeMonito
protected
static
final
class
GetUsableSpace
implements
FileCallable
<
DiskSpace
>
{
public
GetUsableSpace
()
{}
@IgnoreJRERequirement
public
DiskSpace
invoke
(
File
f
,
VirtualChannel
channel
)
throws
IOException
{
try
{
long
s
=
f
.
getUsableSpace
();
if
(
s
<=
0
)
return
null
;
return
new
DiskSpace
(
f
.
getCanonicalPath
(),
s
);
}
catch
(
LinkageError
e
)
{
// pre-mustang
return
null
;
}
}
private
static
final
long
serialVersionUID
=
1L
;
}
...
...
core/src/main/java/hudson/node_monitors/TemporarySpaceMonitor.java
浏览文件 @
4825967f
...
...
@@ -26,13 +26,11 @@ package hudson.node_monitors;
import
hudson.Extension
;
import
hudson.FilePath
;
import
hudson.FilePath.FileCallable
;
import
hudson.Functions
;
import
hudson.model.Computer
;
import
hudson.remoting.Callable
;
import
jenkins.model.Jenkins
;
import
hudson.node_monitors.DiskSpaceMonitorDescriptor.DiskSpace
;
import
hudson.remoting.VirtualChannel
;
import
org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
;
import
org.kohsuke.stapler.DataBoundConstructor
;
import
java.io.File
;
...
...
@@ -78,24 +76,17 @@ public class TemporarySpaceMonitor extends AbstractDiskSpaceMonitor {
@Extension
public
static
DiskSpaceMonitorDescriptor
install
()
{
if
(
Functions
.
isMustangOrAbove
())
return
DESCRIPTOR
;
return
null
;
return
DESCRIPTOR
;
}
protected
static
final
class
GetTempSpace
implements
FileCallable
<
DiskSpace
>
{
@IgnoreJRERequirement
public
DiskSpace
invoke
(
File
f
,
VirtualChannel
channel
)
throws
IOException
{
try
{
// if the disk is really filled up we can't even create a single file,
// so calling File.createTempFile and figuring out the directory won't reliably work.
f
=
new
File
(
System
.
getProperty
(
"java.io.tmpdir"
));
long
s
=
f
.
getUsableSpace
();
if
(
s
<=
0
)
return
null
;
return
new
DiskSpace
(
f
.
getCanonicalPath
(),
s
);
}
catch
(
LinkageError
e
)
{
// pre-mustang
return
null
;
}
}
private
static
final
long
serialVersionUID
=
1L
;
}
...
...
core/src/main/java/hudson/security/AbstractPasswordBasedSecurityRealm.java
浏览文件 @
4825967f
...
...
@@ -15,7 +15,6 @@ import org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider
import
org.acegisecurity.userdetails.UserDetails
;
import
org.acegisecurity.userdetails.UserDetailsService
;
import
org.acegisecurity.userdetails.UsernameNotFoundException
;
import
org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
;
import
org.kohsuke.args4j.Option
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.web.context.WebApplicationContext
;
...
...
@@ -141,7 +140,6 @@ public abstract class AbstractPasswordBasedSecurityRealm extends SecurityRealm i
* Asks for the password.
*/
private
static
class
InteractivelyAskForPassword
implements
Callable
<
String
,
IOException
>
{
@IgnoreJRERequirement
public
String
call
()
throws
IOException
{
Console
console
=
System
.
console
();
if
(
console
==
null
)
return
null
;
// no terminal
...
...
core/src/main/java/hudson/tools/ZipExtractionInstaller.java
浏览文件 @
4825967f
...
...
@@ -30,12 +30,10 @@ import hudson.FilePath.FileCallable;
import
hudson.ProxyConfiguration
;
import
hudson.Util
;
import
hudson.Functions
;
import
hudson.os.PosixAPI
;
import
hudson.model.Node
;
import
hudson.model.TaskListener
;
import
hudson.remoting.VirtualChannel
;
import
hudson.util.FormValidation
;
import
hudson.util.jna.GNUCLibrary
;
import
java.io.File
;
import
java.io.IOException
;
...
...
@@ -45,7 +43,6 @@ import java.net.URL;
import
java.net.URLConnection
;
import
org.kohsuke.stapler.DataBoundConstructor
;
import
org.kohsuke.stapler.QueryParameter
;
import
org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
;
/**
* Installs a tool into the Hudson working area by downloading and unpacking a ZIP file.
...
...
@@ -126,20 +123,9 @@ public class ZipExtractionInstaller extends ToolInstaller {
process
(
d
);
return
null
;
}
@IgnoreJRERequirement
private
void
process
(
File
f
)
{
if
(
f
.
isFile
())
{
if
(
Functions
.
isMustangOrAbove
())
f
.
setExecutable
(
true
,
false
);
else
{
try
{
GNUCLibrary
.
LIBC
.
chmod
(
f
.
getAbsolutePath
(),
0755
);
}
catch
(
LinkageError
e
)
{
// if JNA is unavailable, fall back.
// we still prefer to try JNA first as PosixAPI supports even smaller platforms.
PosixAPI
.
jnr
().
chmod
(
f
.
getAbsolutePath
(),
0755
);
}
}
f
.
setExecutable
(
true
,
false
);
}
else
{
File
[]
kids
=
f
.
listFiles
();
if
(
kids
!=
null
)
{
...
...
core/src/main/java/hudson/util/RemotingDiagnostics.java
浏览文件 @
4825967f
...
...
@@ -92,21 +92,10 @@ public final class RemotingDiagnostics {
private
static
final
class
GetThreadDump
implements
Callable
<
Map
<
String
,
String
>,
RuntimeException
>
{
public
Map
<
String
,
String
>
call
()
{
Map
<
String
,
String
>
r
=
new
LinkedHashMap
<
String
,
String
>();
try
{
ThreadInfo
[]
data
=
Functions
.
getThreadInfos
();
Functions
.
ThreadGroupMap
map
=
Functions
.
sortThreadsAndGetGroupMap
(
data
);
for
(
ThreadInfo
ti
:
data
)
r
.
put
(
ti
.
getThreadName
(),
Functions
.
dumpThreadInfo
(
ti
,
map
));
}
catch
(
LinkageError
_
)
{
// not in JDK6. fall back to JDK5
r
.
clear
();
for
(
Map
.
Entry
<
Thread
,
StackTraceElement
[]>
t
:
Functions
.
dumpAllThreads
().
entrySet
())
{
StringBuilder
buf
=
new
StringBuilder
();
for
(
StackTraceElement
e
:
t
.
getValue
())
buf
.
append
(
e
).
append
(
'\n'
);
r
.
put
(
t
.
getKey
().
getName
(),
buf
.
toString
());
}
}
return
r
;
}
private
static
final
long
serialVersionUID
=
1L
;
...
...
core/src/main/java/jenkins/PluginSubtypeMarker.java
浏览文件 @
4825967f
...
...
@@ -24,7 +24,6 @@
package
jenkins
;
import
hudson.Plugin
;
import
org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
;
import
org.kohsuke.MetaInfServices
;
import
javax.annotation.processing.AbstractProcessor
;
...
...
@@ -58,7 +57,6 @@ import java.util.Set;
@SupportedSourceVersion
(
SourceVersion
.
RELEASE_6
)
@SupportedAnnotationTypes
(
"*"
)
@MetaInfServices
(
Processor
.
class
)
@IgnoreJRERequirement
@SuppressWarnings
({
"Since15"
})
public
class
PluginSubtypeMarker
extends
AbstractProcessor
{
@Override
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录