Skip to content

Commit

Permalink
fix: Remove unnecessary int cast and check for expected version forma…
Browse files Browse the repository at this point in the history
…t to better handle custom versions like GraalVM
  • Loading branch information
Griefed committed Aug 11, 2024
1 parent 6ca78d5 commit f8aef38
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,14 @@ else
else
{
GetJavaVersion
if ([int]$script:JavaVersion -ne [int]$RecommendedJavaVersion)
if ($script:JavaVersion -match '[0-9]+')
{
if ($script:JavaVersion -ne $RecommendedJavaVersion)
{
InstallJava
}
}
else
{
InstallJava
}
Expand All @@ -623,7 +630,7 @@ else
{
GetJavaVersion
Write-Host "Detected $($Semantics[0]).$($Semantics[1]).$($Semantics[2]) - Java $($JavaVersion)"
if ([int]$script:JavaVersion -ne [int]$RecommendedJavaVersion)
if ($script:JavaVersion -ne $RecommendedJavaVersion)
{
$script:Java = "java"
InstallJava
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,11 @@ else
installJava
else
getJavaVersion
if [[ "$JAVA_VERSION" != "$RECOMMENDED_JAVA_VERSION" ]];then
if [[ "$JAVA_VERSION" =~ [0-9]+ ]];then
if [[ "$JAVA_VERSION" != "$RECOMMENDED_JAVA_VERSION" ]];then
installJava
fi
else
installJava
fi
fi
Expand Down

0 comments on commit f8aef38

Please sign in to comment.