public @NotNull String marshal(@NotNull Object obj) {
byte[] marshalBytes;
try {
marshalBytes = objectMapper.get().writeValueAsBytes(obj);
} catch (IOException e) {
throw new ServiceException("Gout IOException during json marshalling: " + e.getMessage() + " - input:'"
+ obj + "'", e);
}
try {
String marshal = new String(marshalBytes, "UTF-8");
LOG.trace("Marshalled JSON from {} to {}", obj, marshal);
return marshal;
} catch (UnsupportedEncodingException e) {
throw new ServiceException("UnsupportedEncodingException marshalling Json stream: " + e.getMessage()
+ " - input:'" + obj + "'", e);
}
}