Skip to content

Commit

Permalink
GH-1152: Fix Sonar issue
Browse files Browse the repository at this point in the history
  • Loading branch information
garyrussell committed Feb 3, 2020
1 parent bb83aa7 commit 7941596
Showing 1 changed file with 9 additions and 4 deletions.
Expand Up @@ -121,10 +121,7 @@ private String getBodyContentAsString() {
return SerializationUtils.deserialize(new ByteArrayInputStream(this.body), whiteListPatterns,
ClassUtils.getDefaultClassLoader()).toString();
}
String encoding = nullProps ? null : this.messageProperties.getContentEncoding();
if (encoding == null) {
encoding = bodyEncoding;
}
String encoding = encoding(nullProps);
if (MessageProperties.CONTENT_TYPE_TEXT_PLAIN.equals(contentType)
|| MessageProperties.CONTENT_TYPE_JSON.equals(contentType)
|| MessageProperties.CONTENT_TYPE_JSON_ALT.equals(contentType)
Expand All @@ -139,6 +136,14 @@ private String getBodyContentAsString() {
return this.body.toString() + "(byte[" + this.body.length + "])"; //NOSONAR
}

private String encoding(boolean nullProps) {
String encoding = nullProps ? null : this.messageProperties.getContentEncoding();
if (encoding == null) {
encoding = bodyEncoding;
}
return encoding;
}

@Override
public int hashCode() {
final int prime = 31;
Expand Down

0 comments on commit 7941596

Please sign in to comment.