diff --git a/gradle-plugins/cordformation/src/main/kotlin/net/corda/plugins/Node.kt b/gradle-plugins/cordformation/src/main/kotlin/net/corda/plugins/Node.kt index 738a68c6d7..b0660a9245 100644 --- a/gradle-plugins/cordformation/src/main/kotlin/net/corda/plugins/Node.kt +++ b/gradle-plugins/cordformation/src/main/kotlin/net/corda/plugins/Node.kt @@ -3,6 +3,7 @@ package net.corda.plugins import com.typesafe.config.* import net.corda.cordform.CordformNode import org.bouncycastle.asn1.x500.X500Name +import org.bouncycastle.asn1.x500.RDN import org.bouncycastle.asn1.x500.style.BCStyle import org.gradle.api.Project import java.io.File @@ -117,7 +118,12 @@ class Node(private val project: Project) : CordformNode() { } val dirName = try { - X500Name(name).getRDNs(BCStyle.O).first().first.value.toString() + val o = X500Name(name).getRDNs(BCStyle.O) + if (o.size > 0) { + o.first().first.value.toString() + } else { + name + } } catch(_ : IllegalArgumentException) { // Can't parse as an X500 name, use the full string name