Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1381] enh: Build on JDK 22 #1530

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
enh: Build on JDK 22
  • Loading branch information
lprimak committed Jun 12, 2024
commit 6adc508d16c17854532cf3cacc598e96184f99af
5 changes: 4 additions & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
strategy:
matrix:
os: [ 'ubuntu-latest', 'windows-latest', 'macOS-latest' ]
jdk: [ 11, 17, 21 ]
jdk: [ 11, 17, 21, 22 ]
dist: [ 'temurin', 'adopt-openj9', 'zulu' ]
exclude:
# was already built
Expand All @@ -71,6 +71,9 @@ jobs:
# no OpenJ9 21
- dist: adopt-openj9
jdk: 21
# no OpenJ9 22
- dist: adopt-openj9
jdk: 22
fail-fast: false

runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion .jenkins.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pipeline {
axis {
// https://cwiki.apache.org/confluence/display/INFRA/JDK+Installation+Matrix
name 'MATRIX_JDK'
values 'jdk_11_latest', 'jdk_17_latest', 'jdk_21_latest'
values 'jdk_11_latest', 'jdk_17_latest', 'jdk_21_latest', 'jdk_22_latest'
}
// Additional axes, like OS and maven version can be configured here.
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,8 @@ private static void printHelpAndExit(Options options, Exception e, boolean debug
private static char[] readPassword(boolean confirm) throws IOException {
java.io.Console console = System.console();
char[] first;
if (console != null) {
if (isTerminal(console)) {
first = console.readPassword("%s", "Password to hash: ");
//throw new IllegalStateException("java.io.Console is not available on the current JVM. Cannot read passwords.");
} else if (System.in != null) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String readLine = br.readLine();
Expand All @@ -494,7 +493,7 @@ private static char[] readPassword(boolean confirm) throws IOException {
if (first == null || first.length == 0) {
throw new IllegalArgumentException("No password specified.");
}
if (confirm) {
if (confirm && isTerminal(console)) {
char[] second = console.readPassword("%s", "Password to hash (confirm): ");
if (!Arrays.equals(first, second)) {
String msg = "Password entries do not match.";
Expand All @@ -504,6 +503,15 @@ private static char[] readPassword(boolean confirm) throws IOException {
return first;
}

private static boolean isTerminal(java.io.Console console) {
try {
// isTerminal() is only available in Java 22 or later
return console != null && (Boolean) console.getClass().getMethod("isTerminal").invoke(console);
} catch (ReflectiveOperationException e) {
return true;
}
}

private static File toFile(String path) {
String resolved = path;
if (path.startsWith("~/") || path.startsWith(("~\\"))) {
Expand Down