Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
c0815b50
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,发现更多精彩内容 >>
提交
c0815b50
编写于
2月 20, 2019
作者:
J
Josh Soref
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use StandardCharsets
上级
a43efeab
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
51 addition
and
56 deletion
+51
-56
core/src/main/java/hudson/Main.java
core/src/main/java/hudson/Main.java
+3
-2
core/src/main/java/hudson/TcpSlaveAgentListener.java
core/src/main/java/hudson/TcpSlaveAgentListener.java
+6
-9
core/src/main/java/hudson/UDPBroadcastThread.java
core/src/main/java/hudson/UDPBroadcastThread.java
+2
-1
core/src/main/java/hudson/model/Api.java
core/src/main/java/hudson/model/Api.java
+2
-1
core/src/main/java/hudson/model/DirectoryBrowserSupport.java
core/src/main/java/hudson/model/DirectoryBrowserSupport.java
+2
-1
core/src/main/java/hudson/model/UsageStatistics.java
core/src/main/java/hudson/model/UsageStatistics.java
+2
-1
core/src/main/java/hudson/model/View.java
core/src/main/java/hudson/model/View.java
+2
-1
core/src/main/java/hudson/org/apache/tools/tar/TarOutputStream.java
...ain/java/hudson/org/apache/tools/tar/TarOutputStream.java
+2
-1
core/src/main/java/hudson/scheduler/Hash.java
core/src/main/java/hudson/scheduler/Hash.java
+2
-3
core/src/main/java/hudson/security/csrf/CrumbIssuer.java
core/src/main/java/hudson/security/csrf/CrumbIssuer.java
+2
-1
core/src/main/java/hudson/util/ChunkedInputStream.java
core/src/main/java/hudson/util/ChunkedInputStream.java
+2
-1
core/src/main/java/hudson/util/ChunkedOutputStream.java
core/src/main/java/hudson/util/ChunkedOutputStream.java
+3
-2
core/src/main/java/hudson/util/SecretRewriter.java
core/src/main/java/hudson/util/SecretRewriter.java
+1
-1
core/src/main/java/hudson/util/Service.java
core/src/main/java/hudson/util/Service.java
+3
-2
core/src/main/java/hudson/util/jna/RegistryKey.java
core/src/main/java/hudson/util/jna/RegistryKey.java
+7
-14
core/src/main/java/jenkins/PluginSubtypeMarker.java
core/src/main/java/jenkins/PluginSubtypeMarker.java
+2
-1
core/src/main/java/jenkins/security/HMACConfidentialKey.java
core/src/main/java/jenkins/security/HMACConfidentialKey.java
+2
-5
core/src/main/java/jenkins/security/RSADigitalSignatureConfidentialKey.java
.../jenkins/security/RSADigitalSignatureConfidentialKey.java
+2
-3
core/src/main/java/jenkins/slaves/EncryptedSlaveAgentJnlpFile.java
...main/java/jenkins/slaves/EncryptedSlaveAgentJnlpFile.java
+2
-1
core/src/main/java/jenkins/util/MarkFindingOutputStream.java
core/src/main/java/jenkins/util/MarkFindingOutputStream.java
+2
-5
未找到文件。
core/src/main/java/hudson/Main.java
浏览文件 @
c0815b50
...
...
@@ -25,6 +25,7 @@ package hudson;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.file.Files
;
import
java.nio.file.InvalidPathException
;
import
jenkins.util.SystemProperties
;
...
...
@@ -97,7 +98,7 @@ public class Main {
// check for authentication info
String
auth
=
new
URL
(
home
).
getUserInfo
();
if
(
auth
!=
null
)
auth
=
"Basic "
+
new
Base64Encoder
().
encode
(
auth
.
getBytes
(
"UTF-8"
));
if
(
auth
!=
null
)
auth
=
"Basic "
+
new
Base64Encoder
().
encode
(
auth
.
getBytes
(
StandardCharsets
.
UTF_8
));
{
// check if the home is set correctly
HttpURLConnection
con
=
open
(
new
URL
(
home
));
...
...
@@ -143,7 +144,7 @@ public class Main {
try
{
int
ret
;
try
(
OutputStream
os
=
Files
.
newOutputStream
(
tmpFile
.
toPath
());
Writer
w
=
new
OutputStreamWriter
(
os
,
"UTF-8"
))
{
Writer
w
=
new
OutputStreamWriter
(
os
,
StandardCharsets
.
UTF_8
))
{
w
.
write
(
"<?xml version='1.1' encoding='UTF-8'?>"
);
w
.
write
(
"<run><log encoding='hexBinary' content-encoding='"
+
Charset
.
defaultCharset
().
name
()+
"'>"
);
w
.
flush
();
...
...
core/src/main/java/hudson/TcpSlaveAgentListener.java
浏览文件 @
c0815b50
...
...
@@ -28,6 +28,7 @@ import java.io.ByteArrayInputStream;
import
java.io.SequenceInputStream
;
import
java.io.Writer
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.security.interfaces.RSAPublicKey
;
import
javax.annotation.Nullable
;
...
...
@@ -236,7 +237,7 @@ public final class TcpSlaveAgentListener extends Thread {
DataInputStream
in
=
new
DataInputStream
(
s
.
getInputStream
());
PrintWriter
out
=
new
PrintWriter
(
new
BufferedWriter
(
new
OutputStreamWriter
(
s
.
getOutputStream
(),
"UTF-8"
)),
new
BufferedWriter
(
new
OutputStreamWriter
(
s
.
getOutputStream
(),
StandardCharsets
.
UTF_8
)),
true
);
// DEPRECATED: newer protocol shouldn't use PrintWriter but should use DataOutputStream
// peek the first few bytes to determine what to do with this client
...
...
@@ -291,7 +292,7 @@ public final class TcpSlaveAgentListener extends Thread {
*/
private
void
respondHello
(
String
header
,
Socket
s
)
throws
IOException
{
try
{
Writer
o
=
new
OutputStreamWriter
(
s
.
getOutputStream
(),
"UTF-8"
);
Writer
o
=
new
OutputStreamWriter
(
s
.
getOutputStream
(),
StandardCharsets
.
UTF_8
);
//TODO: expose version about minimum supported Remoting version (JENKINS-48766)
if
(
header
.
startsWith
(
"GET / "
))
{
...
...
@@ -358,11 +359,7 @@ public final class TcpSlaveAgentListener extends Thread {
private
final
byte
[]
ping
;
public
PingAgentProtocol
()
{
try
{
ping
=
"Ping\n"
.
getBytes
(
"UTF-8"
);
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
IllegalStateException
(
"JLS mandates support for UTF-8 charset"
,
e
);
}
ping
=
"Ping\n"
.
getBytes
(
StandardCharsets
.
UTF_8
);
}
/**
...
...
@@ -414,9 +411,9 @@ public final class TcpSlaveAgentListener extends Thread {
}
else
{
LOGGER
.
log
(
Level
.
FINE
,
"Expected ping response from {0} of {1} got {2}"
,
new
Object
[]{
socket
.
getRemoteSocketAddress
(),
new
String
(
ping
,
"UTF-8"
),
new
String
(
ping
,
StandardCharsets
.
UTF_8
),
responseLength
>
0
&&
responseLength
<=
response
.
length
?
new
String
(
response
,
0
,
responseLength
,
"UTF-8"
)
:
new
String
(
response
,
0
,
responseLength
,
StandardCharsets
.
UTF_8
)
:
"bad response length "
+
responseLength
});
return
false
;
...
...
core/src/main/java/hudson/UDPBroadcastThread.java
浏览文件 @
c0815b50
...
...
@@ -37,6 +37,7 @@ import java.net.SocketAddress;
import
java.net.SocketException
;
import
java.net.UnknownHostException
;
import
java.nio.channels.ClosedByInterruptException
;
import
java.nio.charset.StandardCharsets
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
...
...
@@ -99,7 +100,7 @@ public class UDPBroadcastThread extends Thread {
rsp
.
append
(
"</hudson>"
);
byte
[]
response
=
rsp
.
toString
().
getBytes
(
"UTF-8"
);
byte
[]
response
=
rsp
.
toString
().
getBytes
(
StandardCharsets
.
UTF_8
);
mcs
.
send
(
new
DatagramPacket
(
response
,
response
.
length
,
sender
));
}
}
catch
(
ClosedByInterruptException
e
)
{
...
...
core/src/main/java/hudson/model/Api.java
浏览文件 @
c0815b50
...
...
@@ -50,6 +50,7 @@ import java.io.OutputStream;
import
java.io.StringReader
;
import
java.io.StringWriter
;
import
java.net.HttpURLConnection
;
import
java.nio.charset.StandardCharsets
;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
...
...
@@ -188,7 +189,7 @@ public class Api extends AbstractModelObject {
// simple output allowed
rsp
.
setContentType
(
"text/plain;charset=UTF-8"
);
String
text
=
result
instanceof
CharacterData
?
((
CharacterData
)
result
).
getText
()
:
result
.
toString
();
o
.
write
(
text
.
getBytes
(
"UTF-8"
));
o
.
write
(
text
.
getBytes
(
StandardCharsets
.
UTF_8
));
return
;
}
...
...
core/src/main/java/hudson/model/DirectoryBrowserSupport.java
浏览文件 @
c0815b50
...
...
@@ -31,6 +31,7 @@ import java.io.InputStream;
import
java.io.OutputStream
;
import
java.io.Serializable
;
import
java.net.URL
;
import
java.nio.charset.StandardCharsets
;
import
java.text.Collator
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
...
...
@@ -244,7 +245,7 @@ public final class DirectoryBrowserSupport implements HttpResponse {
rsp
.
setContentType
(
"text/plain;charset=UTF-8"
);
try
(
OutputStream
os
=
rsp
.
getOutputStream
())
{
for
(
VirtualFile
kid
:
baseFile
.
list
())
{
os
.
write
(
kid
.
getName
().
getBytes
(
"UTF-8"
));
os
.
write
(
kid
.
getName
().
getBytes
(
StandardCharsets
.
UTF_8
));
if
(
kid
.
isDirectory
())
{
os
.
write
(
'/'
);
}
...
...
core/src/main/java/hudson/model/UsageStatistics.java
浏览文件 @
c0815b50
...
...
@@ -49,6 +49,7 @@ import java.io.OutputStream;
import
java.io.FilterInputStream
;
import
java.io.InputStream
;
import
java.io.DataInputStream
;
import
java.nio.charset.StandardCharsets
;
import
java.security.GeneralSecurityException
;
import
java.security.Key
;
import
java.security.KeyFactory
;
...
...
@@ -181,7 +182,7 @@ public class UsageStatistics extends PageDecorator implements PersistentDescript
// json -> UTF-8 encode -> gzip -> encrypt -> base64 -> string
try
(
OutputStream
cipheros
=
new
CombinedCipherOutputStream
(
baos
,
getKey
(),
"AES"
);
OutputStream
zipos
=
new
GZIPOutputStream
(
cipheros
);
OutputStreamWriter
w
=
new
OutputStreamWriter
(
zipos
,
"UTF-8"
))
{
OutputStreamWriter
w
=
new
OutputStreamWriter
(
zipos
,
StandardCharsets
.
UTF_8
))
{
o
.
write
(
w
);
}
...
...
core/src/main/java/hudson/model/View.java
浏览文件 @
c0815b50
...
...
@@ -99,6 +99,7 @@ import java.io.InputStream;
import
java.io.OutputStream
;
import
java.io.Serializable
;
import
java.io.StringWriter
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Calendar
;
...
...
@@ -1206,7 +1207,7 @@ public abstract class View extends AbstractModelObject implements AccessControll
}
// try to reflect the changes by reloading
try
(
InputStream
in
=
new
BufferedInputStream
(
new
ByteArrayInputStream
(
out
.
toString
().
getBytes
(
"UTF-8"
)))){
try
(
InputStream
in
=
new
BufferedInputStream
(
new
ByteArrayInputStream
(
out
.
toString
().
getBytes
(
StandardCharsets
.
UTF_8
)))){
// Do not allow overwriting view name as it might collide with another
// view in same ViewGroup and might not satisfy Jenkins.checkGoodName.
String
oldname
=
name
;
...
...
core/src/main/java/hudson/org/apache/tools/tar/TarOutputStream.java
浏览文件 @
c0815b50
...
...
@@ -30,6 +30,7 @@ import org.apache.tools.tar.TarEntry;
import
java.io.FilterOutputStream
;
import
java.io.OutputStream
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
/**
* The TarOutputStream writes a UNIX tar archive as an OutputStream.
...
...
@@ -186,7 +187,7 @@ public class TarOutputStream extends FilterOutputStream {
TarEntry
longLinkEntry
=
new
TarEntry
(
TarConstants
.
GNU_LONGLINK
,
TarConstants
.
LF_GNUTYPE_LONGNAME
);
byte
[]
name
=
entry
.
getName
().
getBytes
(
"UTF-8"
);
byte
[]
name
=
entry
.
getName
().
getBytes
(
StandardCharsets
.
UTF_8
);
longLinkEntry
.
setSize
(
name
.
length
+
1
);
putNextEntry
(
longLinkEntry
);
write
(
name
);
...
...
core/src/main/java/hudson/scheduler/Hash.java
浏览文件 @
c0815b50
...
...
@@ -24,6 +24,7 @@
package
hudson.scheduler
;
import
java.io.UnsupportedEncodingException
;
import
java.nio.charset.StandardCharsets
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.Random
;
...
...
@@ -55,7 +56,7 @@ public abstract class Hash {
public
static
Hash
from
(
String
seed
)
{
try
{
MessageDigest
md5
=
MessageDigest
.
getInstance
(
"MD5"
);
md5
.
update
(
seed
.
getBytes
(
"UTF-8"
));
md5
.
update
(
seed
.
getBytes
(
StandardCharsets
.
UTF_8
));
byte
[]
digest
=
md5
.
digest
();
for
(
int
i
=
8
;
i
<
digest
.
length
;
i
++)
...
...
@@ -74,8 +75,6 @@ public abstract class Hash {
};
}
catch
(
NoSuchAlgorithmException
e
)
{
throw
new
AssertionError
(
e
);
// MD5 is a part of JRE
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
AssertionError
(
e
);
// UTF-8 is mandatory
}
}
...
...
core/src/main/java/hudson/security/csrf/CrumbIssuer.java
浏览文件 @
c0815b50
...
...
@@ -24,6 +24,7 @@ import hudson.model.Descriptor;
import
hudson.util.MultipartFormDataParser
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.nio.charset.StandardCharsets
;
import
javax.servlet.ServletException
;
import
org.kohsuke.accmod.Restricted
;
import
org.kohsuke.accmod.restrictions.NoExternalUse
;
...
...
@@ -216,7 +217,7 @@ public abstract class CrumbIssuer implements Describable<CrumbIssuer>, Extension
if
(
text
!=
null
)
{
try
(
OutputStream
o
=
rsp
.
getCompressedOutputStream
(
req
))
{
rsp
.
setContentType
(
"text/plain;charset=UTF-8"
);
o
.
write
(
text
.
getBytes
(
"UTF-8"
));
o
.
write
(
text
.
getBytes
(
StandardCharsets
.
UTF_8
));
}
}
else
{
super
.
doXml
(
req
,
rsp
,
xpath
,
wrapper
,
tree
,
depth
);
...
...
core/src/main/java/hudson/util/ChunkedInputStream.java
浏览文件 @
c0815b50
...
...
@@ -33,6 +33,7 @@ package hudson.util;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.nio.charset.StandardCharsets
;
import
java.util.logging.Logger
;
...
...
@@ -266,7 +267,7 @@ public class ChunkedInputStream extends InputStream {
}
//parse data
String
dataString
=
new
String
(
baos
.
toByteArray
(),
"US-ASCII"
);
String
dataString
=
new
String
(
baos
.
toByteArray
(),
StandardCharsets
.
US_ASCII
);
int
separator
=
dataString
.
indexOf
(
';'
);
dataString
=
(
separator
>
0
)
?
dataString
.
substring
(
0
,
separator
).
trim
()
...
...
core/src/main/java/hudson/util/ChunkedOutputStream.java
浏览文件 @
c0815b50
...
...
@@ -32,6 +32,7 @@ package hudson.util;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.nio.charset.StandardCharsets
;
/**
* Implements HTTP chunking support. Writes are buffered to an internal buffer (2048 default size).
...
...
@@ -96,7 +97,7 @@ public class ChunkedOutputStream extends OutputStream {
*/
protected
void
flushCache
()
throws
IOException
{
if
(
cachePosition
>
0
)
{
byte
[]
chunkHeader
=
(
Integer
.
toHexString
(
cachePosition
)
+
"\r\n"
).
getBytes
(
"US-ASCII"
);
byte
[]
chunkHeader
=
(
Integer
.
toHexString
(
cachePosition
)
+
"\r\n"
).
getBytes
(
StandardCharsets
.
US_ASCII
);
stream
.
write
(
chunkHeader
,
0
,
chunkHeader
.
length
);
stream
.
write
(
cache
,
0
,
cachePosition
);
stream
.
write
(
ENDCHUNK
,
0
,
ENDCHUNK
.
length
);
...
...
@@ -115,7 +116,7 @@ public class ChunkedOutputStream extends OutputStream {
* @since 3.0
*/
protected
void
flushCacheWithAppend
(
byte
[]
bufferToAppend
,
int
off
,
int
len
)
throws
IOException
{
byte
[]
chunkHeader
=
(
Integer
.
toHexString
(
cachePosition
+
len
)
+
"\r\n"
).
getBytes
(
"US-ASCII"
);
byte
[]
chunkHeader
=
(
Integer
.
toHexString
(
cachePosition
+
len
)
+
"\r\n"
).
getBytes
(
StandardCharsets
.
US_ASCII
);
stream
.
write
(
chunkHeader
,
0
,
chunkHeader
.
length
);
stream
.
write
(
cache
,
0
,
cachePosition
);
stream
.
write
(
bufferToAppend
,
off
,
len
);
...
...
core/src/main/java/hudson/util/SecretRewriter.java
浏览文件 @
c0815b50
...
...
@@ -88,7 +88,7 @@ public class SecretRewriter {
boolean
modified
=
false
;
// did we actually change anything?
try
(
PrintWriter
out
=
new
PrintWriter
(
new
BufferedWriter
(
w
)))
{
try
(
InputStream
fin
=
Files
.
newInputStream
(
f
.
toPath
()))
{
BufferedReader
r
=
new
BufferedReader
(
new
InputStreamReader
(
fin
,
"UTF-8"
));
BufferedReader
r
=
new
BufferedReader
(
new
InputStreamReader
(
fin
,
StandardCharsets
.
UTF_8
));
String
line
;
StringBuilder
buf
=
new
StringBuilder
();
...
...
core/src/main/java/hudson/util/Service.java
浏览文件 @
c0815b50
...
...
@@ -27,6 +27,7 @@ import java.io.BufferedReader;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.net.URL
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Collection
;
import
java.util.Enumeration
;
import
java.util.List
;
...
...
@@ -50,7 +51,7 @@ public class Service {
final
Enumeration
<
URL
>
e
=
classLoader
.
getResources
(
"META-INF/services/"
+
type
.
getName
());
while
(
e
.
hasMoreElements
())
{
URL
url
=
e
.
nextElement
();
try
(
BufferedReader
configFile
=
new
BufferedReader
(
new
InputStreamReader
(
url
.
openStream
(),
"UTF-8"
)))
{
try
(
BufferedReader
configFile
=
new
BufferedReader
(
new
InputStreamReader
(
url
.
openStream
(),
StandardCharsets
.
UTF_8
)))
{
String
line
;
while
((
line
=
configFile
.
readLine
())
!=
null
)
{
line
=
line
.
trim
();
...
...
@@ -84,7 +85,7 @@ public class Service {
Enumeration
<
URL
>
e
=
cl
.
getResources
(
"META-INF/services/"
+
spi
.
getName
());
while
(
e
.
hasMoreElements
())
{
final
URL
url
=
e
.
nextElement
();
try
(
BufferedReader
r
=
new
BufferedReader
(
new
InputStreamReader
(
url
.
openStream
(),
"UTF-8"
)))
{
try
(
BufferedReader
r
=
new
BufferedReader
(
new
InputStreamReader
(
url
.
openStream
(),
StandardCharsets
.
UTF_8
)))
{
String
line
;
while
((
line
=
r
.
readLine
())
!=
null
)
{
if
(
line
.
startsWith
(
"#"
))
...
...
core/src/main/java/hudson/util/jna/RegistryKey.java
浏览文件 @
c0815b50
...
...
@@ -18,6 +18,7 @@ package hudson.util.jna;
import
com.sun.jna.ptr.IntByReference
;
import
java.io.UnsupportedEncodingException
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Collection
;
import
java.util.TreeMap
;
import
java.util.TreeSet
;
...
...
@@ -65,11 +66,7 @@ public class RegistryKey {
* @return String
*/
private
static
String
convertBufferToString
(
byte
[]
buf
)
{
try
{
return
new
String
(
buf
,
0
,
buf
.
length
-
2
,
"UTF-16LE"
);
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
AssertionError
(
e
);
// impossible
}
return
new
String
(
buf
,
0
,
buf
.
length
-
2
,
StandardCharsets
.
UTF_16LE
);
}
/**
...
...
@@ -128,15 +125,11 @@ public class RegistryKey {
* Writes a String value.
*/
public
void
setValue
(
String
name
,
String
value
)
{
try
{
byte
[]
bytes
=
value
.
getBytes
(
"UTF-16LE"
);
int
newLength
=
bytes
.
length
+
2
;
// for 0 padding
byte
[]
with0
=
new
byte
[
newLength
];
System
.
arraycopy
(
bytes
,
0
,
with0
,
0
,
newLength
);
check
(
Advapi32
.
INSTANCE
.
RegSetValueEx
(
handle
,
name
,
0
,
WINNT
.
REG_SZ
,
with0
,
with0
.
length
));
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
AssertionError
(
e
);
}
byte
[]
bytes
=
value
.
getBytes
(
StandardCharsets
.
UTF_16LE
);
int
newLength
=
bytes
.
length
+
2
;
// for 0 padding
byte
[]
with0
=
new
byte
[
newLength
];
System
.
arraycopy
(
bytes
,
0
,
with0
,
0
,
newLength
);
check
(
Advapi32
.
INSTANCE
.
RegSetValueEx
(
handle
,
name
,
0
,
WINNT
.
REG_SZ
,
with0
,
with0
.
length
));
}
/**
...
...
core/src/main/java/jenkins/PluginSubtypeMarker.java
浏览文件 @
c0815b50
...
...
@@ -46,6 +46,7 @@ import java.io.OutputStreamWriter;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
import
java.io.Writer
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Set
;
/**
...
...
@@ -110,7 +111,7 @@ public class PluginSubtypeMarker extends AbstractProcessor {
private
void
write
(
TypeElement
c
)
throws
IOException
{
FileObject
f
=
processingEnv
.
getFiler
().
createResource
(
StandardLocation
.
CLASS_OUTPUT
,
""
,
"META-INF/services/hudson.Plugin"
);
try
(
Writer
w
=
new
OutputStreamWriter
(
f
.
openOutputStream
(),
"UTF-8"
))
{
try
(
Writer
w
=
new
OutputStreamWriter
(
f
.
openOutputStream
(),
StandardCharsets
.
UTF_8
))
{
w
.
write
(
c
.
getQualifiedName
().
toString
());
}
}
...
...
core/src/main/java/jenkins/security/HMACConfidentialKey.java
浏览文件 @
c0815b50
...
...
@@ -8,6 +8,7 @@ import javax.crypto.SecretKey;
import
javax.crypto.spec.SecretKeySpec
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.nio.charset.StandardCharsets
;
import
java.security.GeneralSecurityException
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.Arrays
;
...
...
@@ -84,11 +85,7 @@ public class HMACConfidentialKey extends ConfidentialKey {
* While redundant, often convenient.
*/
public
String
mac
(
String
message
)
{
try
{
return
Util
.
toHexString
(
mac
(
message
.
getBytes
(
"UTF-8"
)));
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
AssertionError
(
e
);
}
return
Util
.
toHexString
(
mac
(
message
.
getBytes
(
StandardCharsets
.
UTF_8
)));
}
/**
...
...
core/src/main/java/jenkins/security/RSADigitalSignatureConfidentialKey.java
浏览文件 @
c0815b50
...
...
@@ -24,6 +24,7 @@
package
jenkins.security
;
import
java.io.UnsupportedEncodingException
;
import
java.nio.charset.StandardCharsets
;
import
java.security.GeneralSecurityException
;
import
java.security.Signature
;
import
java.security.interfaces.RSAPrivateKey
;
...
...
@@ -50,12 +51,10 @@ public class RSADigitalSignatureConfidentialKey extends RSAConfidentialKey {
RSAPrivateKey
key
=
getPrivateKey
();
Signature
sig
=
Signature
.
getInstance
(
SIGNING_ALGORITHM
+
"with"
+
key
.
getAlgorithm
());
sig
.
initSign
(
key
);
sig
.
update
(
msg
.
getBytes
(
"UTF-8"
));
sig
.
update
(
msg
.
getBytes
(
StandardCharsets
.
UTF_8
));
return
hudson
.
remoting
.
Base64
.
encode
(
sig
.
sign
());
}
catch
(
GeneralSecurityException
e
)
{
throw
new
SecurityException
(
e
);
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
AssertionError
(
e
);
// UTF-8 is mandatory
}
}
...
...
core/src/main/java/jenkins/slaves/EncryptedSlaveAgentJnlpFile.java
浏览文件 @
c0815b50
...
...
@@ -23,6 +23,7 @@ import javax.servlet.http.HttpServletResponseWrapper;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.nio.charset.StandardCharsets
;
import
java.security.GeneralSecurityException
;
import
java.security.SecureRandom
;
import
java.util.logging.Level
;
...
...
@@ -91,7 +92,7 @@ public class EncryptedSlaveAgentJnlpFile implements HttpResponse {
if
(
it
instanceof
SlaveComputer
)
{
jnlpMac
=
Util
.
fromHexString
(((
SlaveComputer
)
it
).
getJnlpMac
());
}
else
{
jnlpMac
=
JnlpSlaveAgentProtocol
.
SLAVE_SECRET
.
mac
(
slaveName
.
getBytes
(
"UTF-8"
));
jnlpMac
=
JnlpSlaveAgentProtocol
.
SLAVE_SECRET
.
mac
(
slaveName
.
getBytes
(
StandardCharsets
.
UTF_8
));
}
SecretKey
key
=
new
SecretKeySpec
(
jnlpMac
,
0
,
/* export restrictions */
128
/
8
,
"AES"
);
byte
[]
encrypted
;
...
...
core/src/main/java/jenkins/util/MarkFindingOutputStream.java
浏览文件 @
c0815b50
...
...
@@ -3,6 +3,7 @@ package jenkins.util;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.io.UnsupportedEncodingException
;
import
java.nio.charset.StandardCharsets
;
/**
* Filtering {@link OutputStream} that looks for {@link #MARK} in the output stream and notifies the callback.
...
...
@@ -109,10 +110,6 @@ public abstract class MarkFindingOutputStream extends OutputStream {
private
static
final
byte
[]
MBYTES
=
toUTF8
(
MARK
);
private
static
byte
[]
toUTF8
(
String
s
)
{
try
{
return
s
.
getBytes
(
"UTF-8"
);
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
AssertionError
(
e
);
}
return
s
.
getBytes
(
StandardCharsets
.
UTF_8
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录