Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
4666a876
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,发现更多精彩内容 >>
提交
4666a876
编写于
12月 09, 2012
作者:
K
Kohsuke Kawaguchi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Needed to resurrect validation, too.
上级
5541c42e
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
49 addition
and
0 deletion
+49
-0
core/src/main/java/jenkins/model/JenkinsLocationConfiguration.java
...main/java/jenkins/model/JenkinsLocationConfiguration.java
+22
-0
core/src/main/resources/jenkins/model/Messages.properties
core/src/main/resources/jenkins/model/Messages.properties
+1
-0
core/src/main/resources/jenkins/model/Messages_da.properties
core/src/main/resources/jenkins/model/Messages_da.properties
+1
-0
core/src/main/resources/jenkins/model/Messages_de.properties
core/src/main/resources/jenkins/model/Messages_de.properties
+1
-0
core/src/main/resources/jenkins/model/Messages_es.properties
core/src/main/resources/jenkins/model/Messages_es.properties
+1
-0
core/src/main/resources/jenkins/model/Messages_ja.properties
core/src/main/resources/jenkins/model/Messages_ja.properties
+1
-0
core/src/main/resources/jenkins/model/Messages_pt_BR.properties
...rc/main/resources/jenkins/model/Messages_pt_BR.properties
+2
-0
test/src/test/java/jenkins/model/JenkinsLocationConfigurationTest.java
.../java/jenkins/model/JenkinsLocationConfigurationTest.java
+20
-0
未找到文件。
core/src/main/java/jenkins/model/JenkinsLocationConfiguration.java
浏览文件 @
4666a876
...
...
@@ -3,9 +3,13 @@ package jenkins.model;
import
hudson.Extension
;
import
hudson.Util
;
import
hudson.XmlFile
;
import
hudson.util.FormValidation
;
import
net.sf.json.JSONObject
;
import
org.kohsuke.stapler.QueryParameter
;
import
org.kohsuke.stapler.StaplerRequest
;
import
javax.mail.internet.AddressException
;
import
javax.mail.internet.InternetAddress
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.logging.Level
;
...
...
@@ -84,5 +88,23 @@ public class JenkinsLocationConfiguration extends GlobalConfiguration {
return
true
;
}
/**
* Checks the URL in <tt>global.jelly</tt>
*/
public
FormValidation
doCheckUrl
(
@QueryParameter
String
value
)
{
if
(
value
.
startsWith
(
"http://localhost"
))
return
FormValidation
.
warning
(
Messages
.
Mailer_Localhost_Error
());
return
FormValidation
.
ok
();
}
public
FormValidation
doCheckAdminAddress
(
@QueryParameter
String
value
)
{
try
{
new
InternetAddress
(
value
);
return
FormValidation
.
ok
();
}
catch
(
AddressException
e
)
{
return
FormValidation
.
error
(
e
.
getMessage
());
}
}
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
JenkinsLocationConfiguration
.
class
.
getName
());
}
core/src/main/resources/jenkins/model/Messages.properties
浏览文件 @
4666a876
...
...
@@ -62,6 +62,7 @@ CLI.safe-shutdown.shortDescription=Puts Jenkins into the quiet mode, wait for ex
DefaultProjectNamingStrategy.DisplayName
=
Default
Mailer.Address.Not.Configured
=
address not configured yet <nobody@nowhere>
Mailer.Localhost.Error
=
Please set a valid host name, instead of localhost
PatternProjectNamingStrategy.DisplayName
=
Pattern
PatternProjectNamingStrategy.NamePatternRequired
=
Name Pattern is required
...
...
core/src/main/resources/jenkins/model/Messages_da.properties
浏览文件 @
4666a876
...
...
@@ -51,3 +51,4 @@ CLI.reload-configuration.shortDescription=Genindl\u00e6s alle data fra filsystem
Nyttigt hvis du har modificeret konfigurationsfiler direkte, udenom Jenkins.
Mailer.Address.Not.Configured
=
Adresse ikke konfigureret <nobody@nowhere>
Mailer.Localhost.Error
=
Venligst inds
\u
00e6t et gyldigt v
\u
00e6rtsnavn, istedet for localhost
core/src/main/resources/jenkins/model/Messages_de.properties
浏览文件 @
4666a876
...
...
@@ -53,3 +53,4 @@ CLI.reload-configuration.shortDescription=Alle Daten im Speicher verwerfen und K
CLI.safe-restart.shortDescription
=
Startet Jenkins neu.
Mailer.Address.Not.Configured
=
Adresse nicht konfiguriert <nobody@nowhere>
Mailer.Localhost.Error
=
Bitte verwenden Sie einen konkreten Hostnamen anstelle von ''localhost''.
core/src/main/resources/jenkins/model/Messages_es.properties
浏览文件 @
4666a876
...
...
@@ -61,3 +61,4 @@ CauseOfInterruption.ShortDescription=Cancelado por {0}
PatternProjectNamingStrategy.NamePatternInvalidSyntax
=
La sintaxis de la expresin regular no es vlida
Mailer.Address.Not.Configured
=
Direccin no configurada todava <nobody@nowhere>
Mailer.Localhost.Error
=
Escriba un nombre de servidor correcto en lugar de "localhost"
core/src/main/resources/jenkins/model/Messages_ja.properties
浏览文件 @
4666a876
...
...
@@ -61,3 +61,4 @@ PatternProjectNamingStrategy.NamePatternRequired=\u30d1\u30bf\u30fc\u30f3\u306f\
PatternProjectNamingStrategy.NamePatternInvalidSyntax
=
\u
6b63
\u
898f
\u8868\u
73fe
\u
306b
\u
8aa4
\u
308a
\u
304c
\u3042\u
308a
\u
307e
\u3059\u3002
Mailer.Address.Not.Configured
=
\u
307e
\u3060\u
30a2
\u
30c9
\u
30ec
\u
30b9
\u
304c
\u
8a2d
\u
5b9a
\u3055\u
308c
\u3066\u3044\u
307e
\u
305b
\u3093\u3002
<nobody@nowhere>
Mailer.Localhost.Error
=
localhost
\u
306e
\u
4ee3
\u
308f
\u
308a
\u
306b
\u
59a5
\u
5f53
\u
306a
\u
30db
\u
30b9
\u
30c8
\u
540d
\u3092\u
8a2d
\u
5b9a
\u3057\u3066\u
304f
\u3060\u3055\u3044\u3002
core/src/main/resources/jenkins/model/Messages_pt_BR.properties
浏览文件 @
4666a876
...
...
@@ -46,3 +46,5 @@ CLI.keep-build.shortDescription=Marcar a constru\u00e7\u00e3o como permanente
# address not configured yet <nobody@nowhere>
Mailer.Address.Not.Configured
=
Endere
\u
00e7o ainda n
\u
00e3o configurado <nobody@nowhere>
# Please set a valid host name, instead of localhost
Mailer.Localhost.Error
=
Por favor insira uma nome de host v
\u
00e1lido.
test/src/test/java/jenkins/model/JenkinsLocationConfigurationTest.java
0 → 100644
浏览文件 @
4666a876
package
jenkins.model
;
import
com.gargoylesoftware.htmlunit.html.HtmlInput
;
import
com.gargoylesoftware.htmlunit.html.HtmlPage
;
import
org.jvnet.hudson.test.HudsonTestCase
;
/**
* @author Kohsuke Kawaguchi
*/
public
class
JenkinsLocationConfigurationTest
extends
HudsonTestCase
{
/**
* Makes sure the use of "localhost" in the Hudson URL reports a warning.
*/
public
void
testLocalHostWarning
()
throws
Exception
{
HtmlPage
p
=
new
WebClient
().
goTo
(
"configure"
);
HtmlInput
url
=
p
.
getFormByName
(
"config"
).
getInputByName
(
"_.url"
);
url
.
setValueAttribute
(
"http://localhost:1234/"
);
assertTrue
(
p
.
getDocumentElement
().
getTextContent
().
contains
(
"instead of localhost"
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录