Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
0963f6fc
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
3
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0963f6fc
编写于
2月 27, 2015
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
d87c5db5
72ba9f0a
变更
35
隐藏空白更改
内联
并排
Showing
35 changed file
with
1591 addition
and
150 deletion
+1591
-150
.hgtags
.hgtags
+4
-0
make/data/charsetmapping/IBM1166.c2b
make/data/charsetmapping/IBM1166.c2b
+1
-0
make/data/charsetmapping/IBM1166.map
make/data/charsetmapping/IBM1166.map
+256
-0
make/data/charsetmapping/IBM1166.nr
make/data/charsetmapping/IBM1166.nr
+1
-0
make/data/charsetmapping/extsbcs
make/data/charsetmapping/extsbcs
+1
-0
src/macosx/classes/com/apple/laf/AquaIcon.java
src/macosx/classes/com/apple/laf/AquaIcon.java
+1
-1
src/macosx/classes/sun/awt/CGraphicsDevice.java
src/macosx/classes/sun/awt/CGraphicsDevice.java
+7
-3
src/share/classes/com/sun/crypto/provider/GHASH.java
src/share/classes/com/sun/crypto/provider/GHASH.java
+86
-57
src/share/classes/java/math/BigDecimal.java
src/share/classes/java/math/BigDecimal.java
+53
-23
src/share/classes/java/net/SocksSocketImpl.java
src/share/classes/java/net/SocksSocketImpl.java
+6
-8
src/share/classes/java/util/ComparableTimSort.java
src/share/classes/java/util/ComparableTimSort.java
+5
-1
src/share/classes/java/util/TimSort.java
src/share/classes/java/util/TimSort.java
+5
-1
src/share/classes/java/util/zip/ZipEntry.java
src/share/classes/java/util/zip/ZipEntry.java
+3
-6
src/share/classes/javax/swing/JComponent.java
src/share/classes/javax/swing/JComponent.java
+0
-9
src/share/classes/javax/swing/JMenu.java
src/share/classes/javax/swing/JMenu.java
+2
-1
src/share/classes/javax/swing/JTree.java
src/share/classes/javax/swing/JTree.java
+49
-14
src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java
src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java
+8
-0
src/share/classes/sun/tools/jconsole/resources/messages_ja.properties
...asses/sun/tools/jconsole/resources/messages_ja.properties
+1
-1
src/share/classes/sun/tools/jconsole/resources/messages_zh_CN.properties
...es/sun/tools/jconsole/resources/messages_zh_CN.properties
+1
-1
src/solaris/native/sun/nio/ch/sctp/SctpChannelImpl.c
src/solaris/native/sun/nio/ch/sctp/SctpChannelImpl.c
+1
-6
src/windows/native/java/lang/ProcessImpl_md.c
src/windows/native/java/lang/ProcessImpl_md.c
+13
-12
test/com/sun/crypto/provider/Cipher/AES/TestGHASH.java
test/com/sun/crypto/provider/Cipher/AES/TestGHASH.java
+166
-0
test/com/sun/nio/sctp/SctpMultiChannel/SendFailed.java
test/com/sun/nio/sctp/SctpMultiChannel/SendFailed.java
+189
-0
test/java/math/BigDecimal/DivideTests.java
test/java/math/BigDecimal/DivideTests.java
+54
-2
test/java/net/Socks/BadProxySelector.java
test/java/net/Socks/BadProxySelector.java
+85
-0
test/java/nio/charset/Charset/RegisteredCharsets.java
test/java/nio/charset/Charset/RegisteredCharsets.java
+9
-0
test/java/nio/charset/RemovingSunIO/SunioAlias.java
test/java/nio/charset/RemovingSunIO/SunioAlias.java
+6
-0
test/java/util/Arrays/TimSortStackSize2.java
test/java/util/Arrays/TimSortStackSize2.java
+174
-0
test/java/util/zip/TestExtraTime.java
test/java/util/zip/TestExtraTime.java
+25
-1
test/javax/accessibility/8069268/bug8069268.java
test/javax/accessibility/8069268/bug8069268.java
+59
-0
test/javax/swing/JMenu/8071705/bug8071705.java
test/javax/swing/JMenu/8071705/bug8071705.java
+207
-0
test/javax/swing/JTree/8072676/TreeClipTest.java
test/javax/swing/JTree/8072676/TreeClipTest.java
+97
-0
test/sun/nio/cs/CheckHistoricalNames.java
test/sun/nio/cs/CheckHistoricalNames.java
+1
-0
test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java
test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java
+2
-1
test/sun/security/tools/keytool/ListKeychainStore.sh
test/sun/security/tools/keytool/ListKeychainStore.sh
+13
-2
未找到文件。
.hgtags
浏览文件 @
0963f6fc
...
...
@@ -373,6 +373,10 @@ fc4f5546417071c70cffd89ca83302309f6f7da9 jdk8u40-b17
5c31204d19e5976f025026db3d5c17331e8c44db jdk8u40-b19
7784dab075ed82be2275f4694164bbb9cc1cde3f jdk8u40-b20
564bca490631e4ed4f7993e6633ed9ee62067624 jdk8u40-b21
d168113f9841a77b3cee3a6a45fcd85b7351ac90 jdk8u40-b22
41fe61722ce96b75dd3a1ba5072473122e21e5a0 jdk8u40-b23
9d903721276c8684706db7ecfb6cda568e9f4f69 jdk8u40-b24
f0d5cb59b0e6a67fa102465458cc4725c6e59089 jdk8u40-b25
5c31204d19e5976f025026db3d5c17331e8c44db jdk8u60-b00
c46daef6edb5385d11876ed40f292a4b62e96867 jdk8u60-b01
c10fd784956cc7099657181029ac3e790267b678 jdk8u60-b02
...
...
make/data/charsetmapping/IBM1166.c2b
0 → 100644
浏览文件 @
0963f6fc
0x15 U+0085
make/data/charsetmapping/IBM1166.map
0 → 100644
浏览文件 @
0963f6fc
0x00 U+0000
0x01 U+0001
0x02 U+0002
0x03 U+0003
0x04 U+009c
0x05 U+0009
0x06 U+0086
0x07 U+007f
0x08 U+0097
0x09 U+008d
0x0a U+008e
0x0b U+000b
0x0c U+000c
0x0d U+000d
0x0e U+000e
0x0f U+000f
0x10 U+0010
0x11 U+0011
0x12 U+0012
0x13 U+0013
0x14 U+009d
0x15 U+000a
0x16 U+0008
0x17 U+0087
0x18 U+0018
0x19 U+0019
0x1a U+0092
0x1b U+008f
0x1c U+001c
0x1d U+001d
0x1e U+001e
0x1f U+001f
0x20 U+0080
0x21 U+0081
0x22 U+0082
0x23 U+0083
0x24 U+0084
0x25 U+000a
0x26 U+0017
0x27 U+001b
0x28 U+0088
0x29 U+0089
0x2a U+008a
0x2b U+008b
0x2c U+008c
0x2d U+0005
0x2e U+0006
0x2f U+0007
0x30 U+0090
0x31 U+0091
0x32 U+0016
0x33 U+0093
0x34 U+0094
0x35 U+0095
0x36 U+0096
0x37 U+0004
0x38 U+0098
0x39 U+0099
0x3a U+009a
0x3b U+009b
0x3c U+0014
0x3d U+0015
0x3e U+009e
0x3f U+001a
0x40 U+0020
0x41 U+00a0
0x42 U+04d9
0x43 U+0493
0x44 U+0451
0x45 U+0454
0x46 U+0455
0x47 U+0456
0x48 U+049b
0x49 U+0458
0x4a U+005b
0x4b U+002e
0x4c U+003c
0x4d U+0028
0x4e U+002b
0x4f U+0021
0x50 U+0026
0x51 U+04a3
0x52 U+04e9
0x53 U+04b1
0x54 U+04af
0x55 U+045e
0x56 U+04bb
0x57 U+042a
0x58 U+2116
0x59 U+04d8
0x5a U+005d
0x5b U+0024
0x5c U+002a
0x5d U+0029
0x5e U+003b
0x5f U+005e
0x60 U+002d
0x61 U+002f
0x62 U+0492
0x63 U+0401
0x64 U+0404
0x65 U+0405
0x66 U+0406
0x67 U+049a
0x68 U+0408
0x69 U+04a2
0x6a U+007c
0x6b U+002c
0x6c U+0025
0x6d U+005f
0x6e U+003e
0x6f U+003f
0x70 U+04e8
0x71 U+04b0
0x72 U+04ae
0x73 U+00ad
0x74 U+040e
0x75 U+04ba
0x76 U+044e
0x77 U+0430
0x78 U+0431
0x79 U+0060
0x7a U+003a
0x7b U+0023
0x7c U+0040
0x7d U+0027
0x7e U+003d
0x7f U+0022
0x80 U+0446
0x81 U+0061
0x82 U+0062
0x83 U+0063
0x84 U+0064
0x85 U+0065
0x86 U+0066
0x87 U+0067
0x88 U+0068
0x89 U+0069
0x8a U+0434
0x8b U+0435
0x8c U+0444
0x8d U+0433
0x8e U+0445
0x8f U+0438
0x90 U+0439
0x91 U+006a
0x92 U+006b
0x93 U+006c
0x94 U+006d
0x95 U+006e
0x96 U+006f
0x97 U+0070
0x98 U+0071
0x99 U+0072
0x9a U+043a
0x9b U+043b
0x9c U+043c
0x9d U+043d
0x9e U+043e
0x9f U+043f
0xa0 U+044f
0xa1 U+007e
0xa2 U+0073
0xa3 U+0074
0xa4 U+0075
0xa5 U+0076
0xa6 U+0077
0xa7 U+0078
0xa8 U+0079
0xa9 U+007a
0xaa U+0440
0xab U+0441
0xac U+0442
0xad U+0443
0xae U+0436
0xaf U+0432
0xb0 U+044c
0xb1 U+044b
0xb2 U+0437
0xb3 U+0448
0xb4 U+044d
0xb5 U+0449
0xb6 U+0447
0xb7 U+044a
0xb8 U+042e
0xb9 U+0410
0xba U+0411
0xbb U+0426
0xbc U+0414
0xbd U+0415
0xbe U+0424
0xbf U+0413
0xc0 U+007b
0xc1 U+0041
0xc2 U+0042
0xc3 U+0043
0xc4 U+0044
0xc5 U+0045
0xc6 U+0046
0xc7 U+0047
0xc8 U+0048
0xc9 U+0049
0xca U+0425
0xcb U+0418
0xcc U+0419
0xcd U+041a
0xce U+041b
0xcf U+041c
0xd0 U+007d
0xd1 U+004a
0xd2 U+004b
0xd3 U+004c
0xd4 U+004d
0xd5 U+004e
0xd6 U+004f
0xd7 U+0050
0xd8 U+0051
0xd9 U+0052
0xda U+041d
0xdb U+041e
0xdc U+041f
0xdd U+042f
0xde U+0420
0xdf U+0421
0xe0 U+005c
0xe1 U+20ac
0xe2 U+0053
0xe3 U+0054
0xe4 U+0055
0xe5 U+0056
0xe6 U+0057
0xe7 U+0058
0xe8 U+0059
0xe9 U+005a
0xea U+0422
0xeb U+0423
0xec U+0416
0xed U+0412
0xee U+042c
0xef U+042b
0xf0 U+0030
0xf1 U+0031
0xf2 U+0032
0xf3 U+0033
0xf4 U+0034
0xf5 U+0035
0xf6 U+0036
0xf7 U+0037
0xf8 U+0038
0xf9 U+0039
0xfa U+0417
0xfb U+0428
0xfc U+042d
0xfd U+0429
0xfe U+0427
0xff U+009f
make/data/charsetmapping/IBM1166.nr
0 → 100644
浏览文件 @
0963f6fc
0x25 U+000a
make/data/charsetmapping/extsbcs
浏览文件 @
0963f6fc
...
...
@@ -22,6 +22,7 @@ IBM1146 IBM01146 Cp1146 false sun.nio.cs.ext
IBM1147 IBM01147 Cp1147 false sun.nio.cs.ext
IBM1148 IBM01148 Cp1148 false sun.nio.cs.ext
IBM1149 IBM01149 Cp1149 false sun.nio.cs.ext
IBM1166 x-IBM1166 Cp1166 false sun.nio.cs.ext
IBM273 IBM273 Cp273 false sun.nio.cs.ext
IBM277 IBM277 Cp277 false sun.nio.cs.ext
IBM278 IBM278 Cp278 false sun.nio.cs.ext
...
...
src/macosx/classes/com/apple/laf/AquaIcon.java
浏览文件 @
0963f6fc
...
...
@@ -195,7 +195,7 @@ public class AquaIcon {
AquaPainter
.
create
(
JRSUIState
.
getInstance
());
initIconPainter
(
painter
);
g
.
setClip
(
new
Rectangle
(
x
,
y
,
width
,
height
)
);
g
.
clipRect
(
x
,
y
,
width
,
height
);
painter
.
paint
(
g
,
c
,
x
,
y
,
width
,
height
);
g
.
dispose
();
}
...
...
src/macosx/classes/sun/awt/CGraphicsDevice.java
浏览文件 @
0963f6fc
...
...
@@ -43,7 +43,6 @@ public final class CGraphicsDevice extends GraphicsDevice
* therefore methods, which is using this id should be ready to it.
*/
private
volatile
int
displayID
;
private
volatile
Insets
screenInsets
;
private
volatile
double
xResolution
;
private
volatile
double
yResolution
;
private
volatile
int
scale
;
...
...
@@ -120,7 +119,13 @@ public final class CGraphicsDevice extends GraphicsDevice
}
public
Insets
getScreenInsets
()
{
return
screenInsets
;
// the insets are queried synchronously and are not cached
// since there are no Quartz or Cocoa means to receive notifications
// on insets changes (e.g. when the Dock is resized):
// the existing CGDisplayReconfigurationCallBack is not notified
// as well as the NSApplicationDidChangeScreenParametersNotification
// is fired on the Dock location changes only
return
nativeGetScreenInsets
(
displayID
);
}
public
int
getScaleFactor
()
{
...
...
@@ -135,7 +140,6 @@ public final class CGraphicsDevice extends GraphicsDevice
public
void
displayChanged
()
{
xResolution
=
nativeGetXResolution
(
displayID
);
yResolution
=
nativeGetYResolution
(
displayID
);
screenInsets
=
nativeGetScreenInsets
(
displayID
);
scale
=
(
int
)
nativeGetScaleFactor
(
displayID
);
//TODO configs/fullscreenWindow/modes?
}
...
...
src/share/classes/com/sun/crypto/provider/GHASH.java
浏览文件 @
0963f6fc
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -28,9 +29,7 @@
package
com.sun.crypto.provider
;
import
java.util.Arrays
;
import
java.security.*
;
import
static
com
.
sun
.
crypto
.
provider
.
AESConstants
.
AES_BLOCK_SIZE
;
import
java.security.ProviderException
;
/**
* This class represents the GHASH function defined in NIST 800-38D
...
...
@@ -44,62 +43,90 @@ import static com.sun.crypto.provider.AESConstants.AES_BLOCK_SIZE;
*/
final
class
GHASH
{
private
static
final
byte
P128
=
(
byte
)
0xe1
;
//reduction polynomial
private
static
boolean
getBit
(
byte
[]
b
,
int
pos
)
{
int
p
=
pos
/
8
;
pos
%=
8
;
int
i
=
(
b
[
p
]
>>>
(
7
-
pos
))
&
1
;
return
i
!=
0
;
private
static
long
getLong
(
byte
[]
buffer
,
int
offset
)
{
long
result
=
0
;
int
end
=
offset
+
8
;
for
(
int
i
=
offset
;
i
<
end
;
++
i
)
{
result
=
(
result
<<
8
)
+
(
buffer
[
i
]
&
0xFF
)
;
}
return
result
;
}
private
static
void
shift
(
byte
[]
b
)
{
byte
temp
,
temp2
;
temp2
=
0
;
for
(
int
i
=
0
;
i
<
b
.
length
;
i
++)
{
temp
=
(
byte
)
((
b
[
i
]
&
0x01
)
<<
7
);
b
[
i
]
=
(
byte
)
((
b
[
i
]
&
0xff
)
>>>
1
);
b
[
i
]
=
(
byte
)
(
b
[
i
]
|
temp2
);
temp2
=
temp
;
private
static
void
putLong
(
byte
[]
buffer
,
int
offset
,
long
value
)
{
int
end
=
offset
+
8
;
for
(
int
i
=
end
-
1
;
i
>=
offset
;
--
i
)
{
buffer
[
i
]
=
(
byte
)
value
;
value
>>=
8
;
}
}
// Given block X and Y, returns the muliplication of X * Y
private
static
byte
[]
blockMult
(
byte
[]
x
,
byte
[]
y
)
{
if
(
x
.
length
!=
AES_BLOCK_SIZE
||
y
.
length
!=
AES_BLOCK_SIZE
)
{
throw
new
RuntimeException
(
"illegal input sizes"
);
private
static
final
int
AES_BLOCK_SIZE
=
16
;
// Multiplies state0, state1 by V0, V1.
private
void
blockMult
(
long
V0
,
long
V1
)
{
long
Z0
=
0
;
long
Z1
=
0
;
long
X
;
// Separate loops for processing state0 and state1.
X
=
state0
;
for
(
int
i
=
0
;
i
<
64
;
i
++)
{
// Zi+1 = Zi if bit i of x is 0
long
mask
=
X
>>
63
;
Z0
^=
V0
&
mask
;
Z1
^=
V1
&
mask
;
// Save mask for conditional reduction below.
mask
=
(
V1
<<
63
)
>>
63
;
// V = rightshift(V)
long
carry
=
V0
&
1
;
V0
=
V0
>>>
1
;
V1
=
(
V1
>>>
1
)
|
(
carry
<<
63
);
// Conditional reduction modulo P128.
V0
^=
0xe100000000000000
L
&
mask
;
X
<<=
1
;
}
byte
[]
z
=
new
byte
[
AES_BLOCK_SIZE
];
byte
[]
v
=
y
.
clone
();
// calculate Z1-Z127 and V1-V127
for
(
int
i
=
0
;
i
<
127
;
i
++)
{
X
=
state1
;
for
(
int
i
=
64
;
i
<
127
;
i
++)
{
// Zi+1 = Zi if bit i of x is 0
if
(
getBit
(
x
,
i
))
{
for
(
int
n
=
0
;
n
<
z
.
length
;
n
++)
{
z
[
n
]
^=
v
[
n
];
}
}
boolean
lastBitOfV
=
getBit
(
v
,
127
);
shift
(
v
);
if
(
lastBitOfV
)
v
[
0
]
^=
P128
;
long
mask
=
X
>>
63
;
Z0
^=
V0
&
mask
;
Z1
^=
V1
&
mask
;
// Save mask for conditional reduction below.
mask
=
(
V1
<<
63
)
>>
63
;
// V = rightshift(V)
long
carry
=
V0
&
1
;
V0
=
V0
>>>
1
;
V1
=
(
V1
>>>
1
)
|
(
carry
<<
63
);
// Conditional reduction.
V0
^=
0xe100000000000000
L
&
mask
;
X
<<=
1
;
}
// calculate Z128
if
(
getBit
(
x
,
127
))
{
for
(
int
n
=
0
;
n
<
z
.
length
;
n
++)
{
z
[
n
]
^=
v
[
n
];
}
}
return
z
;
long
mask
=
X
>>
63
;
Z0
^=
V0
&
mask
;
Z1
^=
V1
&
mask
;
// Save result.
state0
=
Z0
;
state1
=
Z1
;
}
// hash subkey H; should not change after the object has been constructed
private
final
byte
[]
subkeyH
;
private
final
long
subkeyH0
,
subkeyH1
;
// buffer for storing hash
private
byte
[]
state
;
private
long
state0
,
state1
;
// variables for save/restore calls
private
byte
[]
stateSave
=
null
;
private
long
stateSave0
,
stateSave1
;
/**
* Initializes the cipher in the specified mode with the given key
...
...
@@ -114,8 +141,8 @@ final class GHASH {
if
((
subkeyH
==
null
)
||
subkeyH
.
length
!=
AES_BLOCK_SIZE
)
{
throw
new
ProviderException
(
"Internal error"
);
}
this
.
subkeyH
=
subkeyH
;
this
.
s
tate
=
new
byte
[
AES_BLOCK_SIZE
]
;
this
.
subkeyH
0
=
getLong
(
subkeyH
,
0
)
;
this
.
s
ubkeyH1
=
getLong
(
subkeyH
,
8
)
;
}
/**
...
...
@@ -124,31 +151,33 @@ final class GHASH {
* this object for different data w/ the same H.
*/
void
reset
()
{
Arrays
.
fill
(
state
,
(
byte
)
0
);
state0
=
0
;
state1
=
0
;
}
/**
* Save the current snapshot of this GHASH object.
*/
void
save
()
{
stateSave
=
state
.
clone
();
stateSave0
=
state0
;
stateSave1
=
state1
;
}
/**
* Restores this object using the saved snapshot.
*/
void
restore
()
{
state
=
stateSave
;
state0
=
stateSave0
;
state1
=
stateSave1
;
}
private
void
processBlock
(
byte
[]
data
,
int
ofs
)
{
if
(
data
.
length
-
ofs
<
AES_BLOCK_SIZE
)
{
throw
new
RuntimeException
(
"need complete block"
);
}
for
(
int
n
=
0
;
n
<
state
.
length
;
n
++)
{
state
[
n
]
^=
data
[
ofs
+
n
];
}
state
=
blockMult
(
state
,
subkeyH
);
state0
^=
getLong
(
data
,
ofs
);
state1
^=
getLong
(
data
,
ofs
+
8
);
blockMult
(
subkeyH0
,
subkeyH1
);
}
void
update
(
byte
[]
in
)
{
...
...
@@ -169,10 +198,10 @@ final class GHASH {
}
byte
[]
digest
()
{
try
{
return
state
.
clone
(
);
}
finally
{
reset
();
}
byte
[]
result
=
new
byte
[
AES_BLOCK_SIZE
];
putLong
(
result
,
0
,
state0
);
putLong
(
result
,
8
,
state1
);
reset
();
return
result
;
}
}
src/share/classes/java/math/BigDecimal.java
浏览文件 @
0963f6fc
...
...
@@ -4801,41 +4801,61 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
if
(
dividendHi
>=
divisor
)
{
return
null
;
}
final
int
shift
=
Long
.
numberOfLeadingZeros
(
divisor
);
divisor
<<=
shift
;
final
long
v1
=
divisor
>>>
32
;
final
long
v0
=
divisor
&
LONG_MASK
;
long
q1
,
q0
;
long
r_tmp
;
long
tmp
=
dividendLo
<<
shift
;
long
u1
=
tmp
>>>
32
;
long
u0
=
tmp
&
LONG_MASK
;
tmp
=
(
dividendHi
<<
shift
)
|
(
dividendLo
>>>
64
-
shift
);
long
u2
=
tmp
&
LONG_MASK
;
tmp
=
divWord
(
tmp
,
v1
);
q1
=
tmp
&
LONG_MASK
;
r_tmp
=
tmp
>>>
32
;
long
q1
,
r_tmp
;
if
(
v1
==
1
)
{
q1
=
tmp
;
r_tmp
=
0
;
}
else
if
(
tmp
>=
0
)
{
q1
=
tmp
/
v1
;
r_tmp
=
tmp
-
q1
*
v1
;
}
else
{
long
[]
rq
=
divRemNegativeLong
(
tmp
,
v1
);
q1
=
rq
[
1
];
r_tmp
=
rq
[
0
];
}
while
(
q1
>=
DIV_NUM_BASE
||
unsignedLongCompare
(
q1
*
v0
,
make64
(
r_tmp
,
u1
)))
{
q1
--;
r_tmp
+=
v1
;
if
(
r_tmp
>=
DIV_NUM_BASE
)
break
;
}
tmp
=
mulsub
(
u2
,
u1
,
v1
,
v0
,
q1
);
u1
=
tmp
&
LONG_MASK
;
tmp
=
divWord
(
tmp
,
v1
);
q0
=
tmp
&
LONG_MASK
;
r_tmp
=
tmp
>>>
32
;
long
q0
;
if
(
v1
==
1
)
{
q0
=
tmp
;
r_tmp
=
0
;
}
else
if
(
tmp
>=
0
)
{
q0
=
tmp
/
v1
;
r_tmp
=
tmp
-
q0
*
v1
;
}
else
{
long
[]
rq
=
divRemNegativeLong
(
tmp
,
v1
);
q0
=
rq
[
1
];
r_tmp
=
rq
[
0
];
}
while
(
q0
>=
DIV_NUM_BASE
||
unsignedLongCompare
(
q0
*
v0
,
make64
(
r_tmp
,
u0
)))
{
q0
--;
r_tmp
+=
v1
;
if
(
r_tmp
>=
DIV_NUM_BASE
)
break
;
}
if
((
int
)
q1
<
0
)
{
// result (which is positive and unsigned here)
// can't fit into long due to sign bit is used for value
...
...
@@ -4858,10 +4878,13 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
}
}
}
long
q
=
make64
(
q1
,
q0
);
q
*=
sign
;
if
(
roundingMode
==
ROUND_DOWN
&&
scale
==
preferredScale
)
return
valueOf
(
q
,
scale
);
long
r
=
mulsub
(
u1
,
u0
,
v1
,
v0
,
q0
)
>>>
shift
;
if
(
r
!=
0
)
{
boolean
increment
=
needIncrement
(
divisor
>>>
shift
,
roundingMode
,
sign
,
q
,
r
);
...
...
@@ -4904,28 +4927,35 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
}
}
private
static
long
divWord
(
long
n
,
long
dLong
)
{
long
r
;
long
q
;
if
(
dLong
==
1
)
{
q
=
(
int
)
n
;
return
(
q
&
LONG_MASK
);
}
/**
* Calculate the quotient and remainder of dividing a negative long by
* another long.
*
* @param n the numerator; must be negative
* @param d the denominator; must not be unity
* @return a two-element {@long} array with the remainder and quotient in
* the initial and final elements, respectively
*/
private
static
long
[]
divRemNegativeLong
(
long
n
,
long
d
)
{
assert
n
<
0
:
"Non-negative numerator "
+
n
;
assert
d
!=
1
:
"Unity denominator"
;
// Approximate the quotient and remainder
q
=
(
n
>>>
1
)
/
(
dLong
>>>
1
);
r
=
n
-
q
*
dLong
;
long
q
=
(
n
>>>
1
)
/
(
d
>>>
1
);
long
r
=
n
-
q
*
d
;
// Correct the approximation
while
(
r
<
0
)
{
r
+=
d
Long
;
r
+=
d
;
q
--;
}
while
(
r
>=
d
Long
)
{
r
-=
d
Long
;
while
(
r
>=
d
)
{
r
-=
d
;
q
++;
}
// n - q*dlong == r && 0 <= r <dLong, hence we're done.
return
(
r
<<
32
)
|
(
q
&
LONG_MASK
);
// n - q*d == r && 0 <= r < d, hence we're done.
return
new
long
[]
{
r
,
q
};
}
private
static
long
make64
(
long
hi
,
long
lo
)
{
...
...
src/share/classes/java/net/SocksSocketImpl.java
浏览文件 @
0963f6fc
...
...
@@ -388,14 +388,13 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
}
while
(
iProxy
.
hasNext
())
{
p
=
iProxy
.
next
();
if
(
p
==
null
||
p
==
Proxy
.
NO_PROXY
)
{
if
(
p
==
null
||
p
.
type
()
!=
Proxy
.
Type
.
SOCKS
)
{
super
.
connect
(
epoint
,
remainingMillis
(
deadlineMillis
));
return
;
}
if
(
p
.
type
()
!=
Proxy
.
Type
.
SOCKS
)
throw
new
SocketException
(
"Unknown proxy type : "
+
p
.
type
());
if
(!(
p
.
address
()
instanceof
InetSocketAddress
))
throw
new
SocketException
(
"Unknow address type for proxy: "
+
p
);
throw
new
SocketException
(
"Unknow
n
address type for proxy: "
+
p
);
// Use getHostString() to avoid reverse lookups
server
=
((
InetSocketAddress
)
p
.
address
()).
getHostString
();
serverPort
=
((
InetSocketAddress
)
p
.
address
()).
getPort
();
...
...
@@ -703,13 +702,12 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
}
while
(
iProxy
.
hasNext
())
{
p
=
iProxy
.
next
();
if
(
p
==
null
||
p
==
Proxy
.
NO_PROXY
)
{
if
(
p
==
null
||
p
.
type
()
!=
Proxy
.
Type
.
SOCKS
)
{
return
;
}
if
(
p
.
type
()
!=
Proxy
.
Type
.
SOCKS
)
throw
new
SocketException
(
"Unknown proxy type : "
+
p
.
type
());
if
(!(
p
.
address
()
instanceof
InetSocketAddress
))
throw
new
SocketException
(
"Unknow address type for proxy: "
+
p
);
throw
new
SocketException
(
"Unknow
n
address type for proxy: "
+
p
);
// Use getHostString() to avoid reverse lookups
server
=
((
InetSocketAddress
)
p
.
address
()).
getHostString
();
serverPort
=
((
InetSocketAddress
)
p
.
address
()).
getPort
();
...
...
src/share/classes/java/util/ComparableTimSort.java
浏览文件 @
0963f6fc
...
...
@@ -144,10 +144,14 @@ class ComparableTimSort {
* large) stack lengths for smaller arrays. The "magic numbers" in the
* computation below must be changed if MIN_MERGE is decreased. See
* the MIN_MERGE declaration above for more information.
* The maximum value of 49 allows for an array up to length
* Integer.MAX_VALUE-4, if array is filled by the worst case stack size
* increasing scenario. More explanations are given in section 4 of:
* http://envisage-project.eu/wp-content/uploads/2015/02/sorting.pdf
*/
int
stackLen
=
(
len
<
120
?
5
:
len
<
1542
?
10
:
len
<
119151
?
24
:
4
0
);
len
<
119151
?
24
:
4
9
);
runBase
=
new
int
[
stackLen
];
runLen
=
new
int
[
stackLen
];
}
...
...
src/share/classes/java/util/TimSort.java
浏览文件 @
0963f6fc
...
...
@@ -174,10 +174,14 @@ class TimSort<T> {
* large) stack lengths for smaller arrays. The "magic numbers" in the
* computation below must be changed if MIN_MERGE is decreased. See
* the MIN_MERGE declaration above for more information.
* The maximum value of 49 allows for an array up to length
* Integer.MAX_VALUE-4, if array is filled by the worst case stack size
* increasing scenario. More explanations are given in section 4 of:
* http://envisage-project.eu/wp-content/uploads/2015/02/sorting.pdf
*/
int
stackLen
=
(
len
<
120
?
5
:
len
<
1542
?
10
:
len
<
119151
?
24
:
4
0
);
len
<
119151
?
24
:
4
9
);
runBase
=
new
int
[
stackLen
];
runLen
=
new
int
[
stackLen
];
}
...
...
src/share/classes/java/util/zip/ZipEntry.java
浏览文件 @
0963f6fc
...
...
@@ -180,8 +180,7 @@ class ZipEntry implements ZipConstants, Cloneable {
* @since 1.8
*/
public
ZipEntry
setLastModifiedTime
(
FileTime
time
)
{
Objects
.
requireNonNull
(
name
,
"time"
);
this
.
mtime
=
time
;
this
.
mtime
=
Objects
.
requireNonNull
(
time
,
"lastModifiedTime"
);
this
.
time
=
time
.
to
(
TimeUnit
.
MILLISECONDS
);
return
this
;
}
...
...
@@ -227,8 +226,7 @@ class ZipEntry implements ZipConstants, Cloneable {
* @since 1.8
*/
public
ZipEntry
setLastAccessTime
(
FileTime
time
)
{
Objects
.
requireNonNull
(
name
,
"time"
);
this
.
atime
=
time
;
this
.
atime
=
Objects
.
requireNonNull
(
time
,
"lastAccessTime"
);
return
this
;
}
...
...
@@ -265,8 +263,7 @@ class ZipEntry implements ZipConstants, Cloneable {
* @since 1.8
*/
public
ZipEntry
setCreationTime
(
FileTime
time
)
{
Objects
.
requireNonNull
(
name
,
"time"
);
this
.
ctime
=
time
;
this
.
ctime
=
Objects
.
requireNonNull
(
time
,
"creationTime"
);
return
this
;
}
...
...
src/share/classes/javax/swing/JComponent.java
浏览文件 @
0963f6fc
...
...
@@ -3738,12 +3738,6 @@ public abstract class JComponent extends Container implements Serializable,
* @param listener the PropertyChangeListener to be added
*/
public
void
addPropertyChangeListener
(
PropertyChangeListener
listener
)
{
if
(
accessibleContainerHandler
==
null
)
{
accessibleContainerHandler
=
new
AccessibleContainerHandler
();
}
if
(
propertyListenersCount
++
==
0
)
{
JComponent
.
this
.
addContainerListener
(
accessibleContainerHandler
);
}
super
.
addPropertyChangeListener
(
listener
);
}
...
...
@@ -3755,9 +3749,6 @@ public abstract class JComponent extends Container implements Serializable,
* @param listener the PropertyChangeListener to be removed
*/
public
void
removePropertyChangeListener
(
PropertyChangeListener
listener
)
{
if
(--
propertyListenersCount
==
0
)
{
JComponent
.
this
.
removeContainerListener
(
accessibleContainerHandler
);
}
super
.
removePropertyChangeListener
(
listener
);
}
...
...
src/share/classes/javax/swing/JMenu.java
浏览文件 @
0963f6fc
...
...
@@ -475,7 +475,8 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement
}
// Then the y:
y
=
s
.
height
+
yOffset
;
// Prefer dropping down
if
(
position
.
y
+
y
+
pmSize
.
height
>=
screenBounds
.
height
&&
if
(
position
.
y
+
y
+
pmSize
.
height
>=
screenBounds
.
height
+
screenBounds
.
y
&&
// popup doesn't fit - place it wherever there's more room
screenBounds
.
height
-
s
.
height
<
2
*(
position
.
y
-
screenBounds
.
y
))
{
...
...
src/share/classes/javax/swing/JTree.java
浏览文件 @
0963f6fc
/*
* Copyright (c) 1997, 201
4
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
5
, 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
...
...
@@ -872,9 +872,10 @@ public class JTree extends JComponent implements Scrollable, Accessible
if
(
treeModelListener
!=
null
)
treeModel
.
addTreeModelListener
(
treeModelListener
);
// Mark the root as expanded, if it isn't a leaf.
if
(
treeModel
.
getRoot
()
!=
null
&&
!
treeModel
.
isLeaf
(
treeModel
.
getRoot
()))
{
expandedState
.
put
(
new
TreePath
(
treeModel
.
getRoot
()),
Object
treeRoot
=
treeModel
.
getRoot
();
if
(
treeRoot
!=
null
&&
!
treeModel
.
isLeaf
(
treeRoot
))
{
expandedState
.
put
(
new
TreePath
(
treeRoot
),
Boolean
.
TRUE
);
}
}
...
...
@@ -3223,6 +3224,9 @@ public class JTree extends JComponent implements Scrollable, Accessible
int
count
=
indexs
.
length
;
Object
parent
=
model
.
getRoot
();
if
(
parent
==
null
)
return
null
;
TreePath
parentPath
=
new
TreePath
(
parent
);
for
(
int
counter
=
0
;
counter
<
count
;
counter
++)
{
...
...
@@ -3798,8 +3802,9 @@ public class JTree extends JComponent implements Scrollable, Accessible
if
(
parent
.
getPathCount
()
==
1
)
{
// New root, remove everything!
clearToggledPaths
();
if
(
treeModel
.
getRoot
()
!=
null
&&
!
treeModel
.
isLeaf
(
treeModel
.
getRoot
()))
{
Object
treeRoot
=
treeModel
.
getRoot
();
if
(
treeRoot
!=
null
&&
!
treeModel
.
isLeaf
(
treeRoot
))
{
// Mark the root as expanded, if it isn't a leaf.
expandedState
.
put
(
parent
,
Boolean
.
TRUE
);
}
...
...
@@ -4283,7 +4288,11 @@ public class JTree extends JComponent implements Scrollable, Accessible
if
(
model
==
null
)
{
return
null
;
}
TreePath
path
=
new
TreePath
(
model
.
getRoot
());
Object
treeRoot
=
model
.
getRoot
();
if
(
treeRoot
==
null
)
return
null
;
TreePath
path
=
new
TreePath
(
treeRoot
);
if
(
JTree
.
this
.
isVisible
(
path
))
{
TreeCellRenderer
r
=
JTree
.
this
.
getCellRenderer
();
TreeUI
ui
=
JTree
.
this
.
getUI
();
...
...
@@ -4296,8 +4305,8 @@ public class JTree extends JComponent implements Scrollable, Accessible
boolean
expanded
=
JTree
.
this
.
isExpanded
(
path
);
return
r
.
getTreeCellRendererComponent
(
JTree
.
this
,
model
.
getRoot
()
,
selected
,
expanded
,
model
.
isLeaf
(
model
.
getRoot
()
),
row
,
hasFocus
);
treeRoot
,
selected
,
expanded
,
model
.
isLeaf
(
treeRoot
),
row
,
hasFocus
);
}
}
return
null
;
...
...
@@ -4350,8 +4359,11 @@ public class JTree extends JComponent implements Scrollable, Accessible
return
1
;
// the root node
}
Object
treeRoot
=
model
.
getRoot
();
if
(
treeRoot
==
null
)
return
0
;
// return the root's first set of children count
return
model
.
getChildCount
(
model
.
getRoot
()
);
return
model
.
getChildCount
(
treeRoot
);
}
/**
...
...
@@ -4365,9 +4377,17 @@ public class JTree extends JComponent implements Scrollable, Accessible
if
(
model
==
null
)
{
return
null
;
}
Object
treeRoot
=
model
.
getRoot
();
if
(
treeRoot
==
null
)
{
return
null
;
}
if
(
isRootVisible
())
{
if
(
i
==
0
)
{
// return the root node Accessible
Object
[]
objPath
=
{
model
.
getRoot
()
};
Object
[]
objPath
=
{
treeRoot
};
if
(
objPath
[
0
]
==
null
)
return
null
;
TreePath
path
=
new
TreePath
(
objPath
);
return
new
AccessibleJTreeNode
(
JTree
.
this
,
path
,
JTree
.
this
);
}
else
{
...
...
@@ -4376,12 +4396,14 @@ public class JTree extends JComponent implements Scrollable, Accessible
}
// return Accessible for one of root's child nodes
int
count
=
model
.
getChildCount
(
model
.
getRoot
()
);
int
count
=
model
.
getChildCount
(
treeRoot
);
if
(
i
<
0
||
i
>=
count
)
{
return
null
;
}
Object
obj
=
model
.
getChild
(
model
.
getRoot
(),
i
);
Object
[]
objPath
=
{
model
.
getRoot
(),
obj
};
Object
obj
=
model
.
getChild
(
treeRoot
,
i
);
if
(
obj
==
null
)
return
null
;
Object
[]
objPath
=
{
treeRoot
,
obj
};
TreePath
path
=
new
TreePath
(
objPath
);
return
new
AccessibleJTreeNode
(
JTree
.
this
,
path
,
JTree
.
this
);
}
...
...
@@ -4420,6 +4442,9 @@ public class JTree extends JComponent implements Scrollable, Accessible
public
int
getAccessibleSelectionCount
()
{
Object
[]
rootPath
=
new
Object
[
1
];
rootPath
[
0
]
=
treeModel
.
getRoot
();
if
(
rootPath
[
0
]
==
null
)
return
0
;
TreePath
childPath
=
new
TreePath
(
rootPath
);
if
(
JTree
.
this
.
isPathSelected
(
childPath
))
{
return
1
;
...
...
@@ -4442,6 +4467,8 @@ public class JTree extends JComponent implements Scrollable, Accessible
if
(
i
==
0
)
{
Object
[]
rootPath
=
new
Object
[
1
];
rootPath
[
0
]
=
treeModel
.
getRoot
();
if
(
rootPath
[
0
]
==
null
)
return
null
;
TreePath
childPath
=
new
TreePath
(
rootPath
);
if
(
JTree
.
this
.
isPathSelected
(
childPath
))
{
return
new
AccessibleJTreeNode
(
JTree
.
this
,
childPath
,
JTree
.
this
);
...
...
@@ -4461,6 +4488,8 @@ public class JTree extends JComponent implements Scrollable, Accessible
if
(
i
==
0
)
{
Object
[]
rootPath
=
new
Object
[
1
];
rootPath
[
0
]
=
treeModel
.
getRoot
();
if
(
rootPath
[
0
]
==
null
)
return
false
;
TreePath
childPath
=
new
TreePath
(
rootPath
);
return
JTree
.
this
.
isPathSelected
(
childPath
);
}
else
{
...
...
@@ -4482,6 +4511,8 @@ public class JTree extends JComponent implements Scrollable, Accessible
if
(
model
!=
null
)
{
if
(
i
==
0
)
{
Object
[]
objPath
=
{
model
.
getRoot
()};
if
(
objPath
[
0
]
==
null
)
return
;
TreePath
path
=
new
TreePath
(
objPath
);
JTree
.
this
.
addSelectionPath
(
path
);
}
...
...
@@ -4500,6 +4531,8 @@ public class JTree extends JComponent implements Scrollable, Accessible
if
(
model
!=
null
)
{
if
(
i
==
0
)
{
Object
[]
objPath
=
{
model
.
getRoot
()};
if
(
objPath
[
0
]
==
null
)
return
;
TreePath
path
=
new
TreePath
(
objPath
);
JTree
.
this
.
removeSelectionPath
(
path
);
}
...
...
@@ -4525,6 +4558,8 @@ public class JTree extends JComponent implements Scrollable, Accessible
TreeModel
model
=
JTree
.
this
.
getModel
();
if
(
model
!=
null
)
{
Object
[]
objPath
=
{
model
.
getRoot
()};
if
(
objPath
[
0
]
==
null
)
return
;
TreePath
path
=
new
TreePath
(
objPath
);
JTree
.
this
.
addSelectionPath
(
path
);
}
...
...
src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java
浏览文件 @
0963f6fc
...
...
@@ -1031,6 +1031,14 @@ public class ExtendedCharsets
"ebcdic-s-871+euro"
});
charset
(
"x-IBM1166"
,
"IBM1166"
,
new
String
[]
{
"cp1166"
,
// JDK historical
"ibm1166"
,
"ibm-1166"
,
"1166"
});
charset
(
"IBM290"
,
"IBM290"
,
new
String
[]
{
"cp290"
,
...
...
src/share/classes/sun/tools/jconsole/resources/messages_ja.properties
浏览文件 @
0963f6fc
...
...
@@ -104,7 +104,7 @@ HELP_ABOUT_DIALOG_JAVA_VERSION=Java VM\u30D0\u30FC\u30B8\u30E7\u30F3:<br>{0}
HELP_ABOUT_DIALOG_MASTHEAD_ACCESSIBLE_NAME
=
\u
30DE
\u
30B9
\u
30C8
\u
30D8
\u
30C3
\u
30C9
\u
56F3
\u
5F62
HELP_ABOUT_DIALOG_MASTHEAD_TITLE
=
JConsole
\u
306B
\u3064\u3044\u3066
HELP_ABOUT_DIALOG_TITLE
=
JConsole:
\u
60C5
\u5831
HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL
=
http://docs.oracle.com/javase/{0}/docs/technotes/guides/management/jconsole.html
HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL
=
http
s
://docs.oracle.com/javase/{0}/docs/technotes/guides/management/jconsole.html
HELP_MENU_ABOUT_TITLE
=
JConsole
\u
306B
\u3064\u3044\u3066
(&A)
HELP_MENU_USER_GUIDE_TITLE
=
\u
30AA
\u
30F3
\u
30E9
\u
30A4
\u
30F3
\u
30FB
\u
30E6
\u
30FC
\u
30B6
\u
30FC
\u
30FB
\u
30AC
\u
30A4
\u
30C9(&U)
HELP_MENU_TITLE
=
\u
30D8
\u
30EB
\u
30D7(&H)
...
...
src/share/classes/sun/tools/jconsole/resources/messages_zh_CN.properties
浏览文件 @
0963f6fc
...
...
@@ -104,7 +104,7 @@ HELP_ABOUT_DIALOG_JAVA_VERSION=Java VM \u7248\u672C:<br>{0}
HELP_ABOUT_DIALOG_MASTHEAD_ACCESSIBLE_NAME
=
\u
62A5
\u5934\u
56FE
HELP_ABOUT_DIALOG_MASTHEAD_TITLE
=
\u5173\u
4E8E JConsole
HELP_ABOUT_DIALOG_TITLE
=
JConsole:
\u5173\u
4E8E
HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL
=
http://docs.oracle.com/javase/{0}/docs/technotes/guides/management/jconsole.html
HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL
=
http
s
://docs.oracle.com/javase/{0}/docs/technotes/guides/management/jconsole.html
HELP_MENU_ABOUT_TITLE
=
\u5173\u
4E8E JConsole(&A)
HELP_MENU_USER_GUIDE_TITLE
=
\u8054\u
673A
\u7528\u6237\u6307\u5357
(&U)
HELP_MENU_TITLE
=
\u
5E2E
\u
52A9(&H)
...
...
src/solaris/native/sun/nio/ch/sctp/SctpChannelImpl.c
浏览文件 @
0963f6fc
/*
* Copyright (c) 2009, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 201
5
, 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
...
...
@@ -464,11 +464,6 @@ JNIEXPORT jint JNICALL Java_sun_nio_ch_sctp_SctpChannelImpl_receive0
union
sctp_notification
*
snp
;
jboolean
allocated
=
JNI_FALSE
;
if
(
rv
>
SCTP_NOTIFICATION_SIZE
)
{
JNU_ThrowInternalError
(
env
,
"should not reach here"
);
return
-
1
;
}
if
(
!
(
msg
->
msg_flags
&
MSG_EOR
)
&&
length
<
SCTP_NOTIFICATION_SIZE
)
{
char
*
newBuf
;
int
rvSAVE
=
rv
;
...
...
src/windows/native/java/lang/ProcessImpl_md.c
浏览文件 @
0963f6fc
...
...
@@ -272,14 +272,10 @@ static jlong processCreate(
FALSE
,
FALSE
,
FALSE
,
FALSE
,
FALSE
,
FALSE
};
{
/* Extraction of current process standard IOE handles */
DWORD
idsIOE
[
3
]
=
{
STD_INPUT_HANDLE
,
STD_OUTPUT_HANDLE
,
STD_ERROR_HANDLE
};
int
i
;
for
(
i
=
0
;
i
<
3
;
++
i
)
/* Should not be closed by CloseHandle! */
stdIOE
[
i
]
=
GetStdHandle
(
idsIOE
[
i
]);
}
/* These three should not be closed by CloseHandle! */
stdIOE
[
0
]
=
GetStdHandle
(
STD_INPUT_HANDLE
);
stdIOE
[
1
]
=
GetStdHandle
(
STD_OUTPUT_HANDLE
);
stdIOE
[
2
]
=
GetStdHandle
(
STD_ERROR_HANDLE
);
prepareIOEHandleState
(
stdIOE
,
inherit
);
{
...
...
@@ -308,11 +304,16 @@ static jlong processCreate(
if
(
success
)
{
PROCESS_INFORMATION
pi
;
DWORD
processFlag
=
CREATE_UNICODE_ENVIRONMENT
;
DWORD
processFlag
=
CREATE_
NO_WINDOW
|
CREATE_
UNICODE_ENVIRONMENT
;
/* Suppress popping-up of a console window for non-console applications */
if
(
GetConsoleWindow
()
==
NULL
)
processFlag
|=
CREATE_NO_WINDOW
;
/* If the standard I/O is inherited, CREATE_NO_WINDOW must not be used. */
if
(
GetConsoleWindow
()
!=
NULL
&&
(
si
.
hStdInput
==
stdIOE
[
0
]
||
si
.
hStdOutput
==
stdIOE
[
1
]
||
si
.
hStdError
==
(
redirectErrorStream
?
stdIOE
[
1
]
:
stdIOE
[
2
])))
{
processFlag
&=
~
CREATE_NO_WINDOW
;
}
si
.
dwFlags
=
STARTF_USESTDHANDLES
;
if
(
!
CreateProcessW
(
...
...
test/com/sun/crypto/provider/Cipher/AES/TestGHASH.java
0 → 100644
浏览文件 @
0963f6fc
/*
* Copyright (c) 2015, Red Hat, Inc.
* 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 8069072
* @summary Test vectors for com.sun.crypto.provider.GHASH
*/
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.Method
;
import
java.nio.ByteBuffer
;
public
class
TestGHASH
{
private
final
Constructor
<?>
GHASH
;
private
final
Method
UPDATE
;
private
final
Method
DIGEST
;
TestGHASH
(
String
className
)
throws
Exception
{
Class
<?>
cls
=
Class
.
forName
(
className
);
GHASH
=
cls
.
getDeclaredConstructor
(
byte
[].
class
);
GHASH
.
setAccessible
(
true
);
UPDATE
=
cls
.
getDeclaredMethod
(
"update"
,
byte
[].
class
);
UPDATE
.
setAccessible
(
true
);
DIGEST
=
cls
.
getDeclaredMethod
(
"digest"
);
DIGEST
.
setAccessible
(
true
);
}
private
Object
newGHASH
(
byte
[]
H
)
throws
Exception
{
return
GHASH
.
newInstance
(
H
);
}
private
void
updateGHASH
(
Object
hash
,
byte
[]
data
)
throws
Exception
{
UPDATE
.
invoke
(
hash
,
data
);
}
private
byte
[]
digestGHASH
(
Object
hash
)
throws
Exception
{
return
(
byte
[])
DIGEST
.
invoke
(
hash
);
}
private
static
final
String
HEX_DIGITS
=
"0123456789abcdef"
;
private
static
String
hex
(
byte
[]
bs
)
{
StringBuilder
sb
=
new
StringBuilder
(
2
*
bs
.
length
);
for
(
byte
b
:
bs
)
{
sb
.
append
(
HEX_DIGITS
.
charAt
((
b
>>
4
)
&
0xF
));
sb
.
append
(
HEX_DIGITS
.
charAt
(
b
&
0xF
));
}
return
sb
.
toString
();
}
private
static
byte
[]
bytes
(
String
hex
)
{
if
((
hex
.
length
()
&
1
)
!=
0
)
{
throw
new
AssertionError
();
}
byte
[]
result
=
new
byte
[
hex
.
length
()
/
2
];
for
(
int
i
=
0
;
i
<
result
.
length
;
++
i
)
{
int
a
=
HEX_DIGITS
.
indexOf
(
hex
.
charAt
(
2
*
i
));
int
b
=
HEX_DIGITS
.
indexOf
(
hex
.
charAt
(
2
*
i
+
1
));
if
((
a
|
b
)
<
0
)
{
if
(
a
<
0
)
{
throw
new
AssertionError
(
"bad character "
+
(
int
)
hex
.
charAt
(
2
*
i
));
}
throw
new
AssertionError
(
"bad character "
+
(
int
)
hex
.
charAt
(
2
*
i
+
1
));
}
result
[
i
]
=
(
byte
)
((
a
<<
4
)
|
b
);
}
return
result
;
}
private
static
byte
[]
bytes
(
long
L0
,
long
L1
)
{
return
ByteBuffer
.
allocate
(
16
)
.
putLong
(
L0
)
.
putLong
(
L1
)
.
array
();
}
private
void
check
(
int
testCase
,
String
H
,
String
A
,
String
C
,
String
expected
)
throws
Exception
{
int
lenA
=
A
.
length
()
*
4
;
while
((
A
.
length
()
%
32
)
!=
0
)
{
A
+=
'0'
;
}
int
lenC
=
C
.
length
()
*
4
;
while
((
C
.
length
()
%
32
)
!=
0
)
{
C
+=
'0'
;
}
Object
hash
=
newGHASH
(
bytes
(
H
));
updateGHASH
(
hash
,
bytes
(
A
));
updateGHASH
(
hash
,
bytes
(
C
));
updateGHASH
(
hash
,
bytes
(
lenA
,
lenC
));
byte
[]
digest
=
digestGHASH
(
hash
);
String
actual
=
hex
(
digest
);
if
(!
expected
.
equals
(
actual
))
{
throw
new
AssertionError
(
String
.
format
(
"%d: expected %s, got %s"
,
testCase
,
expected
,
actual
));
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
TestGHASH
test
;
if
(
args
.
length
==
0
)
{
test
=
new
TestGHASH
(
"com.sun.crypto.provider.GHASH"
);
}
else
{
test
=
new
TestGHASH
(
args
[
0
]);
}
// Test vectors from David A. McGrew, John Viega,
// "The Galois/Counter Mode of Operation (GCM)", 2005.
// <http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-revised-spec.pdf>
test
.
check
(
1
,
"66e94bd4ef8a2c3b884cfa59ca342b2e"
,
""
,
""
,
"00000000000000000000000000000000"
);
test
.
check
(
2
,
"66e94bd4ef8a2c3b884cfa59ca342b2e"
,
""
,
"0388dace60b6a392f328c2b971b2fe78"
,
"f38cbb1ad69223dcc3457ae5b6b0f885"
);
test
.
check
(
3
,
"b83b533708bf535d0aa6e52980d53b78"
,
""
,
"42831ec2217774244b7221b784d0d49c"
+
"e3aa212f2c02a4e035c17e2329aca12e"
+
"21d514b25466931c7d8f6a5aac84aa05"
+
"1ba30b396a0aac973d58e091473f5985"
,
"7f1b32b81b820d02614f8895ac1d4eac"
);
test
.
check
(
4
,
"b83b533708bf535d0aa6e52980d53b78"
,
"feedfacedeadbeeffeedfacedeadbeef"
+
"abaddad2"
,
"42831ec2217774244b7221b784d0d49c"
+
"e3aa212f2c02a4e035c17e2329aca12e"
+
"21d514b25466931c7d8f6a5aac84aa05"
+
"1ba30b396a0aac973d58e091"
,
"698e57f70e6ecc7fd9463b7260a9ae5f"
);
test
.
check
(
5
,
"b83b533708bf535d0aa6e52980d53b78"
,
"feedfacedeadbeeffeedfacedeadbeef"
+
"abaddad2"
,
"61353b4c2806934a777ff51fa22a4755"
+
"699b2a714fcdc6f83766e5f97b6c7423"
+
"73806900e49f24b22b097544d4896b42"
+
"4989b5e1ebac0f07c23f4598"
,
"df586bb4c249b92cb6922877e444d37b"
);
}
}
test/com/sun/nio/sctp/SctpMultiChannel/SendFailed.java
0 → 100644
浏览文件 @
0963f6fc
/*
* Copyright (c) 2015, 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 8067846
* @summary Test for send failed notification
*/
import
com.sun.nio.sctp.*
;
import
java.io.IOException
;
import
java.net.InetSocketAddress
;
import
java.net.SocketAddress
;
import
java.nio.ByteBuffer
;
import
static
java
.
lang
.
System
.
out
;
import
static
java
.
nio
.
ByteBuffer
.*;
public
class
SendFailed
{
static
final
SocketAddress
remoteAddress
=
new
InetSocketAddress
(
"127.0.0.1"
,
3000
);
static
final
int
[]
bufferSizes
=
{
20
,
49
,
50
,
51
,
100
,
101
,
1024
,
1025
,
4095
,
4096
,
4097
,
8191
,
8192
,
8193
};
void
test
(
String
[]
args
)
throws
IOException
{
SocketAddress
address
=
null
;
if
(!
Util
.
isSCTPSupported
())
{
out
.
println
(
"SCTP protocol is not supported"
);
out
.
println
(
"Test cannot be run"
);
return
;
}
System
.
out
.
println
(
"remote address: "
+
remoteAddress
);
System
.
out
.
println
(
"Note, remote address should not be up"
);
/* combinations with various buffer sizes, and offsets */
for
(
int
send
=
0
;
send
<
bufferSizes
.
length
;
send
++)
{
for
(
int
recv
=
0
;
recv
<
bufferSizes
.
length
;
recv
++)
{
for
(
boolean
direct
:
new
boolean
[]
{
true
,
false
})
runWithManyOffsets
(
bufferSizes
[
send
],
bufferSizes
[
recv
],
direct
);
}
}
}
void
runWithManyOffsets
(
int
sendBufferSize
,
int
recvBufferSize
,
boolean
direct
)
throws
IOException
{
doTest
(
sendBufferSize
,
recvBufferSize
,
direct
,
0
);
doTest
(
sendBufferSize
,
recvBufferSize
,
direct
,
1
);
doTest
(
sendBufferSize
,
recvBufferSize
,
direct
,
3
);
doTest
(
sendBufferSize
,
recvBufferSize
,
direct
,
7
);
doTest
(
sendBufferSize
,
recvBufferSize
,
direct
,
9
);
doTest
(
sendBufferSize
,
recvBufferSize
,
direct
,
13
);
doTest
(
sendBufferSize
,
recvBufferSize
,
direct
,
15
);
}
void
doTest
(
int
sendBufferSize
,
int
recvBufferSize
,
boolean
direct
,
int
offset
)
throws
IOException
{
debug
(
"%n--- Testing with send size:[%d], recv size:[%d], offset:[%d] "
+
", direct [%s]. "
,
sendBufferSize
,
recvBufferSize
,
offset
,
direct
);
try
(
SctpMultiChannel
channel
=
SctpMultiChannel
.
open
())
{
MessageInfo
messageInfo
=
MessageInfo
.
createOutgoing
(
remoteAddress
,
0
);
ByteBuffer
sendBuffer
=
filledBuffer
(
sendBufferSize
,
direct
);
debug
(
"%nAttempting to send to %s. "
,
remoteAddress
);
int
sent
=
channel
.
send
(
sendBuffer
,
messageInfo
);
sendBuffer
.
flip
();
SendFailedNotificationHandler
handler
=
new
SendFailedNotificationHandler
();
ByteBuffer
recvBuffer
=
direct
?
allocateDirect
(
recvBufferSize
)
:
allocate
((
recvBufferSize
));
channel
.
receive
(
recvBuffer
,
null
,
handler
);
// verify sent buffer received by send failed notification
ByteBuffer
buffer
=
handler
.
getSendFailedByteBuffer
();
check
(
buffer
.
remaining
()
==
sent
);
check
(
buffer
.
position
()
==
0
);
check
(
buffer
.
limit
()
==
sent
);
assertSameContent
(
sendBuffer
,
handler
.
getSendFailedByteBuffer
());
}
}
class
SendFailedNotificationHandler
extends
AbstractNotificationHandler
<
Object
>
{
/** Reference to the buffer captured in send failed notification */
private
ByteBuffer
sentBuffer
;
@Override
public
HandlerResult
handleNotification
(
Notification
notification
,
Object
attachment
)
{
fail
(
"Unknown notification type"
);
return
HandlerResult
.
CONTINUE
;
}
@Override
public
HandlerResult
handleNotification
(
AssociationChangeNotification
notification
,
Object
attachment
)
{
AssociationChangeNotification
.
AssocChangeEvent
event
=
notification
.
event
();
debug
(
"%nAssociationChangeNotification"
);
debug
(
"%n Association: %s. "
,
notification
.
association
());
debug
(
"%n Event: %s. "
,
event
);
return
HandlerResult
.
CONTINUE
;
}
@Override
public
HandlerResult
handleNotification
(
SendFailedNotification
notification
,
Object
attachment
)
{
debug
(
"%nSendFailedNotification: %s. "
,
notification
);
sentBuffer
=
notification
.
buffer
();
return
HandlerResult
.
RETURN
;
}
public
ByteBuffer
getSendFailedByteBuffer
()
{
return
sentBuffer
;
}
@Override
public
HandlerResult
handleNotification
(
PeerAddressChangeNotification
pacn
,
Object
attachment
)
{
debug
(
"%nPeerAddressChangeNotification: %s"
,
pacn
);
return
HandlerResult
.
CONTINUE
;
}
@Override
public
HandlerResult
handleNotification
(
ShutdownNotification
notification
,
Object
attachment
)
{
debug
(
"%nShutdownNotification"
);
debug
(
"%n Association: %s. "
,
notification
.
association
());
return
HandlerResult
.
CONTINUE
;
}
}
static
ByteBuffer
filledBuffer
(
int
size
,
boolean
direct
)
{
ByteBuffer
buffer
=
direct
?
allocateDirect
(
size
)
:
allocate
((
size
));
for
(
int
i
=
0
;
i
<
size
;
i
++)
buffer
.
put
((
byte
)
i
);
buffer
.
flip
();
return
buffer
;
}
static
void
assertSameContent
(
ByteBuffer
bb1
,
ByteBuffer
bb2
)
{
if
(!
bb1
.
equals
(
bb2
))
throw
new
RuntimeException
(
"Buffers are not equal; bb1: "
+
bb1
+
", bb2: "
+
bb2
);
}
//--------------------- Infrastructure ---------------------------
boolean
debug
=
true
;
volatile
int
passed
=
0
,
failed
=
0
;
void
pass
()
{
passed
++;}
void
fail
()
{
failed
++;
Thread
.
dumpStack
();}
void
fail
(
String
msg
)
{
System
.
err
.
println
(
msg
);
fail
();}
void
unexpected
(
Throwable
t
)
{
failed
++;
t
.
printStackTrace
();}
void
check
(
boolean
cond
)
{
if
(
cond
)
pass
();
else
fail
();}
void
check
(
boolean
cond
,
String
failMessage
)
{
if
(
cond
)
pass
();
else
fail
(
failMessage
);}
void
debug
(
String
message
,
Object
...
args
)
{
if
(
debug
)
{
out
.
printf
(
message
,
args
);
}
}
public
static
void
main
(
String
[]
args
)
throws
Throwable
{
Class
<?>
k
=
new
Object
(){}.
getClass
().
getEnclosingClass
();
try
{
k
.
getMethod
(
"instanceMain"
,
String
[].
class
)
.
invoke
(
k
.
newInstance
(),
(
Object
)
args
);}
catch
(
Throwable
e
)
{
throw
e
.
getCause
();}}
public
void
instanceMain
(
String
[]
args
)
throws
Throwable
{
try
{
test
(
args
);}
catch
(
Throwable
t
)
{
unexpected
(
t
);}
out
.
printf
(
"%nPassed = %d, failed = %d%n%n"
,
passed
,
failed
);
if
(
failed
>
0
)
throw
new
AssertionError
(
"Some tests failed"
);}
}
test/java/math/BigDecimal/DivideTests.java
浏览文件 @
0963f6fc
...
...
@@ -23,7 +23,7 @@
/*
* @test
* @bug 4851776 4907265 6177836 6876282
* @bug 4851776 4907265 6177836 6876282
8066842
* @summary Some tests for the divide methods.
* @author Joseph D. Darcy
*/
...
...
@@ -358,6 +358,57 @@ public class DivideTests {
return
failures
;
}
private
static
int
divideByOneTests
()
{
int
failures
=
0
;
//problematic divisor: one with scale 17
BigDecimal
one
=
BigDecimal
.
ONE
.
setScale
(
17
);
RoundingMode
rounding
=
RoundingMode
.
UNNECESSARY
;
long
[][]
unscaledAndScale
=
new
long
[][]
{
{
Long
.
MAX_VALUE
,
17
},
{-
Long
.
MAX_VALUE
,
17
},
{
Long
.
MAX_VALUE
,
0
},
{-
Long
.
MAX_VALUE
,
0
},
{
Long
.
MAX_VALUE
,
100
},
{-
Long
.
MAX_VALUE
,
100
}
};
for
(
long
[]
uas
:
unscaledAndScale
)
{
long
unscaled
=
uas
[
0
];
int
scale
=
(
int
)
uas
[
1
];
BigDecimal
noRound
=
null
;
try
{
noRound
=
BigDecimal
.
valueOf
(
unscaled
,
scale
).
divide
(
one
,
RoundingMode
.
UNNECESSARY
);
}
catch
(
ArithmeticException
e
)
{
failures
++;
System
.
err
.
println
(
"ArithmeticException for value "
+
unscaled
+
" and scale "
+
scale
+
" without rounding"
);
}
BigDecimal
roundDown
=
null
;
try
{
roundDown
=
BigDecimal
.
valueOf
(
unscaled
,
scale
).
divide
(
one
,
RoundingMode
.
DOWN
);
}
catch
(
ArithmeticException
e
)
{
failures
++;
System
.
err
.
println
(
"ArithmeticException for value "
+
unscaled
+
" and scale "
+
scale
+
" with rounding down"
);
}
if
(
noRound
!=
null
&&
roundDown
!=
null
&&
noRound
.
compareTo
(
roundDown
)
!=
0
)
{
failures
++;
System
.
err
.
println
(
"Equality failure for value "
+
unscaled
+
" and scale "
+
scale
);
}
}
return
failures
;
}
public
static
void
main
(
String
argv
[])
{
int
failures
=
0
;
...
...
@@ -366,10 +417,11 @@ public class DivideTests {
failures
+=
properScaleTests
();
failures
+=
trailingZeroTests
();
failures
+=
scaledRoundedDivideTests
();
failures
+=
divideByOneTests
();
if
(
failures
>
0
)
{
throw
new
RuntimeException
(
"Incurred "
+
failures
+
" failures while testing
exact divide
."
);
" failures while testing
division
."
);
}
}
}
test/java/net/Socks/BadProxySelector.java
0 → 100644
浏览文件 @
0963f6fc
/*
* Copyright (c) 2015, 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 7178362
* @run main/othervm BadProxySelector
*/
import
java.net.InetSocketAddress
;
import
java.net.Proxy
;
import
java.net.ProxySelector
;
import
java.net.Socket
;
import
java.net.SocketAddress
;
import
java.net.ServerSocket
;
import
java.net.URI
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.io.*
;
public
class
BadProxySelector
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
ProxySelector
.
setDefault
(
new
HTTPProxySelector
());
try
(
ServerSocket
ss
=
new
ServerSocket
(
0
);
Socket
s1
=
new
Socket
(
ss
.
getInetAddress
(),
ss
.
getLocalPort
());
Socket
s2
=
ss
.
accept
())
{
}
ProxySelector
.
setDefault
(
new
NullHTTPProxySelector
());
try
(
ServerSocket
ss
=
new
ServerSocket
(
0
);
Socket
s1
=
new
Socket
(
ss
.
getInetAddress
(),
ss
.
getLocalPort
());
Socket
s2
=
ss
.
accept
())
{
}
}
// always returns bogus HTTP proxies
private
static
class
HTTPProxySelector
extends
ProxySelector
{
@Override
public
void
connectFailed
(
URI
uri
,
SocketAddress
sa
,
IOException
ioe
)
{}
@Override
public
List
<
Proxy
>
select
(
URI
uri
)
{
List
<
Proxy
>
proxies
=
new
ArrayList
<>();
proxies
.
add
(
new
Proxy
(
Proxy
.
Type
.
HTTP
,
new
InetSocketAddress
(
"localhost"
,
0
)));
proxies
.
add
(
new
Proxy
(
Proxy
.
Type
.
HTTP
,
new
InetSocketAddress
(
"localhost"
,
0
)));
return
proxies
;
}
}
private
static
class
NullHTTPProxySelector
extends
ProxySelector
{
@Override
public
void
connectFailed
(
URI
uri
,
SocketAddress
sa
,
IOException
ioe
)
{}
@Override
public
List
<
Proxy
>
select
(
URI
uri
)
{
List
<
Proxy
>
proxies
=
new
ArrayList
<>();
proxies
.
add
(
null
);
proxies
.
add
(
new
Proxy
(
Proxy
.
Type
.
HTTP
,
new
InetSocketAddress
(
"localhost"
,
0
)));
return
proxies
;
}
}
}
test/java/nio/charset/Charset/RegisteredCharsets.java
浏览文件 @
0963f6fc
...
...
@@ -135,6 +135,7 @@ public class RegisteredCharsets {
"x-IBM1122"
,
"x-IBM1123"
,
"x-IBM1124"
,
"x-IBM1166"
,
"x-IBM875"
,
"x-IBM921"
,
"x-IBM922"
,
...
...
@@ -863,6 +864,14 @@ public class RegisteredCharsets {
"1124"
}
);
aliasCheck
(
"x-IBM1166"
,
new
String
[]
{
"cp1166"
,
// JDK historical
"ibm1166"
,
"ibm-1166"
,
"1166"
}
);
aliasCheck
(
"IBM273"
,
new
String
[]
{
"cp273"
,
// JDK historical
...
...
test/java/nio/charset/RemovingSunIO/SunioAlias.java
浏览文件 @
0963f6fc
...
...
@@ -674,6 +674,12 @@ public class SunioAlias {
aliasTable
.
put
(
"cp1124"
,
"Cp1124"
);
aliasTable
.
put
(
"1124"
,
"Cp1124"
);
// MIBenum: ????
aliasTable
.
put
(
"ibm1166"
,
"Cp1166"
);
aliasTable
.
put
(
"ibm-1166"
,
"Cp1166"
);
aliasTable
.
put
(
"cp1166"
,
"Cp1166"
);
aliasTable
.
put
(
"1166"
,
"Cp1166"
);
// MIBenum: ????
aliasTable
.
put
(
"ibm1381"
,
"Cp1381"
);
/* MDA */
aliasTable
.
put
(
"ibm-1381"
,
"Cp1381"
);
/* MDA */
...
...
test/java/util/Arrays/TimSortStackSize2.java
0 → 100644
浏览文件 @
0963f6fc
/*
* Copyright (c) 2015, 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 8072909
* @run main/othervm -Xms385m TimSortStackSize2 67108864
* @summary Test TimSort stack size on big arrays
* big tests not for regular execution on all platforms:
* run main/othervm -Xmx8g TimSortStackSize2 1073741824
* run main/othervm -Xmx16g TimSortStackSize2 2147483644
*/
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.function.Consumer
;
public
class
TimSortStackSize2
{
public
static
void
main
(
String
[]
args
)
{
int
lengthOfTest
=
Integer
.
parseInt
(
args
[
0
]);
boolean
passed
=
doTest
(
"TimSort"
,
lengthOfTest
,
(
Integer
[]
a
)
->
Arrays
.
sort
(
a
));
passed
=
doTest
(
"ComparableTimSort"
,
lengthOfTest
,
(
Integer
[]
a
)
->
Arrays
.
sort
(
a
,
(
Object
first
,
Object
second
)
->
{
return
((
Comparable
<
Object
>)
first
).
compareTo
(
second
);
}))
&&
passed
;
if
(
!
passed
){
throw
new
RuntimeException
();
}
}
private
static
boolean
doTest
(
final
String
msg
,
final
int
lengthOfTest
,
final
Consumer
<
Integer
[]>
c
){
Integer
[]
a
=
null
;
try
{
a
=
new
TimSortStackSize2
(
lengthOfTest
).
createArray
();
long
begin
=
System
.
nanoTime
();
c
.
accept
(
a
);
long
end
=
System
.
nanoTime
();
System
.
out
.
println
(
msg
+
" OK. Time: "
+
(
end
-
begin
)
+
"ns"
);
}
catch
(
ArrayIndexOutOfBoundsException
e
){
System
.
out
.
println
(
msg
+
" broken:"
);
e
.
printStackTrace
();
return
false
;
}
finally
{
a
=
null
;
}
return
true
;
}
private
static
final
int
MIN_MERGE
=
32
;
private
final
int
minRun
;
private
final
int
length
;
private
final
List
<
Long
>
runs
=
new
ArrayList
<
Long
>();
public
TimSortStackSize2
(
final
int
len
)
{
this
.
length
=
len
;
minRun
=
minRunLength
(
len
);
fillRunsJDKWorstCase
();
}
private
static
int
minRunLength
(
int
n
)
{
assert
n
>=
0
;
int
r
=
0
;
// Becomes 1 if any 1 bits are shifted off
while
(
n
>=
MIN_MERGE
)
{
r
|=
(
n
&
1
);
n
>>=
1
;
}
return
n
+
r
;
}
/**
* Adds a sequence x_1, ..., x_n of run lengths to <code>runs</code> such that:<br>
* 1. X = x_1 + ... + x_n <br>
* 2. x_j >= minRun for all j <br>
* 3. x_1 + ... + x_{j-2} < x_j < x_1 + ... + x_{j-1} for all j <br>
* These conditions guarantee that TimSort merges all x_j's one by one
* (resulting in X) using only merges on the second-to-last element.
* @param X The sum of the sequence that should be added to runs.
*/
private
void
generateJDKWrongElem
(
long
X
)
{
for
(
long
newTotal
;
X
>=
2
*
minRun
+
1
;
X
=
newTotal
)
{
//Default strategy
newTotal
=
X
/
2
+
1
;
//Specialized strategies
if
(
3
*
minRun
+
3
<=
X
&&
X
<=
4
*
minRun
+
1
)
{
// add x_1=MIN+1, x_2=MIN, x_3=X-newTotal to runs
newTotal
=
2
*
minRun
+
1
;
}
else
if
(
5
*
minRun
+
5
<=
X
&&
X
<=
6
*
minRun
+
5
)
{
// add x_1=MIN+1, x_2=MIN, x_3=MIN+2, x_4=X-newTotal to runs
newTotal
=
3
*
minRun
+
3
;
}
else
if
(
8
*
minRun
+
9
<=
X
&&
X
<=
10
*
minRun
+
9
)
{
// add x_1=MIN+1, x_2=MIN, x_3=MIN+2, x_4=2MIN+2, x_5=X-newTotal to runs
newTotal
=
5
*
minRun
+
5
;
}
else
if
(
13
*
minRun
+
15
<=
X
&&
X
<=
16
*
minRun
+
17
)
{
// add x_1=MIN+1, x_2=MIN, x_3=MIN+2, x_4=2MIN+2, x_5=3MIN+4, x_6=X-newTotal to runs
newTotal
=
8
*
minRun
+
9
;
}
runs
.
add
(
0
,
X
-
newTotal
);
}
runs
.
add
(
0
,
X
);
}
/**
* Fills <code>runs</code> with a sequence of run lengths of the form<br>
* Y_n x_{n,1} x_{n,2} ... x_{n,l_n} <br>
* Y_{n-1} x_{n-1,1} x_{n-1,2} ... x_{n-1,l_{n-1}} <br>
* ... <br>
* Y_1 x_{1,1} x_{1,2} ... x_{1,l_1}<br>
* The Y_i's are chosen to satisfy the invariant throughout execution,
* but the x_{i,j}'s are merged (by <code>TimSort.mergeCollapse</code>)
* into an X_i that violates the invariant.
* X is the sum of all run lengths that will be added to <code>runs</code>.
*/
private
void
fillRunsJDKWorstCase
()
{
long
runningTotal
=
0
;
long
Y
=
minRun
+
4
;
long
X
=
minRun
;
while
(
runningTotal
+
Y
+
X
<=
length
)
{
runningTotal
+=
X
+
Y
;
generateJDKWrongElem
(
X
);
runs
.
add
(
0
,
Y
);
// X_{i+1} = Y_i + x_{i,1} + 1, since runs.get(1) = x_{i,1}
X
=
Y
+
runs
.
get
(
1
)
+
1
;
// Y_{i+1} = X_{i+1} + Y_i + 1
Y
+=
X
+
1
;
}
if
(
runningTotal
+
X
<=
length
)
{
runningTotal
+=
X
;
generateJDKWrongElem
(
X
);
}
runs
.
add
(
length
-
runningTotal
);
}
private
Integer
[]
createArray
()
{
Integer
[]
a
=
new
Integer
[
length
];
Arrays
.
fill
(
a
,
0
);
int
endRun
=
-
1
;
for
(
long
len
:
runs
)
{
a
[
endRun
+=
len
]
=
1
;
}
a
[
length
-
1
]
=
0
;
return
a
;
}
}
test/java/util/zip/TestExtraTime.java
浏览文件 @
0963f6fc
...
...
@@ -23,7 +23,7 @@
/**
* @test
* @bug 4759491 6303183 7012868 8015666 8023713
* @bug 4759491 6303183 7012868 8015666 8023713
8068790
* @summary Test ZOS and ZIS timestamp in extra field correctly
*/
...
...
@@ -69,6 +69,8 @@ public class TestExtraTime {
test
(
mtime
,
atime
,
ctime
,
tz
,
extra
);
}
}
testNullHandling
();
}
static
void
test
(
FileTime
mtime
,
FileTime
atime
,
FileTime
ctime
,
...
...
@@ -154,4 +156,26 @@ public class TestExtraTime {
}
}
}
static
void
testNullHandling
()
{
ZipEntry
ze
=
new
ZipEntry
(
"TestExtraTime.java"
);
try
{
ze
.
setLastAccessTime
(
null
);
throw
new
RuntimeException
(
"setLastAccessTime(null) should throw NPE"
);
}
catch
(
NullPointerException
ignored
)
{
// pass
}
try
{
ze
.
setCreationTime
(
null
);
throw
new
RuntimeException
(
"setCreationTime(null) should throw NPE"
);
}
catch
(
NullPointerException
ignored
)
{
// pass
}
try
{
ze
.
setLastModifiedTime
(
null
);
throw
new
RuntimeException
(
"setLastModifiedTime(null) should throw NPE"
);
}
catch
(
NullPointerException
ignored
)
{
// pass
}
}
}
test/javax/accessibility/8069268/bug8069268.java
0 → 100644
浏览文件 @
0963f6fc
/*
* Copyright (c) 2015, 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 8069268
@summary Tests that only one ContainerListener exists for AccessibleJComponent of JRootPane
@author Vivi An
*/
import
javax.swing.*
;
import
java.awt.event.*
;
import
javax.accessibility.*
;
public
class
bug8069268
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
TestableRootPane
rootPane
=
new
TestableRootPane
();
// Get accesibleContext and then AccessibleJComponent, call the function
// addPropertyChangeListener to trigger container listener to be added
AccessibleContext
acc
=
rootPane
.
getAccessibleContext
();
JComponent
.
AccessibleJComponent
accJ
=
(
JComponent
.
AccessibleJComponent
)
acc
;
accJ
.
addPropertyChangeListener
(
null
);
// Test how many container listener(s) exist(s), should only have 1
if
(!
rootPane
.
testContainerListener
())
throw
new
RuntimeException
(
"Failed test for bug 8069268"
);
}
private
static
class
TestableRootPane
extends
JRootPane
{
public
boolean
testContainerListener
()
{
boolean
result
=
false
;
ContainerListener
[]
listeners
=
getContainerListeners
();
System
.
out
.
println
(
"ContainerListener number is "
+
listeners
.
length
);
result
=
(
listeners
.
length
==
1
)
?
true
:
false
;
return
result
;
}
}
}
test/javax/swing/JMenu/8071705/bug8071705.java
0 → 100644
浏览文件 @
0963f6fc
/*
* Copyright (c) 2015, 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 8071705
* @summary Java application menu misbehaves when running multiple screen stacked vertically
* @build bug8071705
* @run main/othervm bug8071705
*/
import
java.awt.Dimension
;
import
java.awt.GraphicsConfiguration
;
import
java.awt.GraphicsDevice
;
import
java.awt.GraphicsEnvironment
;
import
java.awt.Point
;
import
java.awt.Rectangle
;
import
java.awt.Toolkit
;
import
java.awt.event.ComponentAdapter
;
import
java.awt.event.ComponentEvent
;
import
java.awt.event.KeyEvent
;
import
java.util.concurrent.CountDownLatch
;
import
javax.swing.JFrame
;
import
javax.swing.JMenu
;
import
javax.swing.JMenuBar
;
import
javax.swing.JMenuItem
;
import
javax.swing.JPopupMenu
;
import
javax.swing.SwingUtilities
;
import
javax.swing.UIManager
;
public
class
bug8071705
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
final
CountDownLatch
latch
=
new
CountDownLatch
(
1
);
final
boolean
[]
result
=
new
boolean
[
1
];
SwingUtilities
.
invokeLater
(
new
Runnable
()
{
@Override
public
void
run
()
{
JFrame
frame
=
createGUI
();
GraphicsDevice
[]
devices
=
checkScreens
();
// check if we have more than one and if they are stacked
// vertically
GraphicsDevice
device
=
checkConfigs
(
devices
);
if
(
device
==
null
)
{
// just pass the test
frame
.
dispose
();
result
[
0
]
=
true
;
latch
.
countDown
();
}
else
{
FrameListener
listener
=
new
FrameListener
(
device
,
latch
,
result
);
frame
.
addComponentListener
(
listener
);
frame
.
setVisible
(
true
);
}
}
});
latch
.
await
();
if
(
result
[
0
]
==
false
)
{
throw
new
RuntimeException
(
"popup menu rendered in wrong position"
);
}
System
.
out
.
println
(
"OK"
);
}
private
static
GraphicsDevice
[]
checkScreens
()
{
GraphicsEnvironment
ge
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
();
return
ge
.
getScreenDevices
();
}
private
static
JFrame
createGUI
()
{
JMenuBar
menuBar
=
new
JMenuBar
();
JMenu
menu
=
new
JMenu
(
"Some menu"
);
menuBar
.
add
(
menu
);
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
menu
.
add
(
new
JMenuItem
(
"Some menu #"
+
i
));
}
JFrame
frame
=
new
JFrame
();
frame
.
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
frame
.
setMinimumSize
(
new
Dimension
(
200
,
200
));
frame
.
setJMenuBar
(
menuBar
);
return
frame
;
}
private
static
GraphicsDevice
checkConfigs
(
GraphicsDevice
[]
devices
)
{
GraphicsDevice
correctDevice
=
null
;
if
(
devices
.
length
<
2
)
{
return
correctDevice
;
}
Toolkit
toolkit
=
Toolkit
.
getDefaultToolkit
();
Rectangle
screenBounds
=
new
Rectangle
(
toolkit
.
getScreenSize
());
int
halfScreen
=
screenBounds
.
height
/
2
;
for
(
int
i
=
0
;
i
<
devices
.
length
;
i
++)
{
if
(
devices
[
i
].
getType
()
==
GraphicsDevice
.
TYPE_RASTER_SCREEN
)
{
GraphicsConfiguration
conf
=
devices
[
i
].
getDefaultConfiguration
();
Rectangle
bounds
=
conf
.
getBounds
();
if
(
bounds
.
y
>=
halfScreen
)
{
// found
correctDevice
=
devices
[
i
];
break
;
}
}
}
return
correctDevice
;
}
private
static
class
FrameListener
extends
ComponentAdapter
{
private
GraphicsDevice
device
;
private
CountDownLatch
latch
;
private
boolean
[]
result
;
public
FrameListener
(
GraphicsDevice
device
,
CountDownLatch
latch
,
boolean
[]
result
)
{
this
.
device
=
device
;
this
.
latch
=
latch
;
this
.
result
=
result
;
}
@Override
public
void
componentShown
(
ComponentEvent
e
)
{
JFrame
frame
=
(
JFrame
)
e
.
getComponent
();
runActualTest
(
device
,
latch
,
frame
,
result
);
frame
.
setVisible
(
false
);
frame
.
dispose
();
latch
.
countDown
();
}
}
private
static
Rectangle
setLocation
(
JFrame
frame
,
GraphicsDevice
device
)
{
GraphicsConfiguration
conf
=
device
.
getDefaultConfiguration
();
Rectangle
bounds
=
conf
.
getBounds
();
// put just below half screen
int
x
=
bounds
.
x
+
bounds
.
width
/
2
;
int
y
=
bounds
.
y
+
bounds
.
height
/
2
;
frame
.
setLocation
(
x
,
y
);
return
bounds
;
}
private
static
void
runActualTest
(
GraphicsDevice
device
,
CountDownLatch
latch
,
JFrame
frame
,
boolean
[]
result
)
{
Rectangle
screenBounds
=
setLocation
(
frame
,
device
);
JMenu
menu
=
frame
.
getJMenuBar
().
getMenu
(
0
);
menu
.
doClick
();
Point
location
=
menu
.
getLocationOnScreen
();
JPopupMenu
pm
=
menu
.
getPopupMenu
();
Dimension
pmSize
=
pm
.
getSize
();
int
yOffset
=
UIManager
.
getInt
(
"Menu.submenuPopupOffsetY"
);
int
height
=
location
.
y
+
yOffset
+
pmSize
.
height
+
menu
.
getHeight
();
int
available
=
screenBounds
.
y
+
screenBounds
.
height
-
height
;
if
(
available
>
0
)
{
Point
origin
=
pm
.
getLocationOnScreen
();
if
(
origin
.
y
<
location
.
y
)
{
// growing upward, wrong!
result
[
0
]
=
false
;
}
else
{
// growing downward, ok!
result
[
0
]
=
true
;
}
}
else
{
// there is no space, growing upward would be ok, so we pass
result
[
0
]
=
true
;
}
}
}
test/javax/swing/JTree/8072676/TreeClipTest.java
0 → 100644
浏览文件 @
0963f6fc
/*
* Copyright (c) 2015, 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.
*/
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
import
java.io.File
;
import
java.io.IOException
;
import
javax.imageio.ImageIO
;
import
javax.swing.*
;
import
javax.swing.tree.DefaultMutableTreeNode
;
import
javax.swing.tree.DefaultTreeModel
;
/*
* @test
* @bug 8072676
* @summary Checks if the tree painter doesn't expand existing clip
* @author Anton Nashatyrev
*/
public
class
TreeClipTest
{
static
boolean
passed
=
true
;
static
boolean
checkImage
(
BufferedImage
img
,
int
clipY
)
{
for
(
int
y
=
clipY
;
y
<
img
.
getHeight
();
y
++)
{
for
(
int
x
=
0
;
x
<
img
.
getWidth
();
x
++)
{
if
((
img
.
getRGB
(
x
,
y
)
&
0xFFFFFF
)
!=
0xFFFFFF
)
{
return
false
;
}
}
}
return
true
;
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
DefaultMutableTreeNode
root
=
new
DefaultMutableTreeNode
(
"JTree"
);
DefaultMutableTreeNode
parent
;
parent
=
new
DefaultMutableTreeNode
(
"colors"
);
root
.
add
(
parent
);
parent
.
add
(
new
DefaultMutableTreeNode
(
"blue"
));
DefaultTreeModel
model
=
new
DefaultTreeModel
(
root
);
JTree
tree
=
new
JTree
(
model
);
BufferedImage
img
=
new
BufferedImage
(
50
,
50
,
BufferedImage
.
TYPE_INT_ARGB
);
for
(
int
clipY
=
1
;
clipY
<
50
;
clipY
++)
{
Graphics2D
ig
=
img
.
createGraphics
();
ig
.
setColor
(
Color
.
WHITE
);
ig
.
fillRect
(
0
,
0
,
1000
,
1000
);
tree
.
setSize
(
200
,
200
);
ig
.
setClip
(
0
,
0
,
1000
,
clipY
);
tree
.
paint
(
ig
);
ig
.
dispose
();
if
(!
checkImage
(
img
,
clipY
))
{
System
.
err
.
println
(
"Failed with clipY="
+
clipY
);
passed
=
false
;
try
{
ImageIO
.
write
(
img
,
"PNG"
,
new
File
(
"failedResult.png"
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
;
}
}
}
});
if
(!
passed
)
{
throw
new
RuntimeException
(
"Test failed."
);
}
else
{
System
.
out
.
println
(
"Passed."
);
}
}
}
\ No newline at end of file
test/sun/nio/cs/CheckHistoricalNames.java
浏览文件 @
0963f6fc
...
...
@@ -196,6 +196,7 @@ public class CheckHistoricalNames {
checkMappedName
(
"IBM1122"
,
"Cp1122"
);
checkMappedName
(
"IBM1123"
,
"Cp1123"
);
checkMappedName
(
"IBM1124"
,
"Cp1124"
);
checkMappedName
(
"IBM1166"
,
"Cp1166"
);
checkMappedName
(
"IBM01140"
,
"Cp1140"
);
checkMappedName
(
"IBM01141"
,
"Cp1141"
);
checkMappedName
(
"IBM01142"
,
"Cp1142"
);
...
...
test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java
浏览文件 @
0963f6fc
/*
* Copyright (c) 2003, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
5
, 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
...
...
@@ -27,6 +27,7 @@
* @summary Verify that the RSA KeyPairGenerator works
* @author Andreas Sterbenz
* @library ..
* @run main/othervm TestKeyPairGenerator
*/
import
java.io.*
;
...
...
test/sun/security/tools/keytool/ListKeychainStore.sh
浏览文件 @
0963f6fc
#
# Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, 201
4
, 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
...
...
@@ -22,7 +22,7 @@
#
# @test
# @bug 7133495
# @bug 7133495
8041740
# @summary [macosx] KeyChain KeyStore implementation retrieves only one private key entry
if
[
"
${
TESTJAVA
}
"
=
""
]
;
then
...
...
@@ -49,8 +49,10 @@ PWD="xxxxxx"
KEYTOOL
=
"
${
TESTJAVA
}
/bin/keytool -storetype KeychainStore -keystore NONE -storepass
$PWD
"
TEMPORARY_P12
=
"
$TESTCLASSES
/7133495.p12"
TEMPORARY_KC
=
"
$TESTCLASSES
/7133495.keychain"
TEMPORARY_LIST
=
"
$TESTCLASSES
/7133495.tmp"
CLEANUP_P12
=
"rm -f
$TEMPORARY_P12
"
CLEANUP_KC
=
"security delete-keychain
$TEMPORARY_KC
"
CLEANUP_LIST
=
"rm -f
$TEMPORARY_LIST
"
# Count the number of private key entries in the Keychain keystores
...
...
@@ -115,6 +117,15 @@ if [ $? -ne 0 ]; then
fi
echo
"Imported keypairs from PKCS12 keystore into the keychain"
# Adjust the keychain search order
echo
"
\"
$TEMPORARY_KC
\"
"
>
$TEMPORARY_LIST
security list-keychains
>>
$TEMPORARY_LIST
security list-keychains
-s
`
xargs <
${
TEMPORARY_LIST
}
`
`
$CLEANUP_LIST
`
echo
"Temporary keychain search order:"
security list-keychains
# Recount the number of private key entries in the Keychain keystores
COUNT
=
`
$KEYTOOL
-list
|
grep
PrivateKeyEntry |
wc
-l
`
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录