Gabriel95 / scalafx

Automatically exported from code.google.com/p/scalafx
Other
0 stars 0 forks source link

Having neither JAVAFX_HOME nor JAVA_HOME not dealt with correctly #28

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The current code lets a 'null' leak to a File() constructor, giving Null 
pointer exception instead of the intended, clearer message.

Suggested fix:

diff -r b6400c384b64 project/build.scala
--- a/project/build.scala   Sat Jan 19 19:20:04 2013 +0200
+++ b/project/build.scala   Sat Jan 19 20:16:30 2013 +0200
@@ -29,11 +34,19 @@
         var j = System.getenv("JAVAFX_HOME")
         if ( j==null ) {
             j = System.getenv("JAVA_HOME")
+            if (j==null) {
+              throw new RuntimeException(
+                  "SBT Failure: neither JAVAFX_HOME nor JAVA_HOME environment 
variables have been defined!"
+              )
+            }
         }
         val dir = new File(j) 
         if ( !dir.exists) {
-            throw new RuntimeException(
-                "SBT Failure: neither JAVAFX_HOME nor JAVA_HOME environment 
variables have been defined!")
+            throw new RuntimeException("SBT Failure: no such dir: "+ j)
         }
         println("**** detected Java/JDK Home is set to "+dir+"  ****")
         Some(j)

Original issue reported on code.google.com by akau...@gmail.com on 19 Jan 2013 at 6:20

GoogleCodeExporter commented 8 years ago
committed this patch

Original comment by Alain.Fa...@gmail.com on 22 Jan 2013 at 7:01