8318410: jdk/java/lang/instrument/BootClassPath/BootClassPathTest.sh fails on Japanese Windows

Reviewed-by: phh
Backport-of: 4144ef36bcefb0ba597be9c871b15be5043ad231
This commit is contained in:
Kazuhisa Takakuri 2024-04-17 08:20:53 +00:00 committed by Severin Gehwolf
parent 0e0b018acb
commit 68ab0f3b24
2 changed files with 24 additions and 4 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2023, 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
@ -63,7 +63,18 @@ echo "Creating manifest file..."
# java Setup <workdir> <premain-class>
# - outputs boot class path to boot.dir
"$JAVA" ${TESTVMOPTS} -classpath "${TESTCLASSES}" Setup "${TESTCLASSES}" Agent
OS=`uname -s`
case ${OS} in
CYGWIN*)
CYGWIN="CYGWIN"
;;
*)
CYGWIN=""
;;
esac
"$JAVA" ${TESTVMOPTS} -classpath "${TESTCLASSES}" Setup "${TESTCLASSES}" Agent "${CYGWIN}"
BOOTDIR=`cat ${TESTCLASSES}/boot.dir`
echo "Created ${BOOTDIR}"

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2023, 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
@ -45,6 +45,10 @@ public class Setup {
}
String workDir = args[0];
String premainClass = args[1];
boolean isCygwin = false;
if (args.length==3 && args[2].equals("CYGWIN")) {
isCygwin = true;
}
String manifestFile = workDir + fileSeparator + "MANIFEST.MF";
String bootClassPath = "boot" + suffix();
@ -87,7 +91,12 @@ public class Setup {
*/
f = new File(workDir + fileSeparator + "boot.dir");
try (FileOutputStream out = new FileOutputStream(f)) {
out.write(bootDir.getBytes(defaultEncoding));
if (osName.startsWith("Windows") && isCygwin) {
out.write(bootDir.getBytes("UTF-8"));
}
else {
out.write(bootDir.getBytes(defaultEncoding));
}
}
}