Skip to content

Commit

Permalink
Merge pull request #1876 from SAP/pr-jdk-17.0.14+6
Browse files Browse the repository at this point in the history
Merge to tag jdk-17.0.14+6
  • Loading branch information
RealCLanger authored Dec 10, 2024
2 parents 960d5cc + bdc07d2 commit a3cbfb9
Show file tree
Hide file tree
Showing 24 changed files with 872 additions and 41 deletions.
16 changes: 12 additions & 4 deletions make/jdk/src/classes/build/tools/tzdb/TzdbZoneRulesCompiler.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2024, 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
Expand Down Expand Up @@ -273,16 +273,16 @@ private void outputFile(Path dstFile, String version,
// link version-region-rules
out.writeShort(builtZones.size());
for (Map.Entry<String, ZoneRules> entry : builtZones.entrySet()) {
int regionIndex = Arrays.binarySearch(regionArray, entry.getKey());
int regionIndex = findRegionIndex(regionArray, entry.getKey());
int rulesIndex = rulesList.indexOf(entry.getValue());
out.writeShort(regionIndex);
out.writeShort(rulesIndex);
}
// alias-region
out.writeShort(links.size());
for (Map.Entry<String, String> entry : links.entrySet()) {
int aliasIndex = Arrays.binarySearch(regionArray, entry.getKey());
int regionIndex = Arrays.binarySearch(regionArray, entry.getValue());
int aliasIndex = findRegionIndex(regionArray, entry.getKey());
int regionIndex = findRegionIndex(regionArray, entry.getValue());
out.writeShort(aliasIndex);
out.writeShort(regionIndex);
}
Expand All @@ -294,6 +294,14 @@ private void outputFile(Path dstFile, String version,
}
}

private static int findRegionIndex(String[] regionArray, String region) {
int index = Arrays.binarySearch(regionArray, region);
if (index < 0) {
throw new IllegalArgumentException("Unknown region: " + region);
}
return index;
}

/** Whether to output verbose messages. */
private boolean verbose;

Expand Down
13 changes: 6 additions & 7 deletions src/hotspot/os/bsd/os_bsd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2091,13 +2091,12 @@ jint os::init_2(void) {

// On macOS according to setrlimit(2), OPEN_MAX must be used instead
// of RLIM_INFINITY, but testing on macOS >= 10.6, reveals that
// we can, in fact, use even RLIM_INFINITY, so try the max value
// that the system claims can be used first, same as other BSD OSes.
// However, some terminals (ksh) will internally use "int" type
// to store this value and since RLIM_INFINITY overflows an "int"
// we might end up with a negative value, so cap the system limit max
// at INT_MAX instead, just in case, for everyone.
nbr_files.rlim_cur = MIN(INT_MAX, nbr_files.rlim_max);
// we can, in fact, use even RLIM_INFINITY.
// However, we need to limit the value to 0x100000 (which is the max value
// allowed on Linux) so that any existing code that iterates over all allowed
// file descriptors, finishes in a reasonable time, without appearing
// to hang.
nbr_files.rlim_cur = MIN(0x100000, nbr_files.rlim_max);

status = setrlimit(RLIMIT_NOFILE, &nbr_files);
if (status != 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/opto/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1515,8 +1515,8 @@ Node* Node::last_out(DUIterator_Last& i) const {
class SimpleDUIterator : public StackObj {
private:
Node* node;
DUIterator_Fast i;
DUIterator_Fast imax;
DUIterator_Fast i;
public:
SimpleDUIterator(Node* n): node(n), i(n->fast_outs(imax)) {}
bool has_next() { return i < imax; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,13 @@ void process(Main jartool, String opt, String arg) throws BadArgs {
}
},

// Extract options
new Option(false, OptionType.EXTRACT, "--keep-old-files", "-k") {
void process(Main jartool, String opt, String arg) {
jartool.kflag = true;
}
},

// Hidden options
new Option(false, OptionType.OTHER, "-P") {
void process(Main jartool, String opt, String arg) {
Expand Down Expand Up @@ -254,6 +261,7 @@ enum OptionType {
CREATE("create"),
CREATE_UPDATE("create.update"),
CREATE_UPDATE_INDEX("create.update.index"),
EXTRACT("extract"),
OTHER("other");

/** Resource lookup section prefix. */
Expand Down
15 changes: 14 additions & 1 deletion src/jdk.jartool/share/classes/sun/tools/jar/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ public int hashCode() {
* nflag: Perform jar normalization at the end
* pflag: preserve/don't strip leading slash and .. component from file name
* dflag: print module descriptor
* kflag: keep existing file
*/
boolean cflag, uflag, xflag, tflag, vflag, flag0, Mflag, iflag, pflag, dflag, validate;
boolean cflag, uflag, xflag, tflag, vflag, flag0, Mflag, iflag, pflag, dflag, kflag, validate;

boolean suppressDeprecateMsg = false;

Expand Down Expand Up @@ -581,6 +582,9 @@ boolean parseArgs(String args[]) {
case '0':
flag0 = true;
break;
case 'k':
kflag = true;
break;
case 'i':
if (cflag || uflag || xflag || tflag) {
usageError(getMsg("error.multiple.main.operations"));
Expand Down Expand Up @@ -611,6 +615,9 @@ boolean parseArgs(String args[]) {
usageError(getMsg("error.bad.option"));
return false;
}
if (kflag && !xflag) {
warn(formatMsg("warn.option.is.ignored", "--keep-old-files/-k/k"));
}

/* parse file arguments */
int n = args.length - count;
Expand Down Expand Up @@ -1451,6 +1458,12 @@ ZipEntry extractFile(InputStream is, ZipEntry e) throws IOException {
output(formatMsg("out.create", name));
}
} else {
if (f.exists() && kflag) {
if (vflag) {
output(formatMsg("out.kept", name));
}
return rc;
}
if (f.getParent() != null) {
File d = new File(f.getParent());
if (!d.exists() && !d.mkdirs() || !d.isDirectory()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ warn.release.unexpected.versioned.entry=\
unexpected versioned entry {0}
warn.flag.is.deprecated=\
Warning: The {0} option is deprecated, and is planned for removal in a future JDK release\n
warn.option.is.ignored=\
Warning: The {0} option is not valid with current usage, will be ignored.
out.added.manifest=\
added manifest
out.added.module-info=\
Expand All @@ -159,6 +161,8 @@ out.create=\
\ \ created: {0}
out.extracted=\
extracted: {0}
out.kept=\
\ \ skipped: {0} exists
out.inflated=\
\ inflated: {0}
out.size=\
Expand Down Expand Up @@ -236,7 +240,10 @@ main.help.opt.main.list=\
main.help.opt.main.update=\
\ -u, --update Update an existing jar archive
main.help.opt.main.extract=\
\ -x, --extract Extract named (or all) files from the archive
\ -x, --extract Extract named (or all) files from the archive.\n\
\ If a file with the same name appears more than once in\n\
\ the archive, each copy will be extracted, with later copies\n\
\ overwriting (replacing) earlier copies unless -k is specified.
main.help.opt.main.describe-module=\
\ -d, --describe-module Print the module descriptor, or automatic module name
main.help.opt.main.validate=\
Expand Down Expand Up @@ -298,6 +305,15 @@ main.help.opt.create.update.index.date=\
\ --date=TIMESTAMP The timestamp in ISO-8601 extended offset date-time with\n\
\ optional time-zone format, to use for the timestamps of\n\
\ entries, e.g. "2022-02-12T12:30:00-05:00"
main.help.opt.extract=\
\ Operation modifiers valid only in extract mode:\n
main.help.opt.extract.keep-old-files=\
\ -k, --keep-old-files Do not overwrite existing files.\n\
\ If a Jar file entry with the same name exists in the target\n\
\ directory, the existing file will not be overwritten.\n\
\ As a result, if a file appears more than once in an\n\
\ archive, later copies will not overwrite earlier copies.\n\
\ Also note that some file system can be case insensitive.
main.help.opt.other=\
\ Other options:\n
main.help.opt.other.help=\
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2024, 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
Expand Down Expand Up @@ -1696,6 +1696,9 @@ private String genSystemModulesMapClass(String allSystemModulesClassName,
ResourcePoolBuilder out) {
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS
+ ClassWriter.COMPUTE_FRAMES);
// sort the map of module name to the class name of the generated SystemModules class
List<Map.Entry<String, String>> systemModulesMap = map.entrySet()
.stream().sorted(Map.Entry.comparingByKey()).toList();
cw.visit(Opcodes.V1_8,
ACC_FINAL+ACC_SUPER,
SYSTEM_MODULES_MAP_CLASS,
Expand Down Expand Up @@ -1762,10 +1765,10 @@ private String genSystemModulesMapClass(String allSystemModulesClassName,
mv.visitTypeInsn(ANEWARRAY, "java/lang/String");

int index = 0;
for (String moduleName : sorted(map.keySet())) {
for (Map.Entry<String,String> entry : systemModulesMap) {
mv.visitInsn(DUP); // arrayref
pushInt(mv, index);
mv.visitLdcInsn(moduleName);
mv.visitLdcInsn(entry.getKey());
mv.visitInsn(AASTORE);
index++;
}
Expand All @@ -1785,10 +1788,10 @@ private String genSystemModulesMapClass(String allSystemModulesClassName,
mv.visitTypeInsn(ANEWARRAY, "java/lang/String");

index = 0;
for (String className : sorted(map.values())) {
for (Map.Entry<String,String> entry : systemModulesMap) {
mv.visitInsn(DUP); // arrayref
pushInt(mv, index);
mv.visitLdcInsn(className.replace('/', '.'));
mv.visitLdcInsn(entry.getValue().replace('/', '.'));
mv.visitInsn(AASTORE);
index++;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2024, 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
Expand Down Expand Up @@ -91,7 +91,7 @@ ${COMPILEJAVA}${FILESEP}bin${FILESEP}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
${TESTSRC}${FILESEP}provider${FILESEP}HashProvider.java

# run the test
${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \
${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} ${TESTJAVAOPTS} \
-classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}Deadlock.jar" \
-Djava.awt.headless=true \
ClassLoaderDeadlock
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

#
# Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2024, 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
Expand Down Expand Up @@ -62,5 +62,5 @@ esac

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

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

6 changes: 3 additions & 3 deletions test/jdk/java/security/cert/CertificateFactory/slowstream.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2010, 2024, 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
Expand Down Expand Up @@ -50,5 +50,5 @@ esac

${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . \
${TESTSRC}${FS}SlowStream.java
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Dtest.src=${TESTSRC} SlowStreamWriter | \
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} SlowStreamReader
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${TESTJAVAOPTS} -Dtest.src=${TESTSRC} SlowStreamWriter | \
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${TESTJAVAOPTS} SlowStreamReader
6 changes: 3 additions & 3 deletions test/jdk/sun/security/krb5/runNameEquals.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2009, 2024, 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
Expand Down Expand Up @@ -94,7 +94,7 @@ EXIT_STATUS=0

if [ "${NATIVE}" = "true" ] ; then
echo "Testing native provider"
${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \
${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} ${TESTJAVAOPTS} \
-classpath ${TESTCLASSES} \
-Dsun.security.jgss.native=true \
${TEST}
Expand All @@ -114,7 +114,7 @@ if [ "${NATIVE}" = "true" ] ; then
fi

echo "Testing java provider"
${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \
${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} ${TESTJAVAOPTS} \
-classpath ${TESTCLASSES} \
-Djava.security.krb5.realm=R \
-Djava.security.krb5.kdc=127.0.0.1 \
Expand Down
2 changes: 1 addition & 1 deletion test/jdk/sun/security/pkcs11/Provider/MultipleLogins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
${TESTSRC}${FS}MultipleLogins.java \
${TESTSRC}${FS}..${FS}PKCS11Test.java

TEST_ARGS="${TESTVMOPTS} -classpath ${TESTCLASSPATH} \
TEST_ARGS="${TESTVMOPTS} ${TESTJAVAOPTS} -classpath ${TESTCLASSPATH} \
--add-modules jdk.crypto.cryptoki \
--add-exports jdk.crypto.cryptoki/sun.security.pkcs11=ALL-UNNAMED \
-DCUSTOM_DB_DIR=${TESTCLASSES} \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /bin/sh

#
# Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2001, 2024, 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
Expand Down Expand Up @@ -96,7 +96,7 @@ ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLA
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}app \
${TESTSRC}${FS}GetInstance.java

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

${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${TESTJAVAOPTS} \
-classpath "${TESTCLASSES}${FS}boot${PS}${TESTCLASSES}${FS}app" \
-Djava.security.manager \
-Djava.security.policy=GetInstance.policy \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2002, 2024, 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
Expand Down Expand Up @@ -86,7 +86,7 @@ rm -rf com edu
# This is the only thing we really care about as far as
# test status goes.
#
${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \
${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} ${TESTJAVAOPTS} \
-Dtest.src=${TESTSRC} \
-classpath "com.jar${PATHSEP}edu.jar" \
-Djava.security.manager \
Expand Down
4 changes: 2 additions & 2 deletions test/jdk/sun/security/util/Pem/encoding.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2016, 2024, 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
Expand Down Expand Up @@ -30,6 +30,6 @@
# jtreg does not like -Dfile.encoding=UTF-16 inside a @run main line,
# therefore a shell test is written.

$TESTJAVA/bin/java $TESTVMOPTS -cp $TESTCLASSES \
$TESTJAVA/bin/java $TESTVMOPTS $TESTJAVAOPTS -cp $TESTCLASSES \
-Dfile.encoding=UTF-16 \
PemEncoding $TESTSRC/../HostnameMatcher/cert5.crt
4 changes: 2 additions & 2 deletions test/jdk/sun/security/validator/certreplace.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2010, 2024, 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
Expand Down Expand Up @@ -85,4 +85,4 @@ $KT -delete -alias user

EXTRAOPTS="--add-exports java.base/sun.security.validator=ALL-UNNAMED"
$JAVAC ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} ${EXTRAOPTS} -d . ${TESTSRC}${FS}CertReplace.java
$JAVA ${TESTVMOPTS} ${EXTRAOPTS} CertReplace certreplace.jks certreplace.certs
$JAVA ${TESTVMOPTS} ${TESTJAVAOPTS} ${EXTRAOPTS} CertReplace certreplace.jks certreplace.certs
4 changes: 2 additions & 2 deletions test/jdk/sun/security/validator/samedn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,5 @@ $KT -delete -alias user

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

0 comments on commit a3cbfb9

Please sign in to comment.