Skip to content

Commit 4d4e195

Browse files
committed
Merge master jdk-17.0.14+6 into openj9-staging
Signed-off-by: J9 Build <[email protected]>
2 parents 60f6ee9 + 1124eeb commit 4d4e195

File tree

22 files changed

+865
-33
lines changed

22 files changed

+865
-33
lines changed

make/jdk/src/classes/build/tools/tzdb/TzdbZoneRulesCompiler.java

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -273,16 +273,16 @@ private void outputFile(Path dstFile, String version,
273273
// link version-region-rules
274274
out.writeShort(builtZones.size());
275275
for (Map.Entry<String, ZoneRules> entry : builtZones.entrySet()) {
276-
int regionIndex = Arrays.binarySearch(regionArray, entry.getKey());
276+
int regionIndex = findRegionIndex(regionArray, entry.getKey());
277277
int rulesIndex = rulesList.indexOf(entry.getValue());
278278
out.writeShort(regionIndex);
279279
out.writeShort(rulesIndex);
280280
}
281281
// alias-region
282282
out.writeShort(links.size());
283283
for (Map.Entry<String, String> entry : links.entrySet()) {
284-
int aliasIndex = Arrays.binarySearch(regionArray, entry.getKey());
285-
int regionIndex = Arrays.binarySearch(regionArray, entry.getValue());
284+
int aliasIndex = findRegionIndex(regionArray, entry.getKey());
285+
int regionIndex = findRegionIndex(regionArray, entry.getValue());
286286
out.writeShort(aliasIndex);
287287
out.writeShort(regionIndex);
288288
}
@@ -294,6 +294,14 @@ private void outputFile(Path dstFile, String version,
294294
}
295295
}
296296

297+
private static int findRegionIndex(String[] regionArray, String region) {
298+
int index = Arrays.binarySearch(regionArray, region);
299+
if (index < 0) {
300+
throw new IllegalArgumentException("Unknown region: " + region);
301+
}
302+
return index;
303+
}
304+
297305
/** Whether to output verbose messages. */
298306
private boolean verbose;
299307

src/jdk.jartool/share/classes/sun/tools/jar/GNUStyleOptions.java

+8
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,13 @@ void process(Main jartool, String opt, String arg) throws BadArgs {
212212
}
213213
},
214214

