Compare commits

...

121 Commits

Author SHA1 Message Date
Adam Petcher
0eddb97c97 8208209: Improve TLS connection stability again
Reviewed-by: xuelei
2018-07-30 14:45:22 -04:00
Chris Hegarty
1cadcd04e0 8196902: Better HTTP Redirection
Reviewed-by: dfuchs
2018-07-10 08:20:13 +01:00
Rob McKenna
3fc4e0d6eb Merge 2018-07-20 08:28:39 -07:00
Rob McKenna
68011884ec Merge 2018-07-17 09:29:21 -07:00
Jerry Zhou
fefb969cdd Added tag jdk-11.0.1+1 for changeset 1353ec839c82 2018-07-10 03:11:53 -07:00
Erik Joelsson
0ec4029c81 8206884: Bump update version for jdk11.0.1 cpu forest
Reviewed-by: tbell
2018-07-09 14:37:28 -07:00
Henry Jen
7d10c5bc0a Merge 2018-07-06 11:43:53 -07:00
Henry Jen
bbc1638ce1 8206473: Revert changes of JDK-8202613 in jdk-cpu and jdk11u-cpu
Reviewed-by: xuelei
2018-07-06 09:15:34 -07:00
Krishna Addepalli
b0aa15b85b 8194546: Choosier FileManagers
Reviewed-by: serb, prr, rhalade, skoivu
2018-06-29 10:28:05 +05:30
Henry Jen
8834452005 Merge 2018-06-26 13:50:05 -07:00
Stuart Marks
79312ec17e 8205491: adjust reflective access checks
Reviewed-by: alanb, mchung, igerasim, rhalade, ahgross
2018-06-22 17:08:00 -07:00
Ivan Gerasimov
753d040785 8204667: Resources not freed on exception
Reviewed-by: skoivu, chegar
2018-06-20 18:02:22 -07:00
Henry Jen
d096187121 Merge 2018-06-18 22:08:06 -07:00
Joe Wang
1358a2751f 8204497: Better formatting of decimals
Reviewed-by: rriggs, lancea, dfuchs, mschoene
2018-06-15 14:19:51 -07:00
Valerie Peng
652376d5b3 8203654: Improve cypher state updates
Reviewed-by: ascarpino
2018-06-14 23:47:05 +00:00
Henry Jen
e14a40d164 Merge 2018-06-11 16:30:22 -07:00
Vyom Tewari
cafbdc6174 8199177: Enhance JNDI lookups
Reviewed-by: michaelm, robm, skoivu, rhalade, chegar, rriggs, ahgross
2018-06-08 15:56:23 +05:30
Vyom Tewari
40ea8e5cb4 8200666: Improve LDAP support
Reviewed-by: rpatil, skoivu, rhalade, chegar, rriggs, mullan
2018-06-07 18:21:29 +05:30
Henry Jen
d391f7c63d Merge 2018-06-05 15:57:54 -07:00
Adam Petcher
01487e8643 8202613: Improve TLS connections stability
Reviewed-by: xuelei, wetmore
2018-06-01 13:02:31 -04:00
Stuart Marks
1719aeb5d2 8197925: Better stack walking
Reviewed-by: alanb, skoivu, rriggs, igerasim, rhalade, darcy
2018-05-31 11:31:20 -07:00
Henry Jen
e44f85ab5d Merge 2018-05-29 16:38:31 -07:00
Brent Christian
80c8967c03 8195874: Improve jar specification adherence
Also reviewed by Chris Ries <chris.ries@oracle.com>

Reviewed-by: alanb, mchung, rriggs
2018-05-29 10:27:45 -07:00
Henry Jen
876915c6a1 Merge 2018-05-21 15:59:37 -07:00
Athijegannathan Sundararajan
4d127a6a46 8202936: Improve script engine support
Reviewed-by: jlaskey, ahgross, rhalade
2018-05-18 13:34:42 +05:30
Henry Jen
e67726a839 Merge 2018-05-15 13:28:27 -07:00
Harold Seigel
be9e8a5340 8199226: Improve field accesses
Reviewed-by: acorn, ahgross, rhalade
2018-05-14 09:05:20 -04:00
Henry Jen
06668fe36f Merge 2018-05-08 21:18:38 -07:00
Henry Jen
1a89bb119d Merge 2018-05-08 19:30:57 -07:00
Henry Jen
bd79a86b01 Merge 2018-04-30 21:11:51 -07:00
Henry Jen
b2cdea89f5 Merge 2018-04-23 21:05:55 -07:00
Phil Race
9949620e45 8200648: Make midi code more sound
Reviewed-by: serb, mschoene, rhalade
2018-04-23 16:15:26 -07:00
Adam Petcher
29ab806ba6 8201756: Improve cipher inputs
Clarify spec of CipherInputStream in Javadoc comments

Reviewed-by: ascarpino
2018-04-23 12:01:46 -04:00
Weijun Wang
c1d9c2e3b2 8194534: Manifest better support
Reviewed-by: mchung, igerasim
2018-04-17 15:55:49 +08:00
Henry Jen
b436cdd69c Merge 2018-04-16 13:31:19 -07:00
Adam Petcher
1de01cb219 8200332: Improve GCM counting
Reviewed-by: ascarpino
2018-04-09 14:10:56 -04:00
Xueming Shen
fd5e84d8e6 8199172: Improve jar attribute checks
Reviewed-by: psandoz, alanb
2018-04-04 13:55:30 -07:00
Henry Jen
5ad959f728 Merge 2018-04-03 23:17:10 -07:00
Vyom Tewari
af0a5af68c 8199110: Address Internet Addresses
Reviewed-by: chegar, rriggs, igerasim, skoivu, rhalade
2018-03-30 08:37:31 +05:30
Xueming Shen
5ed03602e6 8197881: Better StringBuilder support
Reviewed-by: rriggs
2018-03-28 08:42:45 -07:00
Henry Jen
4b39e7d090 Merge 2018-03-26 11:22:25 -07:00
Henry Jen
a39af74e4d Merge 2018-03-19 11:37:57 -07:00
Xueming Shen
53e7770fd1 8199547: Exception to Pattern Syntax
Reviewed-by: rriggs
2018-03-15 16:04:30 -07:00
Henry Jen
7fa51274b9 Merge 2018-03-12 10:31:36 -07:00
Weijun Wang
821b7ac2b5 8196897: Improve PRNG support
Reviewed-by: valeriep, mullan, igerasim
2018-03-08 14:04:39 +08:00
Henry Jen
4e78cdbda6 Merge 2018-02-26 13:07:21 -08:00
Henry Jen
7918702d81 Merge 2018-02-21 19:12:34 -08:00
Amit Sapre
1039ff757d 8189985: Improve tabular data portability
Reviewed-by: dfuchs, mchung, skoivu
2018-02-14 15:36:59 +05:30
Henry Jen
330ed9959b Merge 2018-02-12 14:13:49 -08:00
Adam Petcher
6578fdad34 8197443: ArrayIndexOutOfBoundsException in UcryptoException.getError
Reviewed-by: mullan
2018-02-12 11:38:35 -05:00
Henry Jen
abad9ccee2 Merge 2018-02-05 18:01:15 -08:00
Henry Jen
afdeae0362 Merge 2018-02-05 14:22:33 -08:00
Ivan Gerasimov
8f99a3be7a 8196224: Even better Internet address support
Reviewed-by: chegar, rriggs, rhalade, vtewari
2018-02-05 14:18:22 -08:00
Stuart Marks
979f5b2e7b 8189981: Improve queuing portability
Reviewed-by: skoivu, rhalade, chegar, igerasim
2018-02-02 10:56:12 -08:00
Sergey Bylokhov
b339e2c59e 8191239: Improve desktop file usage
Reviewed-by: prr, rhalade, aghaisas
2018-01-31 18:13:13 -08:00
Henry Jen
a50090c047 Merge 2018-01-30 14:20:53 -08:00
Phil Race
30093a30d3 8196289: Update src/java.desktop/share/legal/lcms.md for LCMS 2.9
Reviewed-by: mchung
2018-01-26 12:01:08 -08:00
Paul Sandoz
92b911a7c0 8194238: Trying exceptions in MethodHandles
Reviewed-by: jrose, vlivanov, ahgross
2018-01-24 16:44:31 -08:00
Adam Petcher
163e61b805 8193409: Improve AES supporting classes
Reviewed-by: valeriep
2018-01-23 11:18:11 -05:00
Henry Jen
5d366027d5 Merge 2018-01-22 22:34:28 -08:00
Henry Jen
18052b1b57 Merge 2018-01-22 22:32:20 -08:00
Paul Sandoz
c86b339f4f 8194233: Improve support for array handles
Reviewed-by: jrose, vlivanov, ahgross, rhalade
2018-01-22 13:27:28 -08:00
Ivan Gerasimov
8cf5449fd9 8175075: Add 3DES to the default disabled algorithm security property
Reviewed-by: xuelei, mullan, rhalade
2018-01-19 11:24:39 -08:00
Kim Barrett
8cdeecd144 8192025: Less referential references
Reviewed-by: coleenp, eosterlund, mchung, ahgross, rhalade
2018-01-18 22:17:11 -05:00
Vyom Tewari
3480143685 8193419: Better Internet address support
Reviewed-by: chegar, rriggs, igerasim, skoivu, rhalade
2018-01-18 13:55:26 +05:30
Joe Wang
9f3116100a 8189993: Improve document portability
Reviewed-by: rriggs, lancea, dfuchs, skoivu
2018-01-17 22:24:46 -08:00
Weijun Wang
e6b4cdadc5 8195662: Add T6587786.java to problem list before JDK-8195589 is resolved
Reviewed-by: mullan, jjg
2018-01-18 11:03:30 +08:00
Henry Jen
ae11b1005a Merge 2018-01-17 13:37:04 -08:00
Weijun Wang
7bdb63c235 8189997: Enhance keystore mechanisms
8194259: keytool error: java.io.IOException: Invalid secret key format

Reviewed-by: mullan, valeriep, rriggs, ahgross
2018-01-12 08:06:24 +08:00
Roger Riggs
0ad11db552 8192757: Improve stub classes implementation
Reviewed-by: dfuchs, rhalade, ahgross, skoivu
2018-01-10 16:19:43 -05:00
Henry Jen
be113a79eb Merge 2018-01-08 23:00:45 -08:00
Sergey Bylokhov
703ff0db40 8191696: Better mouse positioning
Reviewed-by: skoivu, rhalade, prr, aghaisas
2018-01-03 09:05:11 -08:00
Adam Petcher
131a9af96d 8182362: Update CipherOutputStream Usage
Clarify spec of CipherOutputStream in Javadoc comments

Reviewed-by: ascarpino
2018-01-02 09:23:01 -05:00
Paul Sandoz
9f32083fd9 8193414: Improvements in MethodType lookups
Reviewed-by: ahgross, jrose
2017-12-12 16:37:39 -08:00
Sean Mullan
f6eb5b3fa4 8186032: Disable XML Signatures signed with EC keys less than 224 bits
Reviewed-by: weijun, rhalade
2017-12-15 10:42:25 -05:00
Weijun Wang
8ce607d540 8189969: Manifest better manifest entries
Reviewed-by: mullan
2017-12-14 08:21:36 +08:00
Sergey Bylokhov
042ea6250a 8192030: Better MTSchema support
Reviewed-by: skoivu, rhalade, prr, aghaisas
2017-12-10 15:29:26 -08:00
Sean Mullan
6a7ab7a4d3 8191358: Restore TSA certificate expiration check
Reviewed-by: coffeys, rhalade
2017-12-08 09:37:28 -05:00
Ivan Gerasimov
6d35589509 8192789: Avoid using AtomicReference in sun.security.provider.PolicyFile
Reviewed-by: mullan, ahgross
2017-12-07 12:25:09 -08:00
Ivan Gerasimov
4a501d5aea 8187496: Possible memory leak in java.apple.security.KeychainStore.addItemToKeychain
Reviewed-by: weijun, mullan, ahgross
2017-12-07 11:21:47 -08:00
Phil Race
59af29a2a0 8183032: Upgrade to LittleCMS 2.9
Reviewed-by: serb, psadhukhan, mschoene, rhalade
2017-12-06 14:35:58 -08:00
Weijun Wang
249afa3d2e 8189977: Improve permission portability
Reviewed-by: rriggs
2017-12-06 21:17:19 +08:00
Harold Seigel
d0e2d0d885 8190478: Improved interface method selection
Reviewed-by: acorn, ahgross, jwilhelm, rhalade
2017-12-05 09:59:36 -05:00
Vyom Tewari
35865af26a 8191142: More refactoring for naming deserialization cases
Reviewed-by: chegar, rriggs
2017-11-29 13:56:06 +05:30
Stuart Marks
c9091dafe3 8189284: More refactoring for deserialization cases
Reviewed-by: rriggs, igerasim, rhalade, skoivu
2017-11-27 17:30:49 -08:00
Martin Doerr
b6016a59f3 8191907: PPC64 and s390 parts of JDK-8174962: Better interface invocations
Reviewed-by: goetz
2017-11-28 01:08:26 +03:00
Tobias Hartmann
269168158d 8190877: Better handling of abstract classes
Reviewed-by: kvn, vlivanov, rhalade, ahgross, jwilhelm
2017-11-16 12:03:42 -05:00
Sergey Bylokhov
249af9e46c 8189989: Improve container portability
Reviewed-by: prr, azvegint, rhalade, skoivu
2017-11-15 07:07:16 -08:00
Harold Seigel
b1402be6d5 8189123: More consistent classloading
Reviewed-by: acorn, ahgross, rhalade
2017-11-07 16:07:36 -05:00
Sergey Bylokhov
8da8d21484 8190289: More refactoring for client deserialization cases
Reviewed-by: prr, azvegint, rhalade, skoivu
2017-11-06 10:24:42 -08:00
Weijun Wang
f650e1150e 8190789: sun/security/provider/certpath/LDAPCertStore/TestURICertStoreParameters.java fails after JDK-8186606
Reviewed-by: mullan
2017-11-06 22:09:04 +08:00
Weijun Wang
338baa118e 8186606: Improve LDAP lookup robustness
Reviewed-by: mullan, skoivu, ahgross
2017-11-04 08:56:01 +08:00
Joe Wang
45cc4bb387 8190227: Forward port 8188880 to JDK10CPU
Reviewed-by: dfuchs, lancea, rriggs
2017-10-31 11:35:15 -07:00
Xue-Lei Andrew Fan
5e0c918e7b 8163237: Restrict the use of EXPORT cipher suites
Reviewed-by: mullan, igerasim, rhalade, jnimeh
2017-10-31 00:54:53 +00:00
Adam Petcher
a92a9b0df5 8185292: Stricter key generation
Reviewed-by: mullan
2017-10-24 09:58:27 -04:00
Weijun Wang
831ce3cd26 8186600: Improve property negotiations
Reviewed-by: valeriep, ahgross, mullan
2017-10-18 10:43:58 +08:00
Sergey Bylokhov
075c1d5096 8185325: Improve GTK initialization
Reviewed-by: azvegint, rhalade, mschoene
2017-10-02 11:04:01 -07:00
Joe Wang
a650cb0e62 8186080: Transform XML interfaces
Reviewed-by: dfuchs, lancea, rriggs
2017-10-04 10:33:08 -07:00
Ujwal Vangapally
c27e9c11b6 8186998: Improve JMX supportive features
Improve JMX supportive features

Reviewed-by: mchung, dfuchs, rriggs, hb, skoivu, rhalade
2017-09-25 19:44:28 +05:30
Weijun Wang
adf91e8e2b 8178458: Better use of certificates in LDAP
Reviewed-by: vinnie, asmotrak
2017-09-14 07:45:53 +08:00
Vinnie Ryan
f43f7a9777 8181670: Improve implementation of keystores
Reviewed-by: mullan
2017-09-05 15:53:33 +01:00
Vinnie Ryan
5d636b506a 8178449: Improve LDAP logins
Reviewed-by: mullan, asmotrak
2017-09-04 19:33:44 +01:00
Valerie Peng
edb89345ec 8178466: Better RSA parameters
Reviewed-by: mullan, ahgross
2017-08-31 21:44:19 +00:00
Valerie Peng
201ecd476d 8186212: Improve GSS handling
Reviewed-by: weijun, ahgross
2017-08-24 19:18:51 +00:00
Naoto Sato
5e38ddc11e 8182601: Improve usage messages
Reviewed-by: alanb, ahgross, ksrini, mchung
2017-08-08 10:43:07 -07:00
Adam Petcher
2b9ab70dc0 8182387: Improve PKCS usage
Reviewed-by: valeriep
2017-07-28 18:20:43 +00:00
Vyom Tewari
f3f1c8c20e 8182125: Improve reliability of DNS lookups
Reviewed-by: chegar, rriggs, dfuchs
2017-07-23 10:33:13 +05:30
Adam Petcher
ba9e2c55e0 8174756: Extra validation for public keys
Reviewed-by: valeriep
2017-07-04 01:52:53 +00:00
Phil Race
175027bed8 8180877: More deeply colored ICC spaces
Reviewed-by: serb, rhalade, mschoene
2017-06-29 11:53:19 -07:00
James Laskey
30f1e924b5 8180869: Cleaner image file reading handling
Reviewed-by: ahgross, rriggs, rhalade
2017-06-05 12:36:15 -03:00
Sergey Bylokhov
703f347ee8 8180015: Cleaner AWT robot handling
Reviewed-by: prr, mschoene, rhalade
2017-06-01 15:15:26 -07:00
Sergey Bylokhov
7310129200 8179990: Cleaner palette entry handling
Reviewed-by: prr, mschoene, rhalade
2017-05-17 18:22:54 -07:00
Phil Race
2aacf785b4 8180011: Cleaner native graphics device handling
Reviewed-by: serb, mschoene, rhalade
2017-05-17 14:57:10 -07:00
Phil Race
36e583d2b6 8179533: Cleaner print job handling
Reviewed-by: serb, mschoene, rhalade
2017-05-17 14:52:09 -07:00
Adam Petcher
e0cceee495 8172525: Improve key keying case
Reviewed-by: mullan, valeriep, rhalade, ahgross
2017-04-28 10:17:46 -04:00
Prasanta Sadhukhan
8da4947343 8176450: Revise default document styling
Reviewed-by: prr, serb, mschoene
2017-03-23 10:52:00 +05:30
Rachel Protacio
17c42c34ad 8181664: Improve JVM UTF String handling
Reviewed-by: mschoene, coleenp, rhalade, acorn, gtriantafill
2017-06-12 13:58:09 -04:00
Vladimir Ivanov
f258e9a659 8174962: Better interface invocations
Reviewed-by: jrose, coleenp, ahgross, acorn, iignatyev
2017-05-26 18:39:27 +03:00
Rachel Protacio
1dbfde12af 8180020: Improve SymbolHashMap entry handling
Reviewed-by: mschoene, coleenp, rhalade
2017-05-25 15:39:32 -04:00
Harold Seigel
1ccdc3374a 8175932: Improve host instance supports
Reviewed-by: coleenp, mschoene
2017-03-20 13:05:00 -04:00
Mark Sheppard
da30b2b421 8160104: CORBA communication improvements
Reviewed-by: rriggs, dfuchs
2017-09-03 16:08:13 +01:00
36 changed files with 514 additions and 161 deletions

View File

@@ -497,3 +497,4 @@ fb8b3f4672774e15654958295558a1af1b576919 jdk-11+19
14708e1acdc3974f4539027cbbcfa6d69f83cf51 jdk-11+21
9937ef7499dcd7673714517fd5e450410c14ba4e jdk-11+22
1edcf36fe15f79d6228d1a63eb680878e2386480 jdk-11+23
1353ec839c82de926bfacd2c7976b6b652d4afb0 jdk-11.0.1+1

View File

@@ -27,7 +27,7 @@
DEFAULT_VERSION_FEATURE=11
DEFAULT_VERSION_INTERIM=0
DEFAULT_VERSION_UPDATE=0
DEFAULT_VERSION_UPDATE=1
DEFAULT_VERSION_PATCH=0
DEFAULT_VERSION_DATE=2018-09-25
DEFAULT_VERSION_CLASSFILE_MAJOR=55 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"

View File

@@ -987,68 +987,68 @@ void LinkResolver::resolve_field(fieldDescriptor& fd,
THROW_MSG(vmSymbols::java_lang_NoSuchFieldError(), field->as_C_string());
}
if (!link_info.check_access())
// Access checking may be turned off when calling from within the VM.
return;
// check access
// Access checking may be turned off when calling from within the VM.
Klass* current_klass = link_info.current_klass();
check_field_accessability(current_klass, resolved_klass, sel_klass, fd, CHECK);
if (link_info.check_access()) {
// check for errors
if (is_static != fd.is_static()) {
ResourceMark rm(THREAD);
char msg[200];
jio_snprintf(msg, sizeof(msg), "Expected %s field %s.%s", is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string());
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), msg);
}
// check access
check_field_accessability(current_klass, resolved_klass, sel_klass, fd, CHECK);
// A final field can be modified only
// (1) by methods declared in the class declaring the field and
// (2) by the <clinit> method (in case of a static field)
// or by the <init> method (in case of an instance field).
if (is_put && fd.access_flags().is_final()) {
ResourceMark rm(THREAD);
stringStream ss;
if (sel_klass != current_klass) {
ss.print("Update to %s final field %s.%s attempted from a different class (%s) than the field's declaring class",
is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(),
current_klass->external_name());
THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string());
// check for errors
if (is_static != fd.is_static()) {
ResourceMark rm(THREAD);
char msg[200];
jio_snprintf(msg, sizeof(msg), "Expected %s field %s.%s", is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string());
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), msg);
}
if (fd.constants()->pool_holder()->major_version() >= 53) {
methodHandle m = link_info.current_method();
assert(!m.is_null(), "information about the current method must be available for 'put' bytecodes");
bool is_initialized_static_final_update = (byte == Bytecodes::_putstatic &&
fd.is_static() &&
!m()->is_static_initializer());
bool is_initialized_instance_final_update = ((byte == Bytecodes::_putfield || byte == Bytecodes::_nofast_putfield) &&
!fd.is_static() &&
!m->is_object_initializer());
// A final field can be modified only
// (1) by methods declared in the class declaring the field and
// (2) by the <clinit> method (in case of a static field)
// or by the <init> method (in case of an instance field).
if (is_put && fd.access_flags().is_final()) {
ResourceMark rm(THREAD);
stringStream ss;
if (is_initialized_static_final_update || is_initialized_instance_final_update) {
ss.print("Update to %s final field %s.%s attempted from a different method (%s) than the initializer method %s ",
if (sel_klass != current_klass) {
ss.print("Update to %s final field %s.%s attempted from a different class (%s) than the field's declaring class",
is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(),
m()->name()->as_C_string(),
is_static ? "<clinit>" : "<init>");
current_klass->external_name());
THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string());
}
if (fd.constants()->pool_holder()->major_version() >= 53) {
methodHandle m = link_info.current_method();
assert(!m.is_null(), "information about the current method must be available for 'put' bytecodes");
bool is_initialized_static_final_update = (byte == Bytecodes::_putstatic &&
fd.is_static() &&
!m()->is_static_initializer());
bool is_initialized_instance_final_update = ((byte == Bytecodes::_putfield || byte == Bytecodes::_nofast_putfield) &&
!fd.is_static() &&
!m->is_object_initializer());
if (is_initialized_static_final_update || is_initialized_instance_final_update) {
ss.print("Update to %s final field %s.%s attempted from a different method (%s) than the initializer method %s ",
is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(),
m()->name()->as_C_string(),
is_static ? "<clinit>" : "<init>");
THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string());
}
}
}
// initialize resolved_klass if necessary
// note 1: the klass which declared the field must be initialized (i.e, sel_klass)
// according to the newest JVM spec (5.5, p.170) - was bug (gri 7/28/99)
//
// note 2: we don't want to force initialization if we are just checking
// if the field access is legal; e.g., during compilation
if (is_static && initialize_class) {
sel_klass->initialize(CHECK);
}
}
// initialize resolved_klass if necessary
// note 1: the klass which declared the field must be initialized (i.e, sel_klass)
// according to the newest JVM spec (5.5, p.170) - was bug (gri 7/28/99)
//
// note 2: we don't want to force initialization if we are just checking
// if the field access is legal; e.g., during compilation
if (is_static && initialize_class) {
sel_klass->initialize(CHECK);
}
if (sel_klass != current_klass) {
if ((sel_klass != current_klass) && (current_klass != NULL)) {
check_field_loader_constraints(field, sig, current_klass, sel_klass, CHECK);
}

View File

@@ -69,10 +69,13 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
*/
int count;
private static final byte[] EMPTYVALUE = new byte[0];
/**
* This no-arg constructor is necessary for serialization of subclasses.
*/
AbstractStringBuilder() {
value = EMPTYVALUE;
}
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2018, 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
@@ -35,6 +35,7 @@ import java.io.FileNotFoundException;
import java.io.ObjectStreamException;
import java.io.ObjectStreamField;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.ObjectInputStream.GetField;
import java.io.ObjectOutputStream;
@@ -1728,8 +1729,11 @@ class InetAddress implements java.io.Serializable {
}
GetField gf = s.readFields();
String host = (String)gf.get("hostName", null);
int address= gf.get("address", 0);
int family= gf.get("family", 0);
int address = gf.get("address", 0);
int family = gf.get("family", 0);
if (family != IPv4 && family != IPv6) {
throw new InvalidObjectException("invalid address family type: " + family);
}
InetAddressHolder h = new InetAddressHolder(host, address, family);
UNSAFE.putObject(this, FIELDS_OFFSET, h);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2018, 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
@@ -321,8 +321,20 @@ public final class NetworkInterface {
if (addr == null) {
throw new NullPointerException();
}
if (!(addr instanceof Inet4Address || addr instanceof Inet6Address)) {
throw new IllegalArgumentException ("invalid address type");
if (addr instanceof Inet4Address) {
Inet4Address inet4Address = (Inet4Address) addr;
if (inet4Address.holder.family != InetAddress.IPv4) {
throw new IllegalArgumentException("invalid family type: "
+ inet4Address.holder.family);
}
} else if (addr instanceof Inet6Address) {
Inet6Address inet6Address = (Inet6Address) addr;
if (inet6Address.holder.family != InetAddress.IPv6) {
throw new IllegalArgumentException("invalid family type: "
+ inet6Address.holder.family);
}
} else {
throw new IllegalArgumentException("invalid address type: " + addr);
}
return getByInetAddress0(addr);
}

View File

@@ -570,13 +570,13 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
* @spec JPMS
*/
protected Package definePackage(String name, Manifest man, URL url) {
String path = name.replace('.', '/').concat("/");
String specTitle = null, specVersion = null, specVendor = null;
String implTitle = null, implVersion = null, implVendor = null;
String sealed = null;
URL sealBase = null;
Attributes attr = man.getAttributes(path);
Attributes attr = SharedSecrets.javaUtilJarAccess()
.getTrustedAttributes(man, name.replace('.', '/').concat("/"));
if (attr != null) {
specTitle = attr.getValue(Name.SPECIFICATION_TITLE);
specVersion = attr.getValue(Name.SPECIFICATION_VERSION);
@@ -620,10 +620,12 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
/*
* Returns true if the specified package name is sealed according to the
* given manifest.
*
* @throws SecurityException if the package name is untrusted in the manifest
*/
private boolean isSealed(String name, Manifest man) {
String path = name.replace('.', '/').concat("/");
Attributes attr = man.getAttributes(path);
Attributes attr = SharedSecrets.javaUtilJarAccess()
.getTrustedAttributes(man, name.replace('.', '/').concat("/"));
String sealed = null;
if (attr != null) {
sealed = attr.getValue(Name.SEALED);

View File

@@ -417,10 +417,10 @@ class JarFile extends ZipFile {
if (manEntry != null) {
if (verify) {
byte[] b = getBytes(manEntry);
man = new Manifest(new ByteArrayInputStream(b));
if (!jvInitialized) {
jv = new JarVerifier(b);
}
man = new Manifest(jv, new ByteArrayInputStream(b));
} else {
man = new Manifest(super.getInputStream(manEntry));
}
@@ -1010,29 +1010,13 @@ class JarFile extends ZipFile {
int i = match(MULTIRELEASE_CHARS, b, MULTIRELEASE_LASTOCC,
MULTIRELEASE_OPTOSFT);
if (i != -1) {
i += MULTIRELEASE_CHARS.length;
if (i < b.length) {
byte c = b[i++];
// Check that the value is followed by a newline
// and does not have a continuation
if (c == '\n' &&
(i == b.length || b[i] != ' ')) {
isMultiRelease = true;
} else if (c == '\r') {
if (i == b.length) {
isMultiRelease = true;
} else {
c = b[i++];
if (c == '\n') {
if (i == b.length || b[i] != ' ') {
isMultiRelease = true;
}
} else if (c != ' ') {
isMultiRelease = true;
}
}
}
}
// Read the main attributes of the manifest
byte[] lbuf = new byte[512];
Attributes attr = new Attributes();
attr.read(new Manifest.FastInputStream(
new ByteArrayInputStream(b)), lbuf);
isMultiRelease = Boolean.parseBoolean(
attr.getValue(Attributes.Name.MULTI_RELEASE));
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, 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
@@ -858,4 +858,24 @@ class JarVerifier {
static CodeSource getUnsignedCS(URL url) {
return new VerifierCodeSource(null, url, (java.security.cert.Certificate[]) null);
}
/**
* Returns whether the name is trusted. Used by
* {@link Manifest#getTrustedAttributes(String)}.
*/
boolean isTrustedManifestEntry(String name) {
// How many signers? MANIFEST.MF is always verified
CodeSigner[] forMan = verifiedSigners.get(JarFile.MANIFEST_NAME);
if (forMan == null) {
return true;
}
// Check sigFileSigners first, because we are mainly dealing with
// non-file entries which will stay in sigFileSigners forever.
CodeSigner[] forName = sigFileSigners.get(name);
if (forName == null) {
forName = verifiedSigners.get(name);
}
// Returns trusted if all signers sign the entry
return forName != null && forName.length == forMan.length;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2018, 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
@@ -60,4 +60,9 @@ class JavaUtilJarAccessImpl implements JavaUtilJarAccess {
public List<Object> getManifestDigests(JarFile jar) {
return jar.getManifestDigests();
}
public Attributes getTrustedAttributes(Manifest man, String name) {
return man.getTrustedAttributes(name);
}
}

View File

@@ -32,7 +32,6 @@ import java.io.OutputStream;
import java.io.IOException;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
/**
* The Manifest class is used to maintain Manifest entry names and their
@@ -48,15 +47,19 @@ import java.util.Iterator;
*/
public class Manifest implements Cloneable {
// manifest main attributes
private Attributes attr = new Attributes();
private final Attributes attr = new Attributes();
// manifest entries
private Map<String, Attributes> entries = new HashMap<>();
private final Map<String, Attributes> entries = new HashMap<>();
// associated JarVerifier, not null when called by JarFile::getManifest.
private final JarVerifier jv;
/**
* Constructs a new, empty Manifest.
*/
public Manifest() {
jv = null;
}
/**
@@ -66,7 +69,16 @@ public class Manifest implements Cloneable {
* @throws IOException if an I/O error has occurred
*/
public Manifest(InputStream is) throws IOException {
this(null, is);
}
/**
* Constructs a new Manifest from the specified input stream
* and associates it with a JarVerifier.
*/
Manifest(JarVerifier jv, InputStream is) throws IOException {
read(is);
this.jv = jv;
}
/**
@@ -77,6 +89,7 @@ public class Manifest implements Cloneable {
public Manifest(Manifest man) {
attr.putAll(man.getMainAttributes());
entries.putAll(man.getEntries());
jv = man.jv;
}
/**
@@ -126,6 +139,23 @@ public class Manifest implements Cloneable {
return getEntries().get(name);
}
/**
* Returns the Attributes for the specified entry name, if trusted.
*
* @param name entry name
* @return returns the same result as {@link #getAttributes(String)}
* @throws SecurityException if the associated jar is signed but this entry
* has been modified after signing (i.e. the section in the manifest
* does not exist in SF files of all signers).
*/
Attributes getTrustedAttributes(String name) {
Attributes result = getAttributes(name);
if (result != null && jv != null && ! jv.isTrustedManifestEntry(name)) {
throw new SecurityException("Untrusted manifest entry: " + name);
}
return result;
}
/**
* Clears the main Attributes as well as the entries in this Manifest.
*/

View File

@@ -2739,7 +2739,7 @@ public class Cipher {
// Input sanity check
if ((src == null) || (offset < 0) || (len < 0)
|| ((len + offset) > src.length)) {
|| (len > (src.length - offset))) {
throw new IllegalArgumentException("Bad arguments");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, 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
@@ -50,6 +50,13 @@ import javax.crypto.IllegalBlockSizeException;
* that are not thrown by its ancestor classes. In particular, the
* <code>skip</code> method skips, and the <code>available</code>
* method counts only data that have been processed by the encapsulated Cipher.
* This class may catch BadPaddingException and other exceptions thrown by
* failed integrity checks during decryption. These exceptions are not
* re-thrown, so the client may not be informed that integrity checks
* failed. Because of this behavior, this class may not be suitable
* for use with decryption in an authenticated mode of operation (e.g. GCM).
* Applications that require authenticated encryption can use the Cipher API
* directly as an alternative to using this class.
*
* <p> It is crucial for a programmer using this class not to use
* methods that are not defined or overriden in this class (such as a

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2018, 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
@@ -120,7 +120,7 @@ public class GCMParameterSpec implements AlgorithmParameterSpec {
// Input sanity check
if ((src == null) ||(len < 0) || (offset < 0)
|| ((len + offset) > src.length)) {
|| (len > (src.length - offset))) {
throw new IllegalArgumentException("Invalid buffer arguments");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, 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
@@ -60,6 +60,7 @@ import java.util.jar.Attributes;
import java.util.jar.Manifest;
import java.util.stream.Stream;
import jdk.internal.misc.SharedSecrets;
import jdk.internal.misc.VM;
import jdk.internal.module.ModulePatcher.PatchedModuleReader;
import jdk.internal.module.Resources;
@@ -862,7 +863,8 @@ public class BuiltinClassLoader
* Manifest are used to get the package version and sealing information.
*
* @throws IllegalArgumentException if the package name duplicates an
* existing package either in this class loader or one of its ancestors
* existing package either in this class loader or one of its ancestors
* @throws SecurityException if the package name is untrusted in the manifest
*/
private Package definePackage(String pn, Manifest man, URL url) {
String specTitle = null;
@@ -875,7 +877,8 @@ public class BuiltinClassLoader
URL sealBase = null;
if (man != null) {
Attributes attr = man.getAttributes(pn.replace('.', '/').concat("/"));
Attributes attr = SharedSecrets.javaUtilJarAccess()
.getTrustedAttributes(man, pn.replace('.', '/').concat("/"));
if (attr != null) {
specTitle = attr.getValue(Attributes.Name.SPECIFICATION_TITLE);
specVersion = attr.getValue(Attributes.Name.SPECIFICATION_VERSION);
@@ -921,10 +924,12 @@ public class BuiltinClassLoader
/**
* Returns {@code true} if the specified package name is sealed according to
* the given manifest.
*
* @throws SecurityException if the package name is untrusted in the manifest
*/
private boolean isSealed(String pn, Manifest man) {
String path = pn.replace('.', '/').concat("/");
Attributes attr = man.getAttributes(path);
Attributes attr = SharedSecrets.javaUtilJarAccess()
.getTrustedAttributes(man, pn.replace('.', '/').concat("/"));
String sealed = null;
if (attr != null)
sealed = attr.getValue(Attributes.Name.SEALED);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, 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
@@ -34,6 +34,7 @@ import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.JarURLConnection;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
@@ -88,6 +89,8 @@ public class URLClassPath {
private static final boolean DEBUG;
private static final boolean DISABLE_JAR_CHECKING;
private static final boolean DISABLE_ACC_CHECKING;
private static final boolean DISABLE_CP_URL_CHECK;
private static final boolean DEBUG_CP_URL_CHECK;
static {
Properties props = GetPropertyAction.privilegedGetProperties();
@@ -98,6 +101,12 @@ public class URLClassPath {
p = props.getProperty("jdk.net.URLClassPath.disableRestrictedPermissions");
DISABLE_ACC_CHECKING = p != null ? p.equals("true") || p.equals("") : false;
// This property will be removed in a later release
p = props.getProperty("jdk.net.URLClassPath.disableClassPathURLCheck");
DISABLE_CP_URL_CHECK = p != null ? p.equals("true") || p.isEmpty() : false;
DEBUG_CP_URL_CHECK = "debug".equals(p);
}
/* The original search path of URLs. */
@@ -1081,11 +1090,51 @@ public class URLClassPath {
int i = 0;
while (st.hasMoreTokens()) {
String path = st.nextToken();
urls[i] = new URL(base, path);
i++;
URL url = DISABLE_CP_URL_CHECK ? new URL(base, path) : safeResolve(base, path);
if (url != null) {
urls[i] = url;
i++;
}
}
if (i == 0) {
urls = null;
} else if (i != urls.length) {
// Truncate nulls from end of array
urls = Arrays.copyOf(urls, i);
}
return urls;
}
/*
* Return a URL for the given path resolved against the base URL, or
* null if the resulting URL is invalid.
*/
static URL safeResolve(URL base, String path) {
String child = path.replace(File.separatorChar, '/');
try {
if (!URI.create(child).isAbsolute()) {
URL url = new URL(base, child);
if (base.getProtocol().equalsIgnoreCase("file")) {
return url;
} else {
String bp = base.getPath();
String urlp = url.getPath();
int pos = bp.lastIndexOf('/');
if (pos == -1) {
pos = bp.length() - 1;
}
if (urlp.regionMatches(0, bp, 0, pos + 1)
&& urlp.indexOf("..", pos) == -1) {
return url;
}
}
}
} catch (MalformedURLException | IllegalArgumentException e) {}
if (DEBUG_CP_URL_CHECK) {
System.err.println("Class-Path entry: \"" + path + "\" ignored in JAR file " + base);
}
return null;
}
}
/*

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2018, 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
@@ -30,8 +30,10 @@ import java.net.URL;
import java.security.CodeSource;
import java.util.Enumeration;
import java.util.List;
import java.util.jar.Attributes;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
public interface JavaUtilJarAccess {
public boolean jarFileHasClassPathAttribute(JarFile jar) throws IOException;
@@ -41,4 +43,5 @@ public interface JavaUtilJarAccess {
public Enumeration<JarEntry> entries2(JarFile jar);
public void setEagerValidation(JarFile jar, boolean eager);
public List<Object> getManifestDigests(JarFile jar);
public Attributes getTrustedAttributes(Manifest man, String name);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2018, 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
@@ -2725,6 +2725,8 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
// doesn't know about proxy.
useProxyResponseCode = true;
} else {
final URL prevURL = url;
// maintain previous headers, just change the name
// of the file we're getting
url = locUrl;
@@ -2753,6 +2755,14 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
poster = null;
if (!checkReuseConnection())
connect();
if (!sameDestination(prevURL, url)) {
// Ensures pre-redirect user-set cookie will not be reset.
// CookieHandler, if any, will be queried to determine
// cookies for redirected URL, if any.
userCookies = null;
userCookies2 = null;
}
} else {
if (!checkReuseConnection())
connect();
@@ -2775,11 +2785,52 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
}
requests.set("Host", host);
}
if (!sameDestination(prevURL, url)) {
// Redirecting to a different destination will drop any
// security-sensitive headers, regardless of whether
// they are user-set or not. CookieHandler, if any, will be
// queried to determine cookies for redirected URL, if any.
userCookies = null;
userCookies2 = null;
requests.remove("Cookie");
requests.remove("Cookie2");
requests.remove("Authorization");
// check for preemptive authorization
AuthenticationInfo sauth =
AuthenticationInfo.getServerAuth(url, getAuthenticatorKey());
if (sauth != null && sauth.supportsPreemptiveAuthorization() ) {
// Sets "Authorization"
requests.setIfNotSet(sauth.getHeaderName(), sauth.getHeaderValue(url,method));
currentServerCredentials = sauth;
}
}
}
}
return true;
}
/* Returns true iff the given URLs have the same host and effective port. */
private static boolean sameDestination(URL firstURL, URL secondURL) {
assert firstURL.getProtocol().equalsIgnoreCase(secondURL.getProtocol()):
"protocols not equal: " + firstURL + " - " + secondURL;
if (!firstURL.getHost().equalsIgnoreCase(secondURL.getHost()))
return false;
int firstPort = firstURL.getPort();
if (firstPort == -1)
firstPort = firstURL.getDefaultPort();
int secondPort = secondURL.getPort();
if (secondPort == -1)
secondPort = secondURL.getDefaultPort();
if (firstPort != secondPort)
return false;
return true;
}
/* dummy byte buffer for reading off socket prior to closing */
byte[] cdata = new byte [128];

View File

@@ -35,6 +35,7 @@ import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLHandshakeException;
import javax.net.ssl.SSLPeerUnverifiedException;
@@ -510,6 +511,23 @@ final class ClientHello {
}
}
// ensure that the endpoint identification algorithm matches the
// one in the session
String identityAlg = chc.sslConfig.identificationProtocol;
if (session != null && identityAlg != null) {
String sessionIdentityAlg =
session.getIdentificationProtocol();
if (!Objects.equals(identityAlg, sessionIdentityAlg)) {
if (SSLLogger.isOn &&
SSLLogger.isOn("ssl,handshake,verbose")) {
SSLLogger.finest("Can't resume, endpoint id" +
" algorithm does not match, requested: " +
identityAlg + ", cached: " + sessionIdentityAlg);
}
session = null;
}
}
if (session != null) {
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake,verbose")) {
SSLLogger.finest("Try resuming session", session);
@@ -1011,6 +1029,23 @@ final class ClientHello {
}
}
// ensure that the endpoint identification algorithm matches the
// one in the session
String identityAlg = shc.sslConfig.identificationProtocol;
if (resumingSession && identityAlg != null) {
String sessionIdentityAlg =
previous.getIdentificationProtocol();
if (!Objects.equals(identityAlg, sessionIdentityAlg)) {
if (SSLLogger.isOn &&
SSLLogger.isOn("ssl,handshake,verbose")) {
SSLLogger.finest("Can't resume, endpoint id" +
" algorithm does not match, requested: " +
identityAlg + ", cached: " + sessionIdentityAlg);
}
resumingSession = false;
}
}
// So far so good. Note that the handshake extensions may reset
// the resuming options later.
shc.isResumption = resumingSession;

View File

@@ -32,6 +32,7 @@ import java.util.List;
import java.util.ArrayList;
import java.util.Locale;
import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;
import java.util.Collection;
import javax.crypto.Mac;
@@ -443,6 +444,23 @@ final class PreSharedKeyExtension {
}
}
// ensure that the endpoint identification algorithm matches the
// one in the session
String identityAlg = shc.sslConfig.identificationProtocol;
if (result && identityAlg != null) {
String sessionIdentityAlg = s.getIdentificationProtocol();
if (!Objects.equals(identityAlg, sessionIdentityAlg)) {
if (SSLLogger.isOn &&
SSLLogger.isOn("ssl,handshake,verbose")) {
SSLLogger.finest("Can't resume, endpoint id" +
" algorithm does not match, requested: " +
identityAlg + ", cached: " + sessionIdentityAlg);
}
result = false;
}
}
// Ensure cipher suite can be negotiated
if (result && (!shc.isNegotiable(s.getSuite()) ||
!clientHello.cipherSuites.contains(s.getSuite()))) {

View File

@@ -132,6 +132,10 @@ final class SSLSessionImpl extends ExtendedSSLSession {
// Counter used to create unique nonces in NewSessionTicket
private BigInteger ticketNonceCounter = BigInteger.ONE;
// The endpoint identification algorithm used to check certificates
// in this session.
private final String identificationProtocol;
/*
* Create a new non-rejoinable session, using the default (null)
* cipher spec. This constructor returns a session which could
@@ -149,6 +153,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
this.requestedServerNames = Collections.<SNIServerName>emptyList();
this.useExtendedMasterSecret = false;
this.creationTime = System.currentTimeMillis();
this.identificationProtocol = null;
}
/*
@@ -198,6 +203,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
(!hc.negotiatedProtocol.useTLS13PlusSpec());
}
this.creationTime = creationTime;
this.identificationProtocol = hc.sslConfig.identificationProtocol;
if (SSLLogger.isOn && SSLLogger.isOn("session")) {
SSLLogger.finest("Session initialized: " + this);
@@ -259,6 +265,10 @@ final class SSLSessionImpl extends ExtendedSSLSession {
return ticketAgeAdd;
}
String getIdentificationProtocol() {
return this.identificationProtocol;
}
/*
* Get the PSK identity. Take care not to use it in multiple connections.
*/

View File

@@ -331,9 +331,16 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0
netif *ifs, *curr;
jobject obj = NULL;
jboolean match = JNI_FALSE;
int family = (getInetAddress_family(env, iaObj) == java_net_InetAddress_IPv4) ?
AF_INET : AF_INET6;
int family = getInetAddress_family(env, iaObj);
JNU_CHECK_EXCEPTION_RETURN(env, NULL);
if (family == java_net_InetAddress_IPv4) {
family = AF_INET;
} else if (family == java_net_InetAddress_IPv6) {
family = AF_INET6;
} else {
return NULL; // Invalid family
}
ifs = enumInterfaces(env);
if (ifs == NULL) {
return NULL;
@@ -351,7 +358,9 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0
int address1 = htonl(
((struct sockaddr_in *)addrP->addr)->sin_addr.s_addr);
int address2 = getInetAddress_addr(env, iaObj);
JNU_CHECK_EXCEPTION_RETURN(env, NULL);
if ((*env)->ExceptionCheck(env)) {
goto cleanup;
}
if (address1 == address2) {
match = JNI_TRUE;
break;
@@ -397,6 +406,7 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0
obj = createNetworkInterface(env, curr);
}
cleanup:
// release the interface list
freeif(ifs);

View File

@@ -280,6 +280,7 @@ int enumInterfaces(JNIEnv *env, netif **netifPP)
if (curr->name == NULL || curr->displayName == NULL) {
if (curr->name) free(curr->name);
if (curr->displayName) free(curr->displayName);
free(curr);
curr = NULL;
}
}
@@ -586,7 +587,10 @@ jobject createNetworkInterface
/* default ctor will set family to AF_INET */
setInetAddress_addr(env, iaObj, ntohl(addrs->addr.sa4.sin_addr.s_addr));
JNU_CHECK_EXCEPTION_RETURN(env, NULL);
if ((*env)->ExceptionCheck(env)) {
free_netaddr(netaddrP);
return NULL;
}
if (addrs->mask != -1) {
ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
if (ibObj == NULL) {
@@ -600,7 +604,10 @@ jobject createNetworkInterface
return NULL;
}
setInetAddress_addr(env, ia2Obj, ntohl(addrs->brdcast.sa4.sin_addr.s_addr));
JNU_CHECK_EXCEPTION_RETURN(env, NULL);
if ((*env)->ExceptionCheck(env)) {
free_netaddr(netaddrP);
return NULL;
}
(*env)->SetObjectField(env, ibObj, ni_ibbroadcastID, ia2Obj);
(*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask);
(*env)->SetObjectArrayElement(env, bindsArr, bind_index++, ibObj);
@@ -611,6 +618,7 @@ jobject createNetworkInterface
if (iaObj) {
jboolean ret = setInet6Address_ipaddress(env, iaObj, (jbyte *)&(addrs->addr.sa6.sin6_addr.s6_addr));
if (ret == JNI_FALSE) {
free_netaddr(netaddrP);
return NULL;
}

View File

@@ -521,8 +521,9 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs)
jobjectArray addrArr, bindsArr, childArr;
netaddr *addrs;
jint addr_index;
int netaddrCount=ifs->naddrs;
netaddr *netaddrP=ifs->addrs;
int netaddrCount = ifs->naddrs;
netaddr *netaddrP = ifs->addrs;
netaddr *netaddrPToFree = NULL;
jint bind_index;
/*
@@ -553,21 +554,23 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs)
* Note that 0 is a valid number of addresses.
*/
if (netaddrCount < 0) {
netaddrCount = enumAddresses_win(env, ifs, &netaddrP);
netaddrCount = enumAddresses_win(env, ifs, &netaddrPToFree);
if (netaddrCount == -1) {
return NULL;
}
netaddrP = netaddrPToFree;
}
addrArr = (*env)->NewObjectArray(env, netaddrCount, ia_class, NULL);
if (addrArr == NULL) {
free_netaddr(netaddrPToFree);
return NULL;
}
bindsArr = (*env)->NewObjectArray(env, netaddrCount, ni_ibcls, NULL);
if (bindsArr == NULL) {
free_netaddr(netaddrP);
return NULL;
free_netaddr(netaddrPToFree);
return NULL;
}
addrs = netaddrP;
@@ -579,25 +582,32 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs)
if (addrs->addr.sa.sa_family == AF_INET) {
iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
if (iaObj == NULL) {
free_netaddr(netaddrPToFree);
return NULL;
}
/* default ctor will set family to AF_INET */
setInetAddress_addr(env, iaObj, ntohl(addrs->addr.sa4.sin_addr.s_addr));
JNU_CHECK_EXCEPTION_RETURN(env, NULL);
if ((*env)->ExceptionCheck(env)) {
free_netaddr(netaddrPToFree);
return NULL;
}
ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
if (ibObj == NULL) {
free_netaddr(netaddrP);
return NULL;
free_netaddr(netaddrPToFree);
return NULL;
}
(*env)->SetObjectField(env, ibObj, ni_ibaddressID, iaObj);
ia2Obj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
if (ia2Obj == NULL) {
free_netaddr(netaddrP);
return NULL;
free_netaddr(netaddrPToFree);
return NULL;
}
setInetAddress_addr(env, ia2Obj, ntohl(addrs->brdcast.sa4.sin_addr.s_addr));
JNU_CHECK_EXCEPTION_RETURN(env, NULL);
if ((*env)->ExceptionCheck(env)) {
free_netaddr(netaddrPToFree);
return NULL;
}
(*env)->SetObjectField(env, ibObj, ni_ibbroadcastID, ia2Obj);
(*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask);
(*env)->SetObjectArrayElement(env, bindsArr, bind_index++, ibObj);
@@ -606,10 +616,12 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs)
jboolean ret;
iaObj = (*env)->NewObject(env, ia6_class, ia6_ctrID);
if (iaObj == NULL) {
free_netaddr(netaddrPToFree);
return NULL;
}
ret = setInet6Address_ipaddress(env, iaObj, (jbyte *)&(addrs->addr.sa6.sin6_addr.s6_addr));
if (ret == JNI_FALSE) {
free_netaddr(netaddrPToFree);
return NULL;
}
scope = addrs->addr.sa6.sin6_scope_id;
@@ -619,8 +631,8 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs)
}
ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
if (ibObj == NULL) {
free_netaddr(netaddrP);
return NULL;
free_netaddr(netaddrPToFree);
return NULL;
}
(*env)->SetObjectField(env, ibObj, ni_ibaddressID, iaObj);
(*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask);
@@ -633,6 +645,8 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs)
(*env)->SetObjectField(env, netifObj, ni_addrsID, addrArr);
(*env)->SetObjectField(env, netifObj, ni_bindsID, bindsArr);
free_netaddr(netaddrPToFree);
/*
* Windows doesn't have virtual interfaces, so child array
* is always empty.
@@ -672,7 +686,7 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0_XP
}
/* if found create a NetworkInterface */
if (curr != NULL) {;
if (curr != NULL) {
netifObj = createNetworkInterfaceXP(env, curr);
}
@@ -799,6 +813,7 @@ JNIEXPORT jobjectArray JNICALL Java_java_net_NetworkInterface_getAll_XP
/* allocate a NetworkInterface array */
netIFArr = (*env)->NewObjectArray(env, count, cls, NULL);
if (netIFArr == NULL) {
free_netif(ifList);
return NULL;
}
@@ -813,6 +828,7 @@ JNIEXPORT jobjectArray JNICALL Java_java_net_NetworkInterface_getAll_XP
netifObj = createNetworkInterfaceXP(env, curr);
if (netifObj == NULL) {
free_netif(ifList);
return NULL;
}

View File

@@ -736,7 +736,7 @@ final class Win32ShellFolder2 extends ShellFolder {
}
try {
return invoke(new Callable<File[]>() {
File[] files = invoke(new Callable<File[]>() {
public File[] call() throws InterruptedException {
if (!isDirectory()) {
return null;
@@ -791,6 +791,8 @@ final class Win32ShellFolder2 extends ShellFolder {
: list.toArray(new ShellFolder[list.size()]);
}
}, InterruptedException.class);
return Win32ShellFolderManager2.checkFiles(files);
} catch (InterruptedException e) {
return new File[0];
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
@@ -387,21 +387,30 @@ final class Win32ShellFolderManager2 extends ShellFolderManager {
return null;
}
private File checkFile(File file) {
private static File checkFile(File file) {
SecurityManager sm = System.getSecurityManager();
return (sm == null || file == null) ? file : checkFile(file, sm);
}
private File checkFile(File file, SecurityManager sm) {
private static File checkFile(File file, SecurityManager sm) {
try {
sm.checkRead(file.getPath());
if (file instanceof Win32ShellFolder2) {
Win32ShellFolder2 f = (Win32ShellFolder2)file;
if (f.isLink()) {
Win32ShellFolder2 link = (Win32ShellFolder2)f.getLinkLocation();
if (link != null)
sm.checkRead(link.getPath());
}
}
return file;
} catch (SecurityException se) {
return null;
}
}
private File[] checkFiles(File[] files) {
static File[] checkFiles(File[] files) {
SecurityManager sm = System.getSecurityManager();
if (sm == null || files == null || files.length == 0) {
return files;
@@ -409,7 +418,7 @@ final class Win32ShellFolderManager2 extends ShellFolderManager {
return checkFiles(Arrays.stream(files), sm);
}
private File[] checkFiles(List<File> files) {
private static File[] checkFiles(List<File> files) {
SecurityManager sm = System.getSecurityManager();
if (sm == null || files.isEmpty()) {
return files.toArray(new File[files.size()]);
@@ -417,7 +426,7 @@ final class Win32ShellFolderManager2 extends ShellFolderManager {
return checkFiles(files.stream(), sm);
}
private File[] checkFiles(Stream<File> filesStream, SecurityManager sm) {
private static File[] checkFiles(Stream<File> filesStream, SecurityManager sm) {
return filesStream.filter((file) -> checkFile(file, sm) != null)
.toArray(File[]::new);
}

View File

@@ -252,7 +252,7 @@ INT32 MIDI_IN_GetNumDevices() {
}
INT32 getMidiInCaps(INT32 deviceID, MIDIINCAPSW* caps, INT32* err) {
(*err) = midiInGetDevCapsW(deviceID, caps, sizeof(MIDIINCAPS));
(*err) = midiInGetDevCapsW(deviceID, caps, sizeof(MIDIINCAPSW));
return ((*err) == MMSYSERR_NOERROR);
}
@@ -260,6 +260,7 @@ INT32 MIDI_IN_GetDeviceName(INT32 deviceID, char *name, UINT32 nameLength) {
MIDIINCAPSW midiInCaps;
INT32 err;
memset(&midiInCaps, 0, sizeof(midiInCaps));
if (getMidiInCaps(deviceID, &midiInCaps, &err)) {
UnicodeToUTF8AndCopy(name, midiInCaps.szPname, nameLength);
return MIDI_SUCCESS;
@@ -284,6 +285,7 @@ INT32 MIDI_IN_GetDeviceVersion(INT32 deviceID, char *name, UINT32 nameLength) {
MIDIINCAPSW midiInCaps;
INT32 err = MIDI_NOT_SUPPORTED;
memset(&midiInCaps, 0, sizeof(midiInCaps));
if (getMidiInCaps(deviceID, &midiInCaps, &err) && (nameLength>7)) {
sprintf(name, "%d.%d", (midiInCaps.vDriverVersion & 0xFF00) >> 8, midiInCaps.vDriverVersion & 0xFF);
return MIDI_SUCCESS;

View File

@@ -70,12 +70,13 @@ INT32 MIDI_OUT_GetNumDevices() {
INT32 getMidiOutCaps(INT32 deviceID, MIDIOUTCAPSW* caps, INT32* err) {
UINT_PTR id;
if (deviceID == 0) {
deviceID = MIDI_MAPPER;
id = MIDI_MAPPER;
} else {
deviceID--;
id = (UINT_PTR)(deviceID-1);
}
(*err) = (INT32) midiOutGetDevCapsW(deviceID, caps, sizeof(MIDIOUTCAPS));
(*err) = (INT32) midiOutGetDevCapsW(id, caps, sizeof(MIDIOUTCAPSW));
return ((*err) == MMSYSERR_NOERROR);
}
@@ -84,6 +85,7 @@ INT32 MIDI_OUT_GetDeviceName(INT32 deviceID, char *name, UINT32 nameLength) {
MIDIOUTCAPSW midiOutCaps;
INT32 err;
memset(&midiOutCaps, 0, sizeof(midiOutCaps));
if (getMidiOutCaps(deviceID, &midiOutCaps, &err)) {
UnicodeToUTF8AndCopy(name, midiOutCaps.szPname, nameLength);
return MIDI_SUCCESS;
@@ -103,6 +105,7 @@ INT32 MIDI_OUT_GetDeviceDescription(INT32 deviceID, char *name, UINT32 nameLengt
char *desc;
INT32 err;
memset(&midiOutCaps, 0, sizeof(midiOutCaps));
if (getMidiOutCaps(deviceID, &midiOutCaps, &err)) {
int tech = (int)midiOutCaps.wTechnology;
switch(tech) {
@@ -139,6 +142,7 @@ INT32 MIDI_OUT_GetDeviceVersion(INT32 deviceID, char *name, UINT32 nameLength) {
MIDIOUTCAPSW midiOutCaps;
INT32 err;
memset(&midiOutCaps, 0, sizeof(midiOutCaps));
if (getMidiOutCaps(deviceID, &midiOutCaps, &err) && nameLength>7) {
sprintf(name, "%d.%d", (midiOutCaps.vDriverVersion & 0xFF00) >> 8, midiOutCaps.vDriverVersion & 0xFF);
return MIDI_SUCCESS;

View File

@@ -357,7 +357,7 @@ int lineHasControls(HMIXER handle, MIXERLINE* line, MIXERLINECONTROLS* controls)
INT32 PORT_GetPortMixerDescription(INT32 mixerIndex, PortMixerDescription* description) {
MIXERCAPSW mixerCaps;
if (mixerGetDevCapsW(mixerIndex, &mixerCaps, sizeof(MIXERCAPS)) == MMSYSERR_NOERROR) {
if (mixerGetDevCapsW(mixerIndex, &mixerCaps, sizeof(MIXERCAPSW)) == MMSYSERR_NOERROR) {
UnicodeToUTF8AndCopy(description->name, mixerCaps.szPname, PORT_STRING_LENGTH);
sprintf(description->version, "%d.%d", (mixerCaps.vDriverVersion & 0xFF00) >> 8, mixerCaps.vDriverVersion & 0xFF);
strncpy(description->description, "Port Mixer", PORT_STRING_LENGTH-1);
@@ -368,9 +368,9 @@ INT32 PORT_GetPortMixerDescription(INT32 mixerIndex, PortMixerDescription* descr
int getDestinationCount(HMIXER handle) {
int ret = 0;
MIXERCAPS mixerCaps;
MIXERCAPSW mixerCaps;
if (mixerGetDevCaps((UINT_PTR) handle, &mixerCaps, sizeof(MIXERCAPS)) == MMSYSERR_NOERROR) {
if (mixerGetDevCapsW((UINT_PTR) handle, &mixerCaps, sizeof(MIXERCAPSW)) == MMSYSERR_NOERROR) {
ret = mixerCaps.cDestinations;
}
return ret;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2018, 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
@@ -53,6 +53,20 @@ import java.util.*;
public final class VersionHelper {
private static final VersionHelper helper = new VersionHelper();
/**
* Determines whether classes may be loaded from an arbitrary URL code base.
*/
private static final boolean TRUST_URL_CODE_BASE;
static {
// System property to control whether classes may be loaded from an
// arbitrary URL code base
PrivilegedAction<String> act
= () -> System.getProperty("com.sun.jndi.ldap.object.trustURLCodebase", "false");
String trust = AccessController.doPrivileged(act);
TRUST_URL_CODE_BASE = "true".equalsIgnoreCase(trust);
}
final static String[] PROPS = new String[]{
javax.naming.Context.INITIAL_CONTEXT_FACTORY,
javax.naming.Context.OBJECT_FACTORIES,
@@ -88,12 +102,14 @@ public final class VersionHelper {
*/
public Class<?> loadClass(String className, String codebase)
throws ClassNotFoundException, MalformedURLException {
ClassLoader parent = getContextClassLoader();
ClassLoader cl =
URLClassLoader.newInstance(getUrlArray(codebase), parent);
return loadClass(className, cl);
if (TRUST_URL_CODE_BASE) {
ClassLoader parent = getContextClassLoader();
ClassLoader cl
= URLClassLoader.newInstance(getUrlArray(codebase), parent);
return loadClass(className, cl);
} else {
return null;
}
}
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2018, 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
@@ -190,6 +190,7 @@ import jdk.xml.internal.SecuritySupport;
* @author Sunitha Reddy
* @see javax.xml.datatype.Duration
* @since 1.5
* @LastModified: June 2018
*/
public class XMLGregorianCalendarImpl
@@ -2755,7 +2756,7 @@ public class XMLGregorianCalendarImpl
if ((fractional.compareTo(DECIMAL_ZERO) < 0) ||
(fractional.compareTo(DECIMAL_ONE) > 0)) {
throw new IllegalArgumentException(DatatypeMessageFormatter.formatMessage(null,
"InvalidFractional", new Object[]{fractional}));
"InvalidFractional", new Object[]{fractional.toString()}));
}
}
this.fractionalSecond = fractional;

View File

@@ -311,6 +311,9 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_mscapi_PRNG_generateSeed
}
result = env->NewByteArray(length);
if (result == NULL) {
__leave;
}
env->SetByteArrayRegion(result, 0, length, (jbyte*) pbData);
} else { // length == 0

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2018, 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
@@ -1601,13 +1601,14 @@ public final class Global extends Scope {
}
}
switch (nameStr) {
case "context":
if ("context".equals(nameStr)) {
return sctxt;
case "engine":
return global.engine;
default:
break;
} else if ("engine".equals(nameStr)) {
// expose "engine" variable only when there is no security manager
// or when no class filter is set.
if (System.getSecurityManager() == null || global.getClassFilter() == null) {
return global.engine;
}
}
if (self == UNDEFINED) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, 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,7 +23,7 @@
/*
* @test
* @bug 8132734 8144062 8165723
* @bug 8132734 8144062 8165723 8199172
* @summary Test the extended API and the aliasing additions in JarFile that
* support multi-release jar files
* @library /lib/testlibrary/java/util/jar /test/lib
@@ -100,16 +100,30 @@ public class MultiReleaseJarAPI {
testCustomMultiReleaseValue("true", true);
testCustomMultiReleaseValue("true\r\nOther: value", true);
testCustomMultiReleaseValue("true\nOther: value", true);
testCustomMultiReleaseValue("true\rOther: value", true);
// JDK-8200530: '\r' support in Manifest/Attributes will be addressed separately
// testCustomMultiReleaseValue("true\rOther: value", true);
testCustomMultiReleaseValue("false", false);
testCustomMultiReleaseValue(" true", false);
testCustomMultiReleaseValue("true ", false);
testCustomMultiReleaseValue("true\n ", false);
testCustomMultiReleaseValue("true\r ", false);
testCustomMultiReleaseValue("true\n true", false);
// JDK-8200530: '\r' support in Manifest/Attributes will be addressed separately
testCustomMultiReleaseValue("true\r true", false);
testCustomMultiReleaseValue("true\r\n true", false);
// "Multi-Release: true/false" not in main attributes
testCustomMultiReleaseValue("\r\n\r\nName: test\r\nMulti-Release: true\r\n",
false);
testCustomMultiReleaseValue("\n\nName: entryname\nMulti-Release: true\n",
false);
testCustomMultiReleaseValue("EndOfMainAttr: whatever\r\n" +
"\r\nName: entryname\r\nMulti-Release: true\r\n",
false);
testCustomMultiReleaseValue("EndOfMainAttr: whatever\r\n" +
"\nName: entryname\nMulti-Release: true\n",
false);
// generate "random" Strings to use as extra attributes, and
// verify that Multi-Release: true is always properly matched
for (int i = 0; i < 100; i++) {

View File

@@ -142,6 +142,12 @@ public class CreateMultiReleaseTestJars {
}
public void buildSignedMultiReleaseJar() throws Exception {
buildSignedMultiReleaseJar("multi-release.jar", "signed-multi-release.jar");
}
public void buildSignedMultiReleaseJar(String multiReleaseJar,
String signedMultiReleaseJar) throws Exception
{
String testsrc = System.getProperty("test.src",".");
String testdir = findTestDir(testsrc);
String keystore = testdir + "/sun/security/tools/jarsigner/JarSigning.keystore";
@@ -155,8 +161,8 @@ public class CreateMultiReleaseTestJars {
CertPath cp = CertificateFactory.getInstance("X.509")
.generateCertPath(Arrays.asList(ks.getCertificateChain("b")));
JarSigner js = new JarSigner.Builder(pkb, cp).build();
try (ZipFile in = new ZipFile("multi-release.jar");
FileOutputStream os = new FileOutputStream("signed-multi-release.jar"))
try (ZipFile in = new ZipFile(multiReleaseJar);
FileOutputStream os = new FileOutputStream(signedMultiReleaseJar))
{
js.sign(in, os);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, 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,6 +23,7 @@
package jdk.test.lib.util;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
@@ -126,6 +127,11 @@ public final class JarUtils {
changes = new HashMap<>(changes);
System.out.printf("Creating %s from %s...\n", dest, src);
if (dest.equals(src)) {
throw new IOException("src and dest cannot be the same");
}
try (JarOutputStream jos = new JarOutputStream(
new FileOutputStream(dest))) {
@@ -153,6 +159,22 @@ public final class JarUtils {
System.out.println();
}
/**
* Update the Manifest inside a jar.
*
* @param src the original jar file name
* @param dest the new jar file name
* @param man the Manifest
*
* @throws IOException
*/
public static void updateManifest(String src, String dest, Manifest man)
throws IOException {
ByteArrayOutputStream bout = new ByteArrayOutputStream();
man.write(bout);
updateJar(src, dest, Map.of(JarFile.MANIFEST_NAME, bout.toByteArray()));
}
private static void updateEntry(JarOutputStream jos, String name, Object content)
throws IOException {
if (content instanceof Boolean) {