Kotlin migration

This commit is contained in:
Maksymilian Pawlak 2017-10-19 16:13:33 +01:00
parent 3f04b45010
commit 651bbdcf83

View File

@ -3,6 +3,7 @@ package net.corda.plugins
import com.typesafe.config.* import com.typesafe.config.*
import net.corda.cordform.CordformNode import net.corda.cordform.CordformNode
import org.bouncycastle.asn1.x500.X500Name import org.bouncycastle.asn1.x500.X500Name
import org.bouncycastle.asn1.x500.RDN
import org.bouncycastle.asn1.x500.style.BCStyle import org.bouncycastle.asn1.x500.style.BCStyle
import org.gradle.api.Project import org.gradle.api.Project
import java.io.File import java.io.File
@ -117,7 +118,12 @@ class Node(private val project: Project) : CordformNode() {
} }
val dirName = try { 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) { } catch(_ : IllegalArgumentException) {
// Can't parse as an X500 name, use the full string // Can't parse as an X500 name, use the full string
name name