Skip to content

Commit

Permalink
Fix ProcessResource directory separator (#4782)
Browse files Browse the repository at this point in the history
* Fix ProcessResource directory separator

* spotless
  • Loading branch information
jack-berg authored Oct 1, 2022
1 parent e1519bd commit 3ee7bbd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ private static Resource doBuildResource() {
if (javaHome != null) {
StringBuilder executablePath = new StringBuilder(javaHome);
executablePath
.append(File.pathSeparatorChar)
.append(File.separatorChar)
.append("bin")
.append(File.pathSeparatorChar)
.append(File.separatorChar)
.append("java");
if (osName != null && osName.toLowerCase().startsWith("windows")) {
executablePath.append(".exe");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ void notWindows() {
Attributes attributes = resource.getAttributes();

assertThat(attributes.get(ResourceAttributes.PROCESS_PID)).isGreaterThan(1);
assertThat(attributes.get(ResourceAttributes.PROCESS_EXECUTABLE_PATH))
.contains("java")
.doesNotEndWith(".exe");
assertThat(attributes.get(ResourceAttributes.PROCESS_EXECUTABLE_PATH)).matches(".*[/\\\\]java");
assertThat(attributes.get(ResourceAttributes.PROCESS_COMMAND_LINE))
.contains(attributes.get(ResourceAttributes.PROCESS_EXECUTABLE_PATH));
}
Expand All @@ -45,8 +43,7 @@ void windows() {

assertThat(attributes.get(ResourceAttributes.PROCESS_PID)).isGreaterThan(1);
assertThat(attributes.get(ResourceAttributes.PROCESS_EXECUTABLE_PATH))
.contains("java")
.endsWith(".exe");
.matches(".*[/\\\\]java\\.exe");
assertThat(attributes.get(ResourceAttributes.PROCESS_COMMAND_LINE))
.contains(attributes.get(ResourceAttributes.PROCESS_EXECUTABLE_PATH));
}
Expand Down

0 comments on commit 3ee7bbd

Please sign in to comment.