You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
String value = null;
new PactDslJsonBody()
.stringType("myField", value)
will produce NPE:
java.lang.NullPointerException: Cannot invoke "String.toCharArray()" because "examples[0]" is null
It looks like in file PactDslJsonBody.kt method fun stringType(name: String, vararg examples: String): PactDslJsonBody there is not null check before accessing the value:
is JsonValue.Object -> body.add(name, JsonValue.StringValue(examples[0].toCharArray()))
The text was updated successfully, but these errors were encountered:
iekdosha
changed the title
Pact DSL throws NPE when setting an string type with example null
Pact DSL throws NPE when setting an stringType with example set to nullMar 15, 2023
👋 Hi! The 'smartbear-supported' label has just been added to this issue, which will create an internal tracking ticket in PactFlow's Jira (PACT-888). We will use this to prioritise and assign a team member to this task. All activity will be public on this ticket. For now, sit tight and we'll update this ticket once we have more information on the next steps.
I am using consumer version 4.4.7.
Running this code:
will produce NPE:
It looks like in file
PactDslJsonBody.kt
methodfun stringType(name: String, vararg examples: String): PactDslJsonBody
there is not null check before accessing the value:The text was updated successfully, but these errors were encountered: