Yes, it's better. But I'm thinking about the other issue, it's in the following line 

val er = new ExecutorRunner(appId, 1, appDesc, 8, 500, null, "blah", "worker321", f(sparkHome),
      f("ooga"), "blah", ExecutorState.RUNNING)

sparkHome can be null if neither "SPARK_HOME" nor "spark.home" was set, so I changed to f(sparkHome.getOrElse("."))