Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
11719aa5
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
11719aa5
编写于
9月 23, 2016
作者:
R
robm
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
518d912e
5d9e65ad
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
401 addition
and
83 deletion
+401
-83
src/macosx/classes/sun/lwawt/LWWindowPeer.java
src/macosx/classes/sun/lwawt/LWWindowPeer.java
+1
-0
src/macosx/native/sun/awt/AWTWindow.m
src/macosx/native/sun/awt/AWTWindow.m
+6
-3
src/macosx/native/sun/awt/CGraphicsEnv.m
src/macosx/native/sun/awt/CGraphicsEnv.m
+1
-0
src/share/classes/java/util/Base64.java
src/share/classes/java/util/Base64.java
+2
-2
src/share/classes/sun/net/www/protocol/jar/JarURLConnection.java
...re/classes/sun/net/www/protocol/jar/JarURLConnection.java
+2
-0
src/share/classes/sun/security/ssl/SSLContextImpl.java
src/share/classes/sun/security/ssl/SSLContextImpl.java
+1
-1
src/windows/native/java/net/Inet4AddressImpl.c
src/windows/native/java/net/Inet4AddressImpl.c
+47
-3
test/TEST.groups
test/TEST.groups
+2
-0
test/java/awt/Focus/ModalDialogActivationTest/ModalDialogActivationTest.java
.../ModalDialogActivationTest/ModalDialogActivationTest.java
+96
-0
test/java/util/Base64/TestBase64.java
test/java/util/Base64/TestBase64.java
+120
-41
test/javax/management/security/keystoreAgent
test/javax/management/security/keystoreAgent
+0
-0
test/javax/management/security/keystoreClient
test/javax/management/security/keystoreClient
+0
-0
test/javax/management/security/truststoreAgent
test/javax/management/security/truststoreAgent
+0
-0
test/javax/management/security/truststoreClient
test/javax/management/security/truststoreClient
+0
-0
test/sun/net/www/protocol/jar/JarURLConnectionUseCaches.java
test/sun/net/www/protocol/jar/JarURLConnectionUseCaches.java
+63
-0
test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLContextImpl/TrustTrustedCert.java
...net/ssl/internal/ssl/SSLContextImpl/TrustTrustedCert.java
+60
-33
未找到文件。
src/macosx/classes/sun/lwawt/LWWindowPeer.java
浏览文件 @
11719aa5
...
...
@@ -183,6 +183,7 @@ public class LWWindowPeer
updateAlwaysOnTopState
();
updateMinimumSize
();
updateFocusableWindowState
();
final
Shape
shape
=
getTarget
().
getShape
();
if
(
shape
!=
null
)
{
...
...
src/macosx/native/sun/awt/AWTWindow.m
浏览文件 @
11719aa5
...
...
@@ -821,9 +821,12 @@ AWT_ASSERT_APPKIT_THREAD;
if
(
p
.
y
>=
(
frame
.
origin
.
y
+
contentRect
.
size
.
height
))
{
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnvUncached
];
jobject
platformWindow
=
[
self
.
javaPlatformWindow
jObjectWithEnv
:
env
];
// Currently, no need to deliver the whole NSEvent.
static
JNF_MEMBER_CACHE
(
jm_deliverNCMouseDown
,
jc_CPlatformWindow
,
"deliverNCMouseDown"
,
"()V"
);
JNFCallVoidMethod
(
env
,
platformWindow
,
jm_deliverNCMouseDown
);
if
(
platformWindow
!=
NULL
)
{
// Currently, no need to deliver the whole NSEvent.
static
JNF_MEMBER_CACHE
(
jm_deliverNCMouseDown
,
jc_CPlatformWindow
,
"deliverNCMouseDown"
,
"()V"
);
JNFCallVoidMethod
(
env
,
platformWindow
,
jm_deliverNCMouseDown
);
(
*
env
)
->
DeleteLocalRef
(
env
,
platformWindow
);
}
}
}
}
...
...
src/macosx/native/sun/awt/CGraphicsEnv.m
浏览文件 @
11719aa5
...
...
@@ -146,6 +146,7 @@ static void displaycb_handle
jc_CGraphicsEnvironment, "_displayReconfiguration","(IZ)V");
JNFCallVoidMethod(env, graphicsEnv, jm_displayReconfiguration,
(jint) display, (jboolean) flags & kCGDisplayRemoveFlag);
(*env)->DeleteLocalRef(env, graphicsEnv);
});
}];
}
...
...
src/share/classes/java/util/Base64.java
浏览文件 @
11719aa5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
6
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -788,7 +788,7 @@ public class Base64 {
public
void
write
(
byte
[]
b
,
int
off
,
int
len
)
throws
IOException
{
if
(
closed
)
throw
new
IOException
(
"Stream is closed"
);
if
(
off
<
0
||
len
<
0
||
off
+
len
>
b
.
length
)
if
(
off
<
0
||
len
<
0
||
len
>
b
.
length
-
off
)
throw
new
ArrayIndexOutOfBoundsException
();
if
(
len
==
0
)
return
;
...
...
src/share/classes/sun/net/www/protocol/jar/JarURLConnection.java
浏览文件 @
11719aa5
...
...
@@ -125,7 +125,9 @@ public class JarURLConnection extends java.net.JarURLConnection {
* to get the jarFile, and set it as our permission.
*/
if
(
getUseCaches
())
{
boolean
oldUseCaches
=
jarFileURLConnection
.
getUseCaches
();
jarFileURLConnection
=
factory
.
getConnection
(
jarFile
);
jarFileURLConnection
.
setUseCaches
(
oldUseCaches
);
}
if
((
entryName
!=
null
))
{
...
...
src/share/classes/sun/security/ssl/SSLContextImpl.java
浏览文件 @
11719aa5
...
...
@@ -1115,7 +1115,7 @@ final class AbstractTrustManagerWrapper extends X509ExtendedTrustManager
}
}
catch
(
CertPathValidatorException
cpve
)
{
throw
new
CertificateException
(
"Certificates do
es not conform to algorithm constraints"
);
"Certificates do
not conform to algorithm constraints"
,
cpve
);
}
}
}
...
...
src/windows/native/java/net/Inet4AddressImpl.c
浏览文件 @
11719aa5
...
...
@@ -33,6 +33,7 @@
#include <process.h>
#include <iphlpapi.h>
#include <icmpapi.h>
#include <WinError.h>
#include "java_net_InetAddress.h"
#include "java_net_Inet4AddressImpl.h"
...
...
@@ -481,7 +482,15 @@ ping4(JNIEnv *env,
DWORD
ReplySize
=
0
;
jboolean
ret
=
JNI_FALSE
;
ReplySize
=
sizeof
(
ICMP_ECHO_REPLY
)
+
sizeof
(
SendData
);
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa366051%28v=vs.85%29.aspx
ReplySize
=
sizeof
(
ICMP_ECHO_REPLY
)
// The buffer should be large enough
// to hold at least one ICMP_ECHO_REPLY
// structure
+
sizeof
(
SendData
)
// plus RequestSize bytes of data.
+
8
;
// This buffer should also be large enough
// to also hold 8 more bytes of data
// (the size of an ICMP error message)
ReplyBuffer
=
(
VOID
*
)
malloc
(
ReplySize
);
if
(
ReplyBuffer
==
NULL
)
{
IcmpCloseHandle
(
hIcmpFile
);
...
...
@@ -517,10 +526,45 @@ ping4(JNIEnv *env,
(
timeout
<
1000
)
?
1000
:
timeout
);
// DWORD Timeout
}
if
(
dwRetVal
!=
0
)
{
if
(
dwRetVal
==
0
)
{
// if the call failed
TCHAR
*
buf
;
DWORD
err
=
WSAGetLastError
();
switch
(
err
)
{
case
ERROR_NO_NETWORK
:
case
ERROR_NETWORK_UNREACHABLE
:
case
ERROR_HOST_UNREACHABLE
:
case
ERROR_PROTOCOL_UNREACHABLE
:
case
ERROR_PORT_UNREACHABLE
:
case
ERROR_REQUEST_ABORTED
:
case
ERROR_INCORRECT_ADDRESS
:
case
ERROR_HOST_DOWN
:
case
WSAEHOSTUNREACH
:
/* Host Unreachable */
case
WSAENETUNREACH
:
/* Network Unreachable */
case
WSAENETDOWN
:
/* Network is down */
case
WSAEPFNOSUPPORT
:
/* Protocol Family unsupported */
case
IP_REQ_TIMED_OUT
:
break
;
default:
FormatMessage
(
FORMAT_MESSAGE_ALLOCATE_BUFFER
|
FORMAT_MESSAGE_FROM_SYSTEM
,
NULL
,
err
,
MAKELANGID
(
LANG_NEUTRAL
,
SUBLANG_DEFAULT
),
(
LPTSTR
)
&
buf
,
0
,
NULL
);
NET_ThrowNew
(
env
,
err
,
buf
);
LocalFree
(
buf
);
break
;
}
}
else
{
PICMP_ECHO_REPLY
pEchoReply
=
(
PICMP_ECHO_REPLY
)
ReplyBuffer
;
if
((
int
)
pEchoReply
->
RoundTripTime
<=
timeout
)
// This is to take into account the undocumented minimum
// timeout mentioned in the IcmpSendEcho call above.
// We perform an extra check to make sure that our
// roundtrip time was less than our desired timeout
// for cases where that timeout is < 1000ms.
if
(
pEchoReply
->
Status
==
IP_SUCCESS
&&
(
int
)
pEchoReply
->
RoundTripTime
<=
timeout
)
{
ret
=
JNI_TRUE
;
}
}
free
(
ReplyBuffer
);
...
...
test/TEST.groups
浏览文件 @
11719aa5
...
...
@@ -394,6 +394,7 @@ needs_jre = \
javax/management/mxbean/LeakTest.java \
javax/management/mxbean/MXBeanTest.java \
javax/management/mxbean/PropertyNamesTest.java \
javax/xml/bind/marshal/8134111/UnmarshalTest.java \
javax/xml/ws/8043129 \
jdk/lambda/vm/InterfaceAccessFlagsTest.java \
sun/misc/URLClassPath/ClassnameCharTest.java \
...
...
@@ -566,6 +567,7 @@ needs_compact2 = \
java/net/HttpCookie/IllegalCookieNameTest.java \
java/net/HttpURLConnection/UnmodifiableMaps.java \
java/net/ResponseCache/Test.java \
java/net/SetFactoryPermission/SetFactoryPermission.java \
java/net/URLClassLoader/ClassLoad.java \
java/net/URLClassLoader/closetest/CloseTest.java \
java/net/URLPermission/URLTest.java \
...
...
test/java/awt/Focus/ModalDialogActivationTest/ModalDialogActivationTest.java
0 → 100644
浏览文件 @
11719aa5
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.event.*
;
/*
@test
@bug 8160570
@summary Tests that a modal dialog receives WINDOW_ACTIVATED & WINDOW_GAINED_FOCUS on first show.
*/
public
class
ModalDialogActivationTest
{
static
final
Object
lock
=
new
Object
();
static
volatile
boolean
activated
;
static
volatile
boolean
focused
;
public
static
void
main
(
String
[]
args
)
throws
InterruptedException
{
EventQueue
.
invokeLater
(()
->
runGUI
());
long
time
=
System
.
currentTimeMillis
();
synchronized
(
lock
)
{
while
(!
activated
||
!
focused
)
{
lock
.
wait
(
5000
);
if
(
System
.
currentTimeMillis
()
-
time
>=
5000
)
break
;
}
}
if
(!
activated
||
!
focused
)
{
throw
new
RuntimeException
(
"Test FAILED: activated: "
+
activated
+
", focused: "
+
focused
);
}
System
.
out
.
println
(
"Test PASSED"
);
}
static
void
runGUI
()
{
JFrame
f
=
new
JFrame
(
"frame"
);
final
JDialog
d
=
new
MyModalDialog
(
f
,
"dialog"
);
d
.
addWindowListener
(
new
WindowAdapter
()
{
@Override
public
void
windowActivated
(
WindowEvent
e
)
{
synchronized
(
lock
)
{
activated
=
true
;
lock
.
notifyAll
();
}
}
});
d
.
addWindowFocusListener
(
new
WindowAdapter
()
{
@Override
public
void
windowGainedFocus
(
WindowEvent
e
)
{
synchronized
(
lock
)
{
focused
=
true
;
lock
.
notifyAll
();
}
}
});
f
.
setVisible
(
true
);
d
.
setVisible
(
true
);
}
static
class
MyModalDialog
extends
JDialog
{
public
MyModalDialog
(
Frame
owner
,
String
title
)
ª
{
super
(
owner
,
title
,
true
);
}
@Override
public
boolean
getFocusableWindowState
()
{
try
{
// let Toolkit thread go ahead
Thread
.
sleep
(
100
);
}
catch
(
InterruptedException
ignore
)
{
}
return
super
.
getFocusableWindowState
();
}
}
}
test/java/util/Base64/TestBase64.java
浏览文件 @
11719aa5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
6
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -23,8 +23,11 @@
/**
* @test 4235519 8004212 8005394 8007298 8006295 8006315 8006530 8007379 8008925
* 8014217 8025003 8026330 8028397
* 8014217 8025003 8026330 8028397
8165243
* @summary tests java.util.Base64
* @library /lib/testlibrary
* @build jdk.testlibrary.*
* @run main TestBase64
*/
import
java.io.ByteArrayInputStream
;
...
...
@@ -34,11 +37,17 @@ import java.io.IOException;
import
java.io.OutputStream
;
import
java.nio.ByteBuffer
;
import
java.util.Arrays
;
import
java.util.ArrayList
;
import
java.util.Base64
;
import
java.util.List
;
import
java.util.Random
;
import
jdk.testlibrary.RandomFactory
;
public
class
TestBase64
{
private
static
final
Random
rnd
=
RandomFactory
.
getRandom
();
public
static
void
main
(
String
args
[])
throws
Throwable
{
int
numRuns
=
10
;
int
numBytes
=
200
;
...
...
@@ -51,7 +60,6 @@ public class TestBase64 {
test
(
Base64
.
getUrlEncoder
(),
Base64
.
getUrlDecoder
(),
numRuns
,
numBytes
);
test
(
Base64
.
getMimeEncoder
(),
Base64
.
getMimeDecoder
(),
numRuns
,
numBytes
);
Random
rnd
=
new
java
.
util
.
Random
();
byte
[]
nl_1
=
new
byte
[]
{
'\n'
};
byte
[]
nl_2
=
new
byte
[]
{
'\n'
,
'\r'
};
byte
[]
nl_3
=
new
byte
[]
{
'\n'
,
'\r'
,
'\n'
};
...
...
@@ -75,7 +83,7 @@ public class TestBase64 {
testNull
(
Base64
.
getDecoder
());
testNull
(
Base64
.
getUrlDecoder
());
testNull
(
Base64
.
getMimeDecoder
());
checkNull
(
new
Runnable
()
{
public
void
run
()
{
Base64
.
getMimeEncoder
(
10
,
null
);
}}
);
checkNull
(
()
->
Base64
.
getMimeEncoder
(
10
,
null
)
);
testIOE
(
Base64
.
getEncoder
());
testIOE
(
Base64
.
getUrlEncoder
());
...
...
@@ -83,26 +91,23 @@ public class TestBase64 {
testIOE
(
Base64
.
getMimeEncoder
(
10
,
new
byte
[]{
'\n'
}));
byte
[]
src
=
new
byte
[
1024
];
new
Random
()
.
nextBytes
(
src
);
rnd
.
nextBytes
(
src
);
final
byte
[]
decoded
=
Base64
.
getEncoder
().
encode
(
src
);
testIOE
(
Base64
.
getDecoder
(),
decoded
);
testIOE
(
Base64
.
getMimeDecoder
(),
decoded
);
testIOE
(
Base64
.
getUrlDecoder
(),
Base64
.
getUrlEncoder
().
encode
(
src
));
// illegal line separator
checkIAE
(
new
Runnable
()
{
public
void
run
()
{
Base64
.
getMimeEncoder
(
10
,
new
byte
[]{
'\r'
,
'N'
});
}}
);
checkIAE
(
()
->
Base64
.
getMimeEncoder
(
10
,
new
byte
[]{
'\r'
,
'N'
})
);
// malformed padding/ending
testMalformedPadding
();
// illegal base64 character
decoded
[
2
]
=
(
byte
)
0xe0
;
checkIAE
(
new
Runnable
()
{
public
void
run
()
{
Base64
.
getDecoder
().
decode
(
decoded
);
}});
checkIAE
(
new
Runnable
()
{
public
void
run
()
{
Base64
.
getDecoder
().
decode
(
decoded
,
new
byte
[
1024
]);
}});
checkIAE
(
new
Runnable
()
{
public
void
run
()
{
Base64
.
getDecoder
().
decode
(
ByteBuffer
.
wrap
(
decoded
));
}});
checkIAE
(()
->
Base64
.
getDecoder
().
decode
(
decoded
));
checkIAE
(()
->
Base64
.
getDecoder
().
decode
(
decoded
,
new
byte
[
1024
]));
checkIAE
(()
->
Base64
.
getDecoder
().
decode
(
ByteBuffer
.
wrap
(
decoded
)));
// test single-non-base64 character for mime decoding
testSingleNonBase64MimeDec
();
...
...
@@ -112,6 +117,16 @@ public class TestBase64 {
// test mime decoding with ignored character after padding
testDecodeIgnoredAfterPadding
();
// given invalid args, encoder should not produce output
testEncoderKeepsSilence
(
Base64
.
getEncoder
());
testEncoderKeepsSilence
(
Base64
.
getUrlEncoder
());
testEncoderKeepsSilence
(
Base64
.
getMimeEncoder
());
// given invalid args, decoder should not consume input
testDecoderKeepsAbstinence
(
Base64
.
getDecoder
());
testDecoderKeepsAbstinence
(
Base64
.
getUrlDecoder
());
testDecoderKeepsAbstinence
(
Base64
.
getMimeDecoder
());
}
private
static
sun
.
misc
.
BASE64Encoder
sunmisc
=
new
sun
.
misc
.
BASE64Encoder
();
...
...
@@ -282,48 +297,49 @@ public class TestBase64 {
private
static
final
String
str_null
=
null
;
private
static
final
ByteBuffer
bb_null
=
null
;
private
static
void
testNull
(
final
Base64
.
Encoder
enc
)
{
checkNull
(
new
Runnable
()
{
public
void
run
()
{
enc
.
encode
(
ba_null
);
}}
);
checkNull
(
new
Runnable
()
{
public
void
run
()
{
enc
.
encodeToString
(
ba_null
);
}}
);
checkNull
(
new
Runnable
()
{
public
void
run
()
{
enc
.
encode
(
ba_null
,
new
byte
[
10
]);
}}
);
checkNull
(
new
Runnable
()
{
public
void
run
()
{
enc
.
encode
(
new
byte
[
10
],
ba_null
);
}}
);
checkNull
(
new
Runnable
()
{
public
void
run
()
{
enc
.
encode
(
bb_null
);
}}
);
checkNull
(
new
Runnable
()
{
public
void
run
()
{
enc
.
wrap
((
OutputStream
)
null
);
}}
);
private
static
void
testNull
(
Base64
.
Encoder
enc
)
{
checkNull
(
()
->
enc
.
encode
(
ba_null
)
);
checkNull
(
()
->
enc
.
encodeToString
(
ba_null
)
);
checkNull
(
()
->
enc
.
encode
(
ba_null
,
new
byte
[
10
])
);
checkNull
(
()
->
enc
.
encode
(
new
byte
[
10
],
ba_null
)
);
checkNull
(
()
->
enc
.
encode
(
bb_null
)
);
checkNull
(
()
->
enc
.
wrap
((
OutputStream
)
null
)
);
}
private
static
void
testNull
(
final
Base64
.
Decoder
dec
)
{
checkNull
(
new
Runnable
()
{
public
void
run
()
{
dec
.
decode
(
ba_null
);
}}
);
checkNull
(
new
Runnable
()
{
public
void
run
()
{
dec
.
decode
(
str_null
);
}}
);
checkNull
(
new
Runnable
()
{
public
void
run
()
{
dec
.
decode
(
ba_null
,
new
byte
[
10
]);
}}
);
checkNull
(
new
Runnable
()
{
public
void
run
()
{
dec
.
decode
(
new
byte
[
10
],
ba_null
);
}}
);
checkNull
(
new
Runnable
()
{
public
void
run
()
{
dec
.
decode
(
bb_null
);
}}
);
checkNull
(
new
Runnable
()
{
public
void
run
()
{
dec
.
wrap
((
InputStream
)
null
);
}}
);
private
static
void
testNull
(
Base64
.
Decoder
dec
)
{
checkNull
(
()
->
dec
.
decode
(
ba_null
)
);
checkNull
(
()
->
dec
.
decode
(
str_null
)
);
checkNull
(
()
->
dec
.
decode
(
ba_null
,
new
byte
[
10
])
);
checkNull
(
()
->
dec
.
decode
(
new
byte
[
10
],
ba_null
)
);
checkNull
(
()
->
dec
.
decode
(
bb_null
)
);
checkNull
(
()
->
dec
.
wrap
((
InputStream
)
null
)
);
}
@FunctionalInterface
private
static
interface
Testable
{
public
void
test
()
throws
Throwable
;
}
private
static
void
testIOE
(
final
Base64
.
Encoder
enc
)
throws
Throwable
{
private
static
void
testIOE
(
Base64
.
Encoder
enc
)
throws
Throwable
{
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
(
8192
);
final
OutputStream
os
=
enc
.
wrap
(
baos
);
OutputStream
os
=
enc
.
wrap
(
baos
);
os
.
write
(
new
byte
[]
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
});
os
.
close
();
checkIOE
(
new
Testable
()
{
public
void
test
()
throws
Throwable
{
os
.
write
(
10
);
}}
);
checkIOE
(
new
Testable
()
{
public
void
test
()
throws
Throwable
{
os
.
write
(
new
byte
[]
{
10
});
}}
);
checkIOE
(
new
Testable
()
{
public
void
test
()
throws
Throwable
{
os
.
write
(
new
byte
[]
{
10
},
1
,
4
);
}}
);
checkIOE
(
()
->
os
.
write
(
10
)
);
checkIOE
(
()
->
os
.
write
(
new
byte
[]
{
10
})
);
checkIOE
(
()
->
os
.
write
(
new
byte
[]
{
10
},
1
,
4
)
);
}
private
static
void
testIOE
(
final
Base64
.
Decoder
dec
,
byte
[]
decoded
)
throws
Throwable
{
private
static
void
testIOE
(
Base64
.
Decoder
dec
,
byte
[]
decoded
)
throws
Throwable
{
ByteArrayInputStream
bais
=
new
ByteArrayInputStream
(
decoded
);
final
InputStream
is
=
dec
.
wrap
(
bais
);
InputStream
is
=
dec
.
wrap
(
bais
);
is
.
read
(
new
byte
[
10
]);
is
.
close
();
checkIOE
(
new
Testable
()
{
public
void
test
()
throws
Throwable
{
is
.
read
();
}}
);
checkIOE
(
new
Testable
()
{
public
void
test
()
throws
Throwable
{
is
.
read
(
new
byte
[]
{
10
});
}}
);
checkIOE
(
new
Testable
()
{
public
void
test
()
throws
Throwable
{
is
.
read
(
new
byte
[]
{
10
},
1
,
4
);
}}
);
checkIOE
(
new
Testable
()
{
public
void
test
()
throws
Throwable
{
is
.
available
();
}}
);
checkIOE
(
new
Testable
()
{
public
void
test
()
throws
Throwable
{
is
.
skip
(
20
);
}}
);
checkIOE
(
()
->
is
.
read
()
);
checkIOE
(
()
->
is
.
read
(
new
byte
[]
{
10
})
);
checkIOE
(
()
->
is
.
read
(
new
byte
[]
{
10
},
1
,
4
)
);
checkIOE
(
()
->
is
.
available
()
);
checkIOE
(
()
->
is
.
skip
(
20
)
);
}
private
static
final
void
checkNull
(
Runnable
r
)
{
...
...
@@ -415,13 +431,13 @@ public class TestBase64 {
int
pos
=
(
Integer
)
data
[
i
+
2
];
// decode(byte[])
checkIAE
(
new
Runnable
()
{
public
void
run
()
{
dec
.
decode
(
srcBytes
);
}}
);
checkIAE
(
()
->
dec
.
decode
(
srcBytes
)
);
// decode(String)
checkIAE
(
new
Runnable
()
{
public
void
run
()
{
dec
.
decode
(
srcStr
);
}}
);
checkIAE
(
()
->
dec
.
decode
(
srcStr
)
);
// decode(ByteBuffer)
checkIAE
(
new
Runnable
()
{
public
void
run
()
{
dec
.
decode
(
srcBB
);
}}
);
checkIAE
(
()
->
dec
.
decode
(
srcBB
)
);
// wrap stream
checkIOE
(
new
Testable
()
{
...
...
@@ -531,4 +547,67 @@ public class TestBase64 {
}
return
ret
;
}
private
static
void
testEncoderKeepsSilence
(
Base64
.
Encoder
enc
)
throws
Throwable
{
List
<
Integer
>
vals
=
Arrays
.
asList
(
Integer
.
MIN_VALUE
,
Integer
.
MIN_VALUE
+
1
,
-
1111
,
-
2
,
-
1
,
0
,
1
,
2
,
3
,
1111
,
Integer
.
MAX_VALUE
-
1
,
Integer
.
MAX_VALUE
,
rnd
.
nextInt
(),
rnd
.
nextInt
(),
rnd
.
nextInt
(),
rnd
.
nextInt
());
byte
[]
buf
=
new
byte
[]
{
1
,
0
,
91
};
for
(
int
off
:
vals
)
{
for
(
int
len
:
vals
)
{
if
(
off
>=
0
&&
len
>=
0
&&
off
<=
buf
.
length
-
len
)
{
// valid args, skip them
continue
;
}
// invalid args, test them
System
.
out
.
println
(
"testing off="
+
off
+
", len="
+
len
);
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
(
100
);
try
(
OutputStream
os
=
enc
.
wrap
(
baos
))
{
os
.
write
(
buf
,
off
,
len
);
throw
new
RuntimeException
(
"Expected IOOBEx was not thrown"
);
}
catch
(
IndexOutOfBoundsException
expected
)
{
}
if
(
baos
.
size
()
>
0
)
throw
new
RuntimeException
(
"No output was expected, but got "
+
baos
.
size
()
+
" bytes"
);
}
}
}
private
static
void
testDecoderKeepsAbstinence
(
Base64
.
Decoder
dec
)
throws
Throwable
{
List
<
Integer
>
vals
=
Arrays
.
asList
(
Integer
.
MIN_VALUE
,
Integer
.
MIN_VALUE
+
1
,
-
1111
,
-
2
,
-
1
,
0
,
1
,
2
,
3
,
1111
,
Integer
.
MAX_VALUE
-
1
,
Integer
.
MAX_VALUE
,
rnd
.
nextInt
(),
rnd
.
nextInt
(),
rnd
.
nextInt
(),
rnd
.
nextInt
());
byte
[]
buf
=
new
byte
[
3
];
for
(
int
off
:
vals
)
{
for
(
int
len
:
vals
)
{
if
(
off
>=
0
&&
len
>=
0
&&
off
<=
buf
.
length
-
len
)
{
// valid args, skip them
continue
;
}
// invalid args, test them
System
.
out
.
println
(
"testing off="
+
off
+
", len="
+
len
);
String
input
=
"AAAAAAAAAAAAAAAAAAAAAA"
;
ByteArrayInputStream
bais
=
new
ByteArrayInputStream
(
input
.
getBytes
(
"Latin1"
));
try
(
InputStream
is
=
dec
.
wrap
(
bais
))
{
is
.
read
(
buf
,
off
,
len
);
throw
new
RuntimeException
(
"Expected IOOBEx was not thrown"
);
}
catch
(
IndexOutOfBoundsException
expected
)
{
}
if
(
bais
.
available
()
!=
input
.
length
())
throw
new
RuntimeException
(
"No input should be consumed, "
+
"but consumed "
+
(
input
.
length
()
-
bais
.
available
())
+
" bytes"
);
}
}
}
}
test/javax/management/security/keystoreAgent
0 → 100644
浏览文件 @
11719aa5
文件已添加
test/javax/management/security/keystoreClient
0 → 100644
浏览文件 @
11719aa5
文件已添加
test/javax/management/security/truststoreAgent
0 → 100644
浏览文件 @
11719aa5
文件已添加
test/javax/management/security/truststoreClient
0 → 100644
浏览文件 @
11719aa5
文件已添加
test/sun/net/www/protocol/jar/JarURLConnectionUseCaches.java
0 → 100644
浏览文件 @
11719aa5
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6947916
* @summary JarURLConnection does not handle useCaches correctly
* @run main/othervm JarURLConnectionUseCaches
*/
import
java.io.*
;
import
java.net.JarURLConnection
;
import
java.net.URL
;
import
java.util.jar.*
;
public
class
JarURLConnectionUseCaches
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
JarOutputStream
out
=
new
JarOutputStream
(
new
FileOutputStream
(
"usecache.jar"
));
out
.
putNextEntry
(
new
JarEntry
(
"test.txt"
));
out
.
write
(
"Test txt file"
.
getBytes
());
out
.
closeEntry
();
out
.
close
();
URL
url
=
new
URL
(
"jar:"
+
new
File
(
"."
).
toURI
().
toString
()
+
"/usecache.jar!/test.txt"
);
JarURLConnection
c1
=
(
JarURLConnection
)
url
.
openConnection
();
c1
.
setDefaultUseCaches
(
false
);
c1
.
setUseCaches
(
true
);
c1
.
connect
();
JarURLConnection
c2
=
(
JarURLConnection
)
url
.
openConnection
();
c2
.
setDefaultUseCaches
(
false
);
c2
.
setUseCaches
(
true
);
c2
.
connect
();
c1
.
getInputStream
().
close
();
c2
.
getInputStream
().
read
();
c2
.
getInputStream
().
close
();
}
}
test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLContextImpl/TrustTrustedCert.java
浏览文件 @
11719aa5
...
...
@@ -30,12 +30,13 @@
/*
* @test
* @bug 7113275
* @bug 7113275
8164846
* @summary compatibility issue with MD2 trust anchor and old X509TrustManager
* @run main/othervm TrustTrustedCert PKIX TLSv1.1
* @run main/othervm TrustTrustedCert SunX509 TLSv1.1
* @run main/othervm TrustTrustedCert PKIX TLSv1.2
* @run main/othervm TrustTrustedCert SunX509 TLSv1.2
* @run main/othervm TrustTrustedCert PKIX TLSv1.1 true
* @run main/othervm TrustTrustedCert PKIX TLSv1.1 false
* @run main/othervm TrustTrustedCert SunX509 TLSv1.1 false
* @run main/othervm TrustTrustedCert PKIX TLSv1.2 false
* @run main/othervm TrustTrustedCert SunX509 TLSv1.2 false
*/
import
java.net.*
;
...
...
@@ -181,23 +182,32 @@ public class TrustTrustedCert {
Thread
.
sleep
(
50
);
}
SSLContext
context
=
generateSSLContext
();
SSLSocketFactory
sslsf
=
context
.
getSocketFactory
();
SSLSocket
sslSocket
=
(
SSLSocket
)
sslsf
.
createSocket
(
"localhost"
,
serverPort
);
// enable the specified TLS protocol
sslSocket
.
setEnabledProtocols
(
new
String
[]
{
tlsProtocol
});
InputStream
sslIS
=
sslSocket
.
getInputStream
();
OutputStream
sslOS
=
sslSocket
.
getOutputStream
();
sslOS
.
write
(
'B'
);
sslOS
.
flush
();
sslIS
.
read
();
sslSocket
.
close
();
SSLSocket
sslSocket
=
null
;
try
{
SSLContext
context
=
generateSSLContext
();
SSLSocketFactory
sslsf
=
context
.
getSocketFactory
();
sslSocket
=
(
SSLSocket
)
sslsf
.
createSocket
(
"localhost"
,
serverPort
);
// enable the specified TLS protocol
sslSocket
.
setEnabledProtocols
(
new
String
[]
{
tlsProtocol
});
InputStream
sslIS
=
sslSocket
.
getInputStream
();
OutputStream
sslOS
=
sslSocket
.
getOutputStream
();
sslOS
.
write
(
'B'
);
sslOS
.
flush
();
sslIS
.
read
();
}
catch
(
SSLHandshakeException
e
)
{
// focus in on the CertPathValidatorException
Throwable
t
=
e
.
getCause
().
getCause
();
if
((
t
==
null
)
||
(
expectFail
&&
!
t
.
toString
().
contains
(
"MD5withRSA"
)))
{
throw
new
RuntimeException
(
"Expected to see MD5withRSA in exception output "
+
t
);
}
}
finally
{
if
(
sslSocket
!=
null
)
sslSocket
.
close
();
}
}
/*
...
...
@@ -206,10 +216,13 @@ public class TrustTrustedCert {
*/
private
static
String
tmAlgorithm
;
// trust manager
private
static
String
tlsProtocol
;
// trust manager
// set this flag to test context of CertificateException
private
static
boolean
expectFail
;
private
static
void
parseArguments
(
String
[]
args
)
{
tmAlgorithm
=
args
[
0
];
tlsProtocol
=
args
[
1
];
expectFail
=
Boolean
.
parseBoolean
(
args
[
2
]);
}
private
static
SSLContext
generateSSLContext
()
throws
Exception
{
...
...
@@ -232,7 +245,7 @@ public class TrustTrustedCert {
// generate the private key.
PKCS8EncodedKeySpec
priKeySpec
=
new
PKCS8EncodedKeySpec
(
Base64
.
getMimeDecoder
().
decode
(
targetPrivateKey
));
Base64
.
getMimeDecoder
().
decode
(
targetPrivateKey
));
KeyFactory
kf
=
KeyFactory
.
getInstance
(
"RSA"
);
RSAPrivateKey
priKey
=
(
RSAPrivateKey
)
kf
.
generatePrivate
(
priKeySpec
);
...
...
@@ -338,20 +351,25 @@ public class TrustTrustedCert {
volatile
Exception
clientException
=
null
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// MD5 is used in this test case, don't disable MD5 algorithm.
Security
.
setProperty
(
"jdk.certpath.disabledAlgorithms"
,
/*
* Get the customized arguments.
*/
parseArguments
(
args
);
/*
* MD5 is used in this test case, don't disable MD5 algorithm.
* if expectFail is set, we're testing exception message
*/
if
(!
expectFail
)
{
Security
.
setProperty
(
"jdk.certpath.disabledAlgorithms"
,
"MD2, RSA keySize < 1024"
);
}
Security
.
setProperty
(
"jdk.tls.disabledAlgorithms"
,
"SSLv3, RC4, DH keySize < 768"
);
if
(
debug
)
System
.
setProperty
(
"javax.net.debug"
,
"all"
);
/*
* Get the customized arguments.
*/
parseArguments
(
args
);
/*
* Start the tests.
*/
...
...
@@ -376,7 +394,8 @@ public class TrustTrustedCert {
startServer
(
false
);
}
}
catch
(
Exception
e
)
{
// swallow for now. Show later
System
.
out
.
println
(
"Unexpected exception: "
);
e
.
printStackTrace
();
}
/*
...
...
@@ -440,7 +459,11 @@ public class TrustTrustedCert {
*/
System
.
err
.
println
(
"Server died..."
);
serverReady
=
true
;
serverException
=
e
;
if
(!
expectFail
)
{
// only record if we weren't expecting.
// client side will record exception
serverException
=
e
;
}
}
}
};
...
...
@@ -449,7 +472,11 @@ public class TrustTrustedCert {
try
{
doServerSide
();
}
catch
(
Exception
e
)
{
serverException
=
e
;
// only record if we weren't expecting.
// client side will record exception
if
(!
expectFail
)
{
serverException
=
e
;
}
}
finally
{
serverReady
=
true
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录