215+
// Extract options
216+
new Option(false, OptionType.EXTRACT, "--keep-old-files", "-k") {
217+
void process(Main jartool, String opt, String arg) {
218+
jartool.kflag = true;
219+
}
220+
},
221+
215222
// Hidden options
216223
new Option(false, OptionType.OTHER, "-P") {
217224
void process(Main jartool, String opt, String arg) {
@@ -254,6 +261,7 @@ enum OptionType {
254261
CREATE("create"),
255262
CREATE_UPDATE("create.update"),
256263
CREATE_UPDATE_INDEX("create.update.index"),
264+
EXTRACT("extract"),
257265
OTHER("other");
258266

259267
/** Resource lookup section prefix. */

src/jdk.jartool/share/classes/sun/tools/jar/Main.java

+14-1
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,9 @@ public int hashCode() {
155155
* nflag: Perform jar normalization at the end
156156
* pflag: preserve/don't strip leading slash and .. component from file name
157157
* dflag: print module descriptor
158+
* kflag: keep existing file
158159
*/
159-
boolean cflag, uflag, xflag, tflag, vflag, flag0, Mflag, iflag, pflag, dflag, validate;
160+
boolean cflag, uflag, xflag, tflag, vflag, flag0, Mflag, iflag, pflag, dflag, kflag, validate;
160161

161162
boolean suppressDeprecateMsg = false;
162163

@@ -581,6 +582,9 @@ boolean parseArgs(String args[]) {
581582
case '0':
582583
flag0 = true;
583584
break;
585+
case 'k':
586+
kflag = true;
587+
break;
584588
case 'i':
585589
if (cflag || uflag || xflag || tflag) {
586590
usageError(getMsg("error.multiple.main.operations"));
@@ -611,6 +615,9 @@ boolean parseArgs(String args[]) {
611615
usageError(getMsg("error.bad.option"));
612616
return false;
613617
}
618+
if (kflag && !xflag) {
619+
warn(formatMsg("warn.option.is.ignored", "--keep-old-files/-k/k"));
620+
}
614621

615622
/* parse file arguments */
616623
int n = args.length - count;
@@ -1451,6 +1458,12 @@ ZipEntry extractFile(InputStream is, ZipEntry e) throws IOException {
14511458
output(formatMsg("out.create", name));
14521459
}
14531460
} else {
1461+
if (f.exists() && kflag) {
1462+
if (vflag) {
1463+
output(formatMsg("out.kept", name));
1464+
}
1465+
return rc;
1466+
}
14541467
if (f.getParent() != null) {
14551468
File d = new File(f.getParent());
14561469
if (!d.exists() && !d.mkdirs() || !d.isDirectory()) {

src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties

+17-1
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ warn.release.unexpected.versioned.entry=\
137137
unexpected versioned entry {0}
138138
warn.flag.is.deprecated=\
139139
Warning: The {0} option is deprecated, and is planned for removal in a future JDK release\n
140+
warn.option.is.ignored=\
141+
Warning: The {0} option is not valid with current usage, will be ignored.
140142
out.added.manifest=\
141143
added manifest
142144
out.added.module-info=\
@@ -159,6 +161,8 @@ out.create=\
159161
\ \ created: {0}
160162
out.extracted=\
161163
extracted: {0}
164+
out.kept=\
165+
\ \ skipped: {0} exists
162166
out.inflated=\
163167
\ inflated: {0}
164168
out.size=\
@@ -236,7 +240,10 @@ main.help.opt.main.list=\
236240
main.help.opt.main.update=\
237241
\ -u, --update Update an existing jar archive
238242
main.help.opt.main.extract=\
239-
\ -x, --extract Extract named (or all) files from the archive
243+
\ -x, --extract Extract named (or all) files from the archive.\n\
244+
\ If a file with the same name appears more than once in\n\
245+
\ the archive, each copy will be extracted, with later copies\n\
246+
\ overwriting (replacing) earlier copies unless -k is specified.
240247
main.help.opt.main.describe-module=\
241248
\ -d, --describe-module Print the module descriptor, or automatic module name
242249
main.help.opt.main.validate=\
@@ -298,6 +305,15 @@ main.help.opt.create.update.index.date=\
298305
\ --date=TIMESTAMP The timestamp in ISO-8601 extended offset date-time with\n\
299306
\ optional time-zone format, to use for the timestamps of\n\
300307
\ entries, e.g. "2022-02-12T12:30:00-05:00"
308+
main.help.opt.extract=\
309+
\ Operation modifiers valid only in extract mode:\n
310+
main.help.opt.extract.keep-old-files=\
311+
\ -k, --keep-old-files Do not overwrite existing files.\n\
312+
\ If a Jar file entry with the same name exists in the target\n\
313+
\ directory, the existing file will not be overwritten.\n\
314+
\ As a result, if a file appears more than once in an\n\
315+
\ archive, later copies will not overwrite earlier copies.\n\
316+
\ Also note that some file system can be case insensitive.
301317
main.help.opt.other=\
302318
\ Other options:\n
303319
main.help.opt.other.help=\

src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -1696,6 +1696,9 @@ private String genSystemModulesMapClass(String allSystemModulesClassName,
16961696
ResourcePoolBuilder out) {
16971697
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS
16981698
+ ClassWriter.COMPUTE_FRAMES);
1699+
// sort the map of module name to the class name of the generated SystemModules class
1700+
List<Map.Entry<String, String>> systemModulesMap = map.entrySet()
1701+
.stream().sorted(Map.Entry.comparingByKey()).toList();
16991702
cw.visit(Opcodes.V1_8,
17001703
ACC_FINAL+ACC_SUPER,
17011704
SYSTEM_MODULES_MAP_CLASS,
@@ -1762,10 +1765,10 @@ private String genSystemModulesMapClass(String allSystemModulesClassName,
17621765
mv.visitTypeInsn(ANEWARRAY, "java/lang/String");
17631766

17641767
int index = 0;
1765-
for (String moduleName : sorted(map.keySet())) {
1768+
for (Map.Entry<String,String> entry : systemModulesMap) {
17661769
mv.visitInsn(DUP); // arrayref
17671770
pushInt(mv, index);
1768-
mv.visitLdcInsn(moduleName);
1771+
mv.visitLdcInsn(entry.getKey());
17691772
mv.visitInsn(AASTORE);
17701773
index++;
17711774
}
@@ -1785,10 +1788,10 @@ private String genSystemModulesMapClass(String allSystemModulesClassName,
17851788
mv.visitTypeInsn(ANEWARRAY, "java/lang/String");
17861789

17871790
index = 0;
1788-
for (String className : sorted(map.values())) {
1791+
for (Map.Entry<String,String> entry : systemModulesMap) {
17891792
mv.visitInsn(DUP); // arrayref
17901793
pushInt(mv, index);
1791-
mv.visitLdcInsn(className.replace('/', '.'));
1794+
mv.visitLdcInsn(entry.getValue().replace('/', '.'));
17921795
mv.visitInsn(AASTORE);
17931796
index++;
17941797
}

test/jdk/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -91,7 +91,7 @@ ${COMPILEJAVA}${FILESEP}bin${FILESEP}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
9191
${TESTSRC}${FILESEP}provider${FILESEP}HashProvider.java
9292

9393
# run the test
94-
${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \
94+
${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} ${TESTJAVAOPTS} \
9595
-classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}Deadlock.jar" \
9696
-Djava.awt.headless=true \
9797
ClassLoaderDeadlock

test/jdk/java/security/Security/ClassLoaderDeadlock/Deadlock.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
#
4-
# Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
4+
# Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
55
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
66
#
77
# This code is free software; you can redistribute it and/or modify it
@@ -62,5 +62,5 @@ esac
6262

6363
JAVA="${TESTJAVA}${FILESEP}bin${FILESEP}java"
6464

65-
${JAVA} ${TESTVMOPTS} -cp "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}Deadlock.jar" Deadlock
65+
${JAVA} ${TESTVMOPTS} ${TESTJAVAOPTS} -cp "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}Deadlock.jar" Deadlock
6666

test/jdk/java/security/cert/CertificateFactory/slowstream.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -50,5 +50,5 @@ esac
5050

5151
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . \
5252
${TESTSRC}${FS}SlowStream.java
53-
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Dtest.src=${TESTSRC} SlowStreamWriter | \
54-
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} SlowStreamReader
53+
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${TESTJAVAOPTS} -Dtest.src=${TESTSRC} SlowStreamWriter | \
54+
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${TESTJAVAOPTS} SlowStreamReader

test/jdk/sun/security/krb5/runNameEquals.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -94,7 +94,7 @@ EXIT_STATUS=0
9494

9595
if [ "${NATIVE}" = "true" ] ; then
9696
echo "Testing native provider"
97-
${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \
97+
${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} ${TESTJAVAOPTS} \
9898
-classpath ${TESTCLASSES} \
9999
-Dsun.security.jgss.native=true \
100100
${TEST}
@@ -114,7 +114,7 @@ if [ "${NATIVE}" = "true" ] ; then
114114
fi
115115

116116
echo "Testing java provider"
117-
${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \
117+
${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} ${TESTJAVAOPTS} \
118118
-classpath ${TESTCLASSES} \
119119
-Djava.security.krb5.realm=R \
120120
-Djava.security.krb5.kdc=127.0.0.1 \

test/jdk/sun/security/pkcs11/Provider/MultipleLogins.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
122122
${TESTSRC}${FS}MultipleLogins.java \
123123
${TESTSRC}${FS}..${FS}PKCS11Test.java
124124

125-
TEST_ARGS="${TESTVMOPTS} -classpath ${TESTCLASSPATH} \
125+
TEST_ARGS="${TESTVMOPTS} ${TESTJAVAOPTS} -classpath ${TESTCLASSPATH} \
126126
--add-modules jdk.crypto.cryptoki \
127127
--add-exports jdk.crypto.cryptoki/sun.security.pkcs11=ALL-UNNAMED \
128128
-DCUSTOM_DB_DIR=${TESTCLASSES} \

test/jdk/sun/security/provider/PolicyFile/getinstance/getinstance.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#! /bin/sh
22

33
#
4-
# Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
4+
# Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
55
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
66
#
77
# This code is free software; you can redistribute it and/or modify it
@@ -96,7 +96,7 @@ ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLA
9696
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}app \
9797
${TESTSRC}${FS}GetInstance.java
9898

99-
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
99+
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${TESTJAVAOPTS} \
100100
-Xbootclasspath/a:"${TESTCLASSES}${FS}boot" \
101101
-classpath "${TESTCLASSES}${FS}app" -Djava.security.manager \
102102
-Djava.security.policy=GetInstance.policy \
@@ -110,7 +110,7 @@ if [ $status1 -ne 0 ]; then
110110
echo "Failed on first test"
111111
fi
112112

113-
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
113+
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${TESTJAVAOPTS} \
114114
-classpath "${TESTCLASSES}${FS}boot${PS}${TESTCLASSES}${FS}app" \
115115
-Djava.security.manager \
116116
-Djava.security.policy=GetInstance.policy \

test/jdk/sun/security/ssl/SSLSocketImpl/NotifyHandshakeTest.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -86,7 +86,7 @@ rm -rf com edu
8686
# This is the only thing we really care about as far as
8787
# test status goes.
8888
#
89-
${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \
89+
${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} ${TESTJAVAOPTS} \
9090
-Dtest.src=${TESTSRC} \
9191
-classpath "com.jar${PATHSEP}edu.jar" \
9292
-Djava.security.manager \

test/jdk/sun/security/util/Pem/encoding.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,6 @@
3030
# jtreg does not like -Dfile.encoding=UTF-16 inside a @run main line,
3131
# therefore a shell test is written.
3232

33-
$TESTJAVA/bin/java $TESTVMOPTS -cp $TESTCLASSES \
33+
$TESTJAVA/bin/java $TESTVMOPTS $TESTJAVAOPTS -cp $TESTCLASSES \
3434
-Dfile.encoding=UTF-16 \
3535
PemEncoding $TESTSRC/../HostnameMatcher/cert5.crt

test/jdk/sun/security/validator/certreplace.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -85,4 +85,4 @@ $KT -delete -alias user
8585

8686
EXTRAOPTS="--add-exports java.base/sun.security.validator=ALL-UNNAMED"
8787
$JAVAC ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} ${EXTRAOPTS} -d . ${TESTSRC}${FS}CertReplace.java
88-
$JAVA ${TESTVMOPTS} ${EXTRAOPTS} CertReplace certreplace.jks certreplace.certs
88+
$JAVA ${TESTVMOPTS} ${TESTJAVAOPTS} ${EXTRAOPTS} CertReplace certreplace.jks certreplace.certs

test/jdk/sun/security/validator/samedn.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,5 @@ $KT -delete -alias user
8181

8282
EXTRAOPTS="--add-exports java.base/sun.security.validator=ALL-UNNAMED"
8383
$JAVAC ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} ${EXTRAOPTS} -d . ${TESTSRC}${FS}CertReplace.java
84-
$JAVA ${TESTVMOPTS} ${EXTRAOPTS} CertReplace samedn.jks samedn1.certs || exit 1
85-
$JAVA ${TESTVMOPTS} ${EXTRAOPTS} CertReplace samedn.jks samedn2.certs || exit 2
84+
$JAVA ${TESTVMOPTS} ${TESTJAVAOPTS} ${EXTRAOPTS} CertReplace samedn.jks samedn1.certs || exit 1
85+
$JAVA ${TESTVMOPTS} ${TESTJAVAOPTS} ${EXTRAOPTS} CertReplace samedn.jks samedn2.certs || exit 2

0 commit comments

Comments
 (0)