Skip to content

Commit a2c5211

Browse files
author
Ronald Holshausen
committedNov 3, 2019
fix: Fix codenarc #967
1 parent 44cc973 commit a2c5211

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎consumer/pact-jvm-consumer/src/main/kotlin/au/com/dius/pact/consumer/MockHttpServer.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,10 @@ open class MockHttpServer(pact: RequestResponsePact, config: MockProviderConfig)
284284
open class MockHttpsServer(pact: RequestResponsePact, config: MockProviderConfig) :
285285
BaseJdkMockServer(pact, config, HttpsServer.create(config.address(), 0))
286286

287-
fun calculateCharset(headers: Map<String, List<String>>): Charset {
287+
fun calculateCharset(headers: Map<String, List<String?>>): Charset {
288288
val contentType = headers.entries.find { it.key.toUpperCase() == "CONTENT-TYPE" }
289289
val default = Charset.forName("UTF-8")
290-
if (contentType != null && contentType.value.isNotEmpty() && contentType.value.first().isNotEmpty()) {
290+
if (contentType != null && contentType.value.isNotEmpty() && !contentType.value.first().isNullOrEmpty()) {
291291
try {
292292
return ContentType.parse(contentType.value.first())?.charset ?: default
293293
} catch (e: Exception) {

‎consumer/pact-jvm-consumer/src/test/groovy/au/com/dius/pact/consumer/dsl/DslPartSpec.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import spock.lang.Unroll
55

66
class DslPartSpec extends Specification {
77

8-
@SuppressWarnings('MethodCount')
8+
@SuppressWarnings(['MethodCount', 'FieldName'])
99
private static final DslPart subject = new DslPart('', '') {
1010

1111
@Override

0 commit comments

Comments
 (0)
Please sign in to comment.