Skip to content

Commit a19707a

Browse files
tgodzikGedochao
authored andcommitted
bugfix: Don't allow empty JAVA_HOME
1 parent 1f87626 commit a19707a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

modules/options/src/main/scala/scala/build/options/BuildOptions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ object BuildOptions {
557557
def envUpdates(currentEnv: Map[String, String]): Map[String, String] = {
558558
// On Windows, AFAIK, env vars are "case-insensitive but case-preserving".
559559
// If PATH was defined as "Path", we need to update "Path", not "PATH".
560-
// Same for JAVA_HOME.
560+
// Same for JAVA_HOME
561561
def keyFor(name: String) =
562562
if (Properties.isWin)
563563
currentEnv.keys.find(_.equalsIgnoreCase(name)).getOrElse(name)

modules/options/src/main/scala/scala/build/options/JavaOptions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ final case class JavaOptions(
149149
}
150150

151151
private def findLocalDefaultJava(): Option[Positioned[os.Path]] =
152-
Option(System.getenv("JAVA_HOME")).map(p =>
152+
Option(System.getenv("JAVA_HOME")).filter(_.nonEmpty).map(p =>
153153
Positioned(Position.Custom("JAVA_HOME env"), os.Path(p, os.pwd))
154154
).orElse(
155155
sys.props.get("java.home").map(p =>

0 commit comments

Comments
 (0)