Skip to content

Commit

Permalink
8318410: jdk/java/lang/instrument/BootClassPath/BootClassPathTest.sh …
Browse files Browse the repository at this point in the history
…fails on Japanese Windows

Backport-of: 4144ef36bcefb0ba597be9c871b15be5043ad231
  • Loading branch information
Kimura Yukihiro authored and GoeLin committed Jan 24, 2024
1 parent cb3c6ca commit 1c12d16
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
15 changes: 13 additions & 2 deletions test/jdk/java/lang/instrument/BootClassPath/BootClassPathTest.sh
@@ -1,5 +1,5 @@
#
# Copyright (c) 2004, 2015, 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
Expand Down Expand Up @@ -64,7 +64,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}"
Expand Down
13 changes: 11 additions & 2 deletions test/jdk/java/lang/instrument/BootClassPath/Setup.java
@@ -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
Expand Down Expand Up @@ -45,6 +45,10 @@ public static void main(String[] args) throws Exception {
}
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();
Expand Down Expand Up @@ -87,7 +91,12 @@ public static void main(String[] args) throws Exception {
*/
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));
}
}
}

Expand Down

1 comment on commit 1c12d16

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.