GH-1121 Fixed contentType equals logic (#1122)

Fixed contentType equals logic
This commit is contained in:
Oleg Zhurakousky
2017-11-02 13:50:11 -04:00
committed by Soby Chacko
parent cce69a6bd8
commit e5108428d4

View File

@@ -135,7 +135,7 @@ public abstract class MessageSerializationUtils {
private static Object deserializePayload(byte[] bytes, MimeType contentType,
Map<String, Class<?>> payloadTypeCache, Codec codec) {
if ("text".equalsIgnoreCase(contentType.getType()) || MimeTypeUtils.APPLICATION_JSON.equals(contentType)) {
if ("text".equalsIgnoreCase(contentType.getType()) || equalMimeTypeAndSubType(MimeTypeUtils.APPLICATION_JSON, contentType)) {
try {
return new String(bytes, "UTF-8");
}
@@ -166,4 +166,11 @@ public abstract class MessageSerializationUtils {
}
}
}
/*
* Candidate to go into some utils class
*/
private static boolean equalMimeTypeAndSubType(MimeType m1, MimeType m2) {
return m1.getType().equals(m2.getType()) && m1.getSubtype().equals(m2.getSubtype());
}
}