Skip to content

Commit

Permalink
Merge pull request corda#1544 from corda/m4ksio_gradle_no_o_fix
Browse files Browse the repository at this point in the history
Avoid ArrayOutOfBound exception in Gradle
  • Loading branch information
m4ksio authored Oct 23, 2017
2 parents 4e3a489 + 651bbdc commit 931ab12
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 931ab12

Please sign in to comment.