mirror of
https://github.com/corda/corda.git
synced 2024-12-24 07:06:44 +00:00
Reordered a lazy eval to avoid an NPE
This commit is contained in:
parent
7d2d324d5f
commit
4a0916e9d7
@ -1,4 +1,4 @@
|
||||
gradlePluginsVersion=0.12.2
|
||||
gradlePluginsVersion=0.12.3
|
||||
kotlinVersion=1.1.2
|
||||
guavaVersion=21.0
|
||||
bouncycastleVersion=1.56
|
||||
|
@ -64,6 +64,13 @@ private object WebJarType : JarType("corda-webserver.jar") {
|
||||
}
|
||||
|
||||
private abstract class JavaCommand(jarName: String, internal val dir: File, debugPort: Int?, internal val nodeName: String, init: MutableList<String>.() -> Unit, args: List<String>) {
|
||||
private val javaPath: String by lazy {
|
||||
val path = File(File(System.getProperty("java.home"), "bin"), "java").path
|
||||
// Replace below is to fix an issue with spaces in paths on Windows.
|
||||
// Quoting the entire path does not work, only the space or directory within the path.
|
||||
if(os == OS.WINDOWS) path.replace(" ", "\" \"") else path
|
||||
}
|
||||
|
||||
internal val command: List<String> = mutableListOf<String>().apply {
|
||||
add(javaPath)
|
||||
add("-Dname=$nodeName")
|
||||
@ -76,13 +83,6 @@ private abstract class JavaCommand(jarName: String, internal val dir: File, debu
|
||||
|
||||
internal abstract fun processBuilder(): ProcessBuilder
|
||||
internal fun start() = processBuilder().directory(dir).start()
|
||||
|
||||
private val javaPath: String by lazy {
|
||||
val path = File(File(System.getProperty("java.home"), "bin"), "java").path
|
||||
// Replace below is to fix an issue with spaces in paths on Windows.
|
||||
// Quoting the entire path does not work, only the space or directory within the path.
|
||||
if(os == OS.WINDOWS) path.replace(" ", "\" \"") else path
|
||||
}
|
||||
}
|
||||
|
||||
private class HeadlessJavaCommand(jarName: String, dir: File, debugPort: Int?, args: List<String>) : JavaCommand(jarName, dir, debugPort, dir.name, { add("--no-local-shell") }, args) {
|
||||
|
Loading…
Reference in New Issue
Block a user