Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
954350b9
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,发现更多精彩内容 >>
提交
954350b9
编写于
4月 30, 2014
作者:
J
Jesse Glick
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improved form validation for ToolInstallation.home.
上级
aebb876c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
47 addition
and
38 deletion
+47
-38
core/src/main/java/hudson/model/JDK.java
core/src/main/java/hudson/model/JDK.java
+1
-16
core/src/main/java/hudson/tasks/Maven.java
core/src/main/java/hudson/tasks/Maven.java
+1
-15
core/src/main/java/hudson/tools/ToolDescriptor.java
core/src/main/java/hudson/tools/ToolDescriptor.java
+43
-4
core/src/main/resources/hudson/model/Messages.properties
core/src/main/resources/hudson/model/Messages.properties
+0
-1
core/src/main/resources/hudson/tasks/Messages.properties
core/src/main/resources/hudson/tasks/Messages.properties
+0
-1
core/src/main/resources/hudson/tools/Messages.properties
core/src/main/resources/hudson/tools/Messages.properties
+2
-1
未找到文件。
core/src/main/java/hudson/model/JDK.java
浏览文件 @
954350b9
...
...
@@ -23,8 +23,6 @@
*/
package
hudson.model
;
import
com.infradna.tool.bridge_method_injector.BridgeMethodsAdded
;
import
com.infradna.tool.bridge_method_injector.WithBridgeMethods
;
import
hudson.util.StreamTaskListener
;
import
hudson.util.NullStream
;
import
hudson.util.FormValidation
;
...
...
@@ -47,7 +45,6 @@ import java.util.Collections;
import
jenkins.model.Jenkins
;
import
org.kohsuke.stapler.DataBoundConstructor
;
import
org.kohsuke.stapler.QueryParameter
;
/**
* Information about JDK installation.
...
...
@@ -175,16 +172,7 @@ public final class JDK extends ToolInstallation implements NodeSpecific<JDK>, En
/**
* Checks if the JAVA_HOME is a valid JAVA_HOME path.
*/
public
FormValidation
doCheckHome
(
@QueryParameter
File
value
)
{
// this can be used to check the existence of a file on the server, so needs to be protected
Jenkins
.
getInstance
().
checkPermission
(
Jenkins
.
ADMINISTER
);
if
(
value
.
getPath
().
equals
(
""
))
return
FormValidation
.
ok
();
if
(!
value
.
isDirectory
())
return
FormValidation
.
error
(
Messages
.
Hudson_NotADirectory
(
value
));
@Override
protected
FormValidation
checkHomeDirectory
(
File
value
)
{
File
toolsJar
=
new
File
(
value
,
"lib/tools.jar"
);
File
mac
=
new
File
(
value
,
"lib/dt.jar"
);
if
(!
toolsJar
.
exists
()
&&
!
mac
.
exists
())
...
...
@@ -193,9 +181,6 @@ public final class JDK extends ToolInstallation implements NodeSpecific<JDK>, En
return
FormValidation
.
ok
();
}
public
FormValidation
doCheckName
(
@QueryParameter
String
value
)
{
return
FormValidation
.
validateRequired
(
value
);
}
}
public
static
class
ConverterImpl
extends
ToolConverter
{
...
...
core/src/main/java/hudson/tasks/Maven.java
浏览文件 @
954350b9
...
...
@@ -64,7 +64,6 @@ import net.sf.json.JSONObject;
import
org.apache.commons.lang.StringUtils
;
import
org.kohsuke.stapler.DataBoundConstructor
;
import
org.kohsuke.stapler.StaplerRequest
;
import
org.kohsuke.stapler.QueryParameter
;
import
java.io.File
;
import
java.io.IOException
;
...
...
@@ -639,17 +638,7 @@ public class Maven extends Builder {
/**
* Checks if the MAVEN_HOME is valid.
*/
public
FormValidation
doCheckMavenHome
(
@QueryParameter
File
value
)
{
// this can be used to check the existence of a file on the server, so needs to be protected
if
(!
Jenkins
.
getInstance
().
hasPermission
(
Jenkins
.
ADMINISTER
))
return
FormValidation
.
ok
();
if
(
value
.
getPath
().
equals
(
""
))
return
FormValidation
.
ok
();
if
(!
value
.
isDirectory
())
return
FormValidation
.
error
(
Messages
.
Maven_NotADirectory
(
value
));
@Override
protected
FormValidation
checkHomeDirectory
(
File
value
)
{
File
maven1File
=
new
File
(
value
,
MAVEN_1_INSTALLATION_COMMON_FILE
);
File
maven2File
=
new
File
(
value
,
MAVEN_2_INSTALLATION_COMMON_FILE
);
...
...
@@ -659,9 +648,6 @@ public class Maven extends Builder {
return
FormValidation
.
ok
();
}
public
FormValidation
doCheckName
(
@QueryParameter
String
value
)
{
return
FormValidation
.
validateRequired
(
value
);
}
}
public
static
class
ConverterImpl
extends
ToolConverter
{
...
...
core/src/main/java/hudson/tools/ToolDescriptor.java
浏览文件 @
954350b9
...
...
@@ -26,16 +26,18 @@ package hudson.tools;
import
hudson.model.Descriptor
;
import
hudson.util.DescribableList
;
import
hudson.util.FormValidation
;
import
java.io.File
;
import
java.io.IOException
;
import
java.lang.reflect.Array
;
import
java.lang.reflect.ParameterizedType
;
import
java.lang.reflect.Type
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.List
;
import
java.io.IOException
;
import
java.lang.reflect.Array
;
import
jenkins.model.Jenkins
;
import
net.sf.json.JSONObject
;
import
org.jvnet.tiger_types.Types
;
import
org.kohsuke.stapler.QueryParameter
;
import
org.kohsuke.stapler.StaplerRequest
;
/**
...
...
@@ -119,4 +121,41 @@ public abstract class ToolDescriptor<T extends ToolInstallation> extends Descrip
return
true
;
}
/**
* Checks if the home directory is valid.
* @since 1.563
*/
public
FormValidation
doCheckHome
(
@QueryParameter
File
value
)
{
// this can be used to check the existence of a file on the server, so needs to be protected
Jenkins
.
getInstance
().
checkPermission
(
Jenkins
.
ADMINISTER
);
if
(
value
.
getPath
().
isEmpty
())
{
return
FormValidation
.
ok
();
}
if
(!
value
.
isDirectory
())
{
return
FormValidation
.
warning
(
Messages
.
ToolDescriptor_NotADirectory
(
value
));
}
return
checkHomeDirectory
(
value
);
}
/**
* May be overridden to provide tool-specific validation of a tool home directory.
* @param home a possible value for {@link ToolInstallation#getHome}, known to already exist on the master
* @return by default, {@link FormValidation#ok()}
* @since 1.563
*/
protected
FormValidation
checkHomeDirectory
(
File
home
)
{
return
FormValidation
.
ok
();
}
/**
* Checks if the tool name is valid.
* @since 1.563
*/
public
FormValidation
doCheckName
(
@QueryParameter
String
value
)
{
return
FormValidation
.
validateRequired
(
value
);
}
}
core/src/main/resources/hudson/model/Messages.properties
浏览文件 @
954350b9
...
...
@@ -140,7 +140,6 @@ Hudson.NoJavaInPath=java is not in your PATH. Maybe you need to <a href="{0}/con
Hudson.NoName
=
No name is specified
Hudson.NoSuchDirectory
=
No such directory: {0}
Hudson.NodeBeingRemoved
=
Node is being removed
Hudson.NotADirectory
=
{0} is not a directory
Hudson.NotAPlugin
=
{0} is not a Jenkins plugin
Hudson.NotJDKDir
=
{0} doesn
\u2019
t look like a JDK directory
Hudson.Permissions.Title
=
Overall
...
...
core/src/main/resources/hudson/tasks/Messages.properties
浏览文件 @
954350b9
...
...
@@ -80,6 +80,5 @@ Maven.DisplayName=Invoke top-level Maven targets
Maven.ExecFailed
=
command execution failed
Maven.NotMavenDirectory
=
{0} doesn
\u2019
t look like a Maven directory
Maven.NoExecutable
=
Couldn
\u2019
t find any executable in {0}
Maven.NotADirectory
=
{0} is not a directory
Shell.DisplayName
=
Execute shell
core/src/main/resources/hudson/tools/Messages.properties
浏览文件 @
954350b9
...
...
@@ -35,4 +35,5 @@ ZipExtractionInstaller.could_not_connect=Could not connect to URL.
InstallSourceProperty.DescriptorImpl.displayName
=
Install automatically
JDKInstaller.DescriptorImpl.displayName
=
Install from java.sun.com
JDKInstaller.DescriptorImpl.doCheckId
=
Define JDK ID
JDKInstaller.DescriptorImpl.doCheckAcceptLicense
=
You must agree to the license to download the JDK.
\ No newline at end of file
JDKInstaller.DescriptorImpl.doCheckAcceptLicense
=
You must agree to the license to download the JDK.
ToolDescriptor.NotADirectory
=
{0} is not a directory on the Jenkins master (but perhaps it exists on some slaves)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录