Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
79384efd
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,发现更多精彩内容 >>
提交
79384efd
编写于
11月 23, 2018
作者:
D
Daniel Beck
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'stable-2.150' into security-stable-2.150
上级
90b6d47a
af455a62
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
235 addition
and
3 deletion
+235
-3
cli/src/main/java/hudson/cli/CLI.java
cli/src/main/java/hudson/cli/CLI.java
+2
-2
core/src/main/java/hudson/Functions.java
core/src/main/java/hudson/Functions.java
+1
-1
test/src/test/java/hudson/cli/CLITest.java
test/src/test/java/hudson/cli/CLITest.java
+24
-0
test/src/test/java/hudson/console/ConsoleAnnotatorTest.java
test/src/test/java/hudson/console/ConsoleAnnotatorTest.java
+8
-0
test/src/test/resources/hudson/cli/huge-stdin.txt
test/src/test/resources/hudson/cli/huge-stdin.txt
+200
-0
未找到文件。
cli/src/main/java/hudson/cli/CLI.java
浏览文件 @
79384efd
...
...
@@ -705,13 +705,13 @@ public class CLI implements AutoCloseable {
connection
.
sendLocale
(
Locale
.
getDefault
().
toString
());
connection
.
sendStart
();
connection
.
begin
();
final
OutputStream
stdin
=
connection
.
streamStdin
();
new
Thread
(
"input reader"
)
{
@Override
public
void
run
()
{
try
{
final
OutputStream
stdin
=
connection
.
streamStdin
();
int
c
;
while
(
(
c
=
System
.
in
.
read
())
!=
-
1
)
{
// TODO use InputStream.available
while
(
!
connection
.
complete
&&
(
c
=
System
.
in
.
read
())
!=
-
1
)
{
stdin
.
write
(
c
);
}
connection
.
sendEndStdin
();
...
...
core/src/main/java/hudson/Functions.java
浏览文件 @
79384efd
...
...
@@ -1827,7 +1827,7 @@ public class Functions {
* from {@link ConsoleAnnotatorFactory}s and {@link ConsoleAnnotationDescriptor}s.
*/
public
static
String
generateConsoleAnnotationScriptAndStylesheet
()
{
String
cp
=
Stapler
.
getCurrentRequest
().
getContextPath
();
String
cp
=
Stapler
.
getCurrentRequest
().
getContextPath
()
+
Jenkins
.
RESOURCE_PATH
;
StringBuilder
buf
=
new
StringBuilder
();
for
(
ConsoleAnnotatorFactory
f
:
ConsoleAnnotatorFactory
.
all
())
{
String
path
=
cp
+
"/extensionList/"
+
ConsoleAnnotatorFactory
.
class
.
getName
()
+
"/"
+
f
.
getClass
().
getName
();
...
...
test/src/test/java/hudson/cli/CLITest.java
浏览文件 @
79384efd
...
...
@@ -255,6 +255,30 @@ public class CLITest {
assertEquals
(
0
,
ret
);
}
}
@Test
@Issue
(
"JENKINS-54310"
)
public
void
readInputAtOnce
()
throws
Exception
{
home
=
tempHome
();
grabCliJar
();
try
(
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();)
{
int
ret
=
new
Launcher
.
LocalLauncher
(
StreamTaskListener
.
fromStderr
())
.
launch
()
.
cmds
(
"java"
,
"-Duser.home="
+
home
,
"-jar"
,
jar
.
getAbsolutePath
(),
"-s"
,
r
.
getURL
().
toString
(),
"list-plugins"
)
// This CLI Command needs -auth option, so when we omit it, the CLI stops before reading the input.
.
stdout
(
baos
)
.
stderr
(
baos
)
.
stdin
(
CLITest
.
class
.
getResourceAsStream
(
"huge-stdin.txt"
))
.
join
();
assertThat
(
baos
.
toString
(),
not
(
containsString
(
"java.io.IOException: Stream is closed"
)));
assertEquals
(
0
,
ret
);
}
}
@TestExtension
(
"redirectToEndpointShouldBeFollowed"
)
public
static
final
class
CliProxyAction
extends
CrumbExclusion
implements
UnprotectedRootAction
,
StaplerProxy
{
...
...
test/src/test/java/hudson/console/ConsoleAnnotatorTest.java
浏览文件 @
79384efd
...
...
@@ -3,6 +3,7 @@ package hudson.console;
import
com.gargoylesoftware.htmlunit.Page
;
import
com.gargoylesoftware.htmlunit.TextPage
;
import
com.gargoylesoftware.htmlunit.WebRequest
;
import
com.gargoylesoftware.htmlunit.html.DomElement
;
import
com.gargoylesoftware.htmlunit.html.DomNodeUtil
;
import
com.gargoylesoftware.htmlunit.html.HtmlPage
;
import
hudson.FilePath
;
...
...
@@ -27,6 +28,7 @@ import java.net.URL;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.concurrent.Future
;
import
jenkins.model.Jenkins
;
import
static
org
.
hamcrest
.
Matchers
.
containsString
;
import
static
org
.
junit
.
Assert
.*;
import
org.junit.Rule
;
...
...
@@ -288,6 +290,12 @@ public class ConsoleAnnotatorTest {
// verify that there's an element inserted by the script
assertNotNull
(
html
.
getElementById
(
"inserted-by-test1"
));
assertNotNull
(
html
.
getElementById
(
"inserted-by-test2"
));
for
(
DomElement
e
:
html
.
getElementsByTagName
(
"script"
))
{
String
src
=
e
.
getAttribute
(
"src"
);
if
(!
src
.
isEmpty
())
{
assertThat
(
src
,
containsString
(
Jenkins
.
SESSION_HASH
));
}
}
}
public
static
final
class
JustToIncludeScript
extends
ConsoleNote
<
Object
>
{
...
...
test/src/test/resources/hudson/cli/huge-stdin.txt
0 → 100644
浏览文件 @
79384efd
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录