PactBrokerClient throws index-out-of-bounds when 'can-i-deploy' is called for a new tag #1814
Labels
bug
Indicates an unexpected problem or unintended behavior
smartbear-supported
SmartBear engineering team will support this issue. See https://docs.pact.io/help/smartbear
We are using the maven-plugin (au.com.dius.pact.provider:maven:4.5.10` for most of our PACT Steps during CI & Deployment.
Whenever we try to call
can-i-deploy
for a provider on a new tag (no consumers yet!), it fails withThe cause is obvious. When we ask with a (not yet) known tag, the server (PactFlow) sends this JSON response:
=> "matrix" is an empty array
The code indeed checks if the array is null (
?.
), but after that it callsget(0)
on the empty array.pact-jvm/core/pactbroker/src/main/kotlin/au/com/dius/pact/core/pactbroker/PactBrokerClient.kt
Lines 1040 to 1041 in 521e265
As this part is only executed to deliver the successful verification results, it should be no problem to skip that part entirely, if we don't have a result at all.
Sorry that i don't come up with a PR, but i'm not used to Kotlin at all, and the fix should be fairly easy to implement.
Interesting observation as a side note: when using the CLI (
pact-broker
), no error occurs.The text was updated successfully, but these errors were encountered: