This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 36469822b13 CAMEL-19076: camel-jbang trace to show internal exchange properties also. 36469822b13 is described below commit 36469822b136e383a1c974df7da9c49ae6dbc420 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Thu Feb 23 20:29:45 2023 +0100 CAMEL-19076: camel-jbang trace to show internal exchange properties also. --- .../org/apache/camel/support/MessageHelper.java | 268 +++++++++++---------- .../core/commands/action/CamelTraceAction.java | 27 ++- .../java/org/apache/camel/util/json/Jsoner.java | 2 +- 3 files changed, 160 insertions(+), 137 deletions(-) diff --git a/core/camel-support/src/main/java/org/apache/camel/support/MessageHelper.java b/core/camel-support/src/main/java/org/apache/camel/support/MessageHelper.java index 564105481bb..ce2c389101c 100644 --- a/core/camel-support/src/main/java/org/apache/camel/support/MessageHelper.java +++ b/core/camel-support/src/main/java/org/apache/camel/support/MessageHelper.java @@ -65,8 +65,8 @@ public final class MessageHelper { * <p/> * Will handle stream based bodies wrapped in StreamCache. * - * @param message the message with the body - * @return the body as String, can return <tt>null</null> if no body + * @param message the message with the body + * @return the body as String, can return <tt>null</null> if no body */ public static String extractBodyAsString(Message message) { if (message == null) { @@ -104,8 +104,8 @@ public final class MessageHelper { * <p/> * Will skip java.lang. for the build in Java types. * - * @param message the message with the body - * @return the body type name as String, can return <tt>null</null> if no body + * @param message the message with the body + * @return the body type name as String, can return <tt>null</null> if no body */ public static String getBodyTypeName(Message message) { if (message == null) { @@ -157,10 +157,10 @@ public final class MessageHelper { * <p/> * Will clip the body if its too big for logging. Will prepend the message with <tt>Message: </tt> * - * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_STREAMS - * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_MAX_CHARS - * @param message the message - * @return the logging message + * @param message the message + * @return the logging message + * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_STREAMS + * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_MAX_CHARS */ public static String extractBodyForLogging(Message message) { return extractBodyForLogging(message, "Message: "); @@ -171,11 +171,11 @@ public final class MessageHelper { * <p/> * Will clip the value if its too big for logging. * - * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_STREAMS - * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_MAX_CHARS - * @param value the value - * @param message the message - * @return the logging message + * @param value the value + * @param message the message + * @return the logging message + * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_STREAMS + * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_MAX_CHARS */ public static String extractValueForLogging(Object value, Message message) { boolean streams = false; @@ -205,11 +205,11 @@ public final class MessageHelper { * <p/> * Will clip the body if its too big for logging. * - * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_STREAMS - * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_MAX_CHARS - * @param message the message - * @param prepend a message to prepend - * @return the logging message + * @param message the message + * @param prepend a message to prepend + * @return the logging message + * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_STREAMS + * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_MAX_CHARS */ public static String extractBodyForLogging(Message message, String prepend) { boolean streams = false; @@ -228,13 +228,13 @@ public final class MessageHelper { * <p/> * Will clip the body if its too big for logging. * - * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_STREAMS - * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_MAX_CHARS - * @param message the message - * @param prepend a message to prepend - * @param allowStreams whether or not streams is allowed - * @param allowFiles whether or not files is allowed (currently not in use) - * @return the logging message + * @param message the message + * @param prepend a message to prepend + * @param allowStreams whether or not streams is allowed + * @param allowFiles whether or not files is allowed (currently not in use) + * @return the logging message + * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_STREAMS + * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_MAX_CHARS */ public static String extractBodyForLogging(Message message, String prepend, boolean allowStreams, boolean allowFiles) { // default to 1000 chars @@ -255,14 +255,14 @@ public final class MessageHelper { * <p/> * Will clip the body if its too big for logging. * - * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_MAX_CHARS - * @param message the message - * @param prepend a message to prepend (optional) - * @param allowStreams whether or not streams is allowed - * @param allowFiles whether or not files is allowed (currently not in use) - * @param maxChars limit to maximum number of chars. Use 0 for not limit, and -1 for turning logging message - * body off. - * @return the logging message + * @param message the message + * @param prepend a message to prepend (optional) + * @param allowStreams whether or not streams is allowed + * @param allowFiles whether or not files is allowed (currently not in use) + * @param maxChars limit to maximum number of chars. Use 0 for not limit, and -1 for turning logging message + * body off. + * @return the logging message + * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_MAX_CHARS */ public static String extractBodyForLogging( Message message, String prepend, boolean allowStreams, boolean allowFiles, int maxChars) { @@ -279,15 +279,15 @@ public final class MessageHelper { * <p/> * Will clip the body if its too big for logging. * - * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_MAX_CHARS - * @param message the message - * @param prepend a message to prepend (optional) - * @param allowCachedStreams whether or not cached streams is allowed - * @param allowStreams whether or not streams is allowed - * @param allowFiles whether or not files is allowed (currently not in use) - * @param maxChars limit to maximum number of chars. Use 0 for not limit, and -1 for turning logging - * message body off. - * @return the logging message + * @param message the message + * @param prepend a message to prepend (optional) + * @param allowCachedStreams whether or not cached streams is allowed + * @param allowStreams whether or not streams is allowed + * @param allowFiles whether or not files is allowed (currently not in use) + * @param maxChars limit to maximum number of chars. Use 0 for not limit, and -1 for turning logging + * message body off. + * @return the logging message + * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_MAX_CHARS */ public static String extractBodyForLogging( Message message, String prepend, boolean allowCachedStreams, boolean allowStreams, boolean allowFiles, @@ -306,14 +306,14 @@ public final class MessageHelper { * <p/> * Will clip the value if its too big for logging. * - * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_MAX_CHARS - * @param obj the value - * @param message the message - * @param allowStreams whether or not streams is allowed - * @param allowFiles whether or not files is allowed (currently not in use) - * @param maxChars limit to maximum number of chars. Use 0 for not limit, and -1 for turning logging message - * body off. - * @return the logging message + * @param obj the value + * @param message the message + * @param allowStreams whether or not streams is allowed + * @param allowFiles whether or not files is allowed (currently not in use) + * @param maxChars limit to maximum number of chars. Use 0 for not limit, and -1 for turning logging message + * body off. + * @return the logging message + * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_MAX_CHARS */ public static String extractValueForLogging( Object obj, Message message, boolean allowStreams, boolean allowFiles, int maxChars) { @@ -326,15 +326,15 @@ public final class MessageHelper { * <p/> * Will clip the value if its too big for logging. * - * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_MAX_CHARS - * @param obj the value - * @param message the message - * @param allowCachedStreams whether or not cached streams is allowed - * @param allowStreams whether or not streams is allowed - * @param allowFiles whether or not files is allowed (currently not in use) - * @param maxChars limit to maximum number of chars. Use 0 for not limit, and -1 for turning logging - * message body off. - * @return the logging message + * @param obj the value + * @param message the message + * @param allowCachedStreams whether or not cached streams is allowed + * @param allowStreams whether or not streams is allowed + * @param allowFiles whether or not files is allowed (currently not in use) + * @param maxChars limit to maximum number of chars. Use 0 for not limit, and -1 for turning logging + * message body off. + * @return the logging message + * @see org.apache.camel.Exchange#LOG_DEBUG_BODY_MAX_CHARS */ public static String extractValueForLogging( Object obj, Message message, boolean allowCachedStreams, boolean allowStreams, boolean allowFiles, int maxChars) { @@ -419,7 +419,7 @@ public final class MessageHelper { // clip body if length enabled and the body is too big if (maxChars > 0 && body.length() > maxChars) { body = body.substring(0, maxChars) + "... [Body clipped after " + maxChars + " chars, total length is " - + body.length() + "]"; + + body.length() + "]"; } return body; @@ -428,8 +428,8 @@ public final class MessageHelper { /** * Dumps the message as a generic XML structure. * - * @param message the message - * @return the XML + * @param message the message + * @return the XML */ public static String dumpAsXml(Message message) { return dumpAsXml(message, true); @@ -438,9 +438,9 @@ public final class MessageHelper { /** * Dumps the message as a generic XML structure. * - * @param message the message - * @param includeBody whether or not to include the message body - * @return the XML + * @param message the message + * @param includeBody whether or not to include the message body + * @return the XML */ public static String dumpAsXml(Message message, boolean includeBody) { return dumpAsXml(message, includeBody, 0); @@ -449,10 +449,10 @@ public final class MessageHelper { /** * Dumps the message as a generic XML structure. * - * @param message the message - * @param includeBody whether or not to include the message body - * @param indent number of spaces to indent - * @return the XML + * @param message the message + * @param includeBody whether or not to include the message body + * @param indent number of spaces to indent + * @return the XML */ public static String dumpAsXml(Message message, boolean includeBody, int indent) { return dumpAsXml(message, includeBody, indent, false, true, 128 * 1024); @@ -461,14 +461,14 @@ public final class MessageHelper { /** * Dumps the message as a generic XML structure. * - * @param message the message - * @param includeBody whether or not to include the message body - * @param indent number of spaces to indent - * @param allowStreams whether to include message body if they are stream based - * @param allowFiles whether to include message body if they are file based - * @param maxChars clip body after maximum chars (to avoid very big messages). Use 0 or negative value to not - * limit at all. - * @return the XML + * @param message the message + * @param includeBody whether or not to include the message body + * @param indent number of spaces to indent + * @param allowStreams whether to include message body if they are stream based + * @param allowFiles whether to include message body if they are file based + * @param maxChars clip body after maximum chars (to avoid very big messages). Use 0 or negative value to not + * limit at all. + * @return the XML */ public static String dumpAsXml( Message message, boolean includeBody, int indent, boolean allowStreams, boolean allowFiles, int maxChars) { @@ -478,16 +478,16 @@ public final class MessageHelper { /** * Dumps the message as a generic XML structure. * - * @param message the message - * @param includeBody whether or not to include the message body - * @param includeExchangeProperties whether or not to include exchange properties - * @param indent number of spaces to indent - * @param allowCachedStreams whether to include message body if they are stream cache based - * @param allowStreams whether to include message body if they are stream based - * @param allowFiles whether to include message body if they are file based - * @param maxChars clip body after maximum chars (to avoid very big messages). Use 0 or negative - * value to not limit at all. - * @return the XML + * @param message the message + * @param includeBody whether or not to include the message body + * @param includeExchangeProperties whether or not to include exchange properties + * @param indent number of spaces to indent + * @param allowCachedStreams whether to include message body if they are stream cache based + * @param allowStreams whether to include message body if they are stream based + * @param allowFiles whether to include message body if they are file based + * @param maxChars clip body after maximum chars (to avoid very big messages). Use 0 or negative + * value to not limit at all. + * @return the XML */ public static String dumpAsXml( Message message, boolean includeExchangeProperties, boolean includeBody, int indent, @@ -513,12 +513,17 @@ public final class MessageHelper { sb.append(prefix); sb.append(" <exchangeProperties>\n"); // sort the exchange properties so they are listed A..Z - Map<String, Object> properties = new TreeMap<>(message.getExchange().getProperties()); + Map<String, Object> properties = new TreeMap<>(message.getExchange().getAllProperties()); for (Map.Entry<String, Object> entry : properties.entrySet()) { + String key = entry.getKey(); + // skip message history + if (Exchange.MESSAGE_HISTORY.equals(key)) { + continue; + } Object value = entry.getValue(); String type = ObjectHelper.classCanonicalName(value); sb.append(prefix); - sb.append(" <exchangeProperty key=\"").append(entry.getKey()).append("\""); + sb.append(" <exchangeProperty key=\"").append(key).append("\""); if (type != null) { sb.append(" type=\"").append(type).append("\""); } @@ -666,11 +671,11 @@ public final class MessageHelper { /** * Dumps the {@link MessageHistory} from the {@link Exchange} in a human readable format. * - * @param exchange the exchange - * @param exchangeFormatter if provided then information about the exchange is included in the dump - * @param logStackTrace whether to include a header for the stacktrace, to be added (not included in this - * dump). - * @return a human readable message history as a table + * @param exchange the exchange + * @param exchangeFormatter if provided then information about the exchange is included in the dump + * @param logStackTrace whether to include a header for the stacktrace, to be added (not included in this + * dump). + * @return a human readable message history as a table */ public static String dumpMessageHistoryStacktrace( Exchange exchange, ExchangeFormatter exchangeFormatter, boolean logStackTrace) { @@ -800,8 +805,8 @@ public final class MessageHelper { /** * Dumps the message as a generic JSon structure. * - * @param message the message - * @return the JSon + * @param message the message + * @return the JSon */ public static String dumpAsJSon(Message message) { return dumpAsJSon(message, true); @@ -810,9 +815,9 @@ public final class MessageHelper { /** * Dumps the message as a generic JSon structure. * - * @param message the message - * @param includeBody whether or not to include the message body - * @return the JSon + * @param message the message + * @param includeBody whether or not to include the message body + * @return the JSon */ public static String dumpAsJSon(Message message, boolean includeBody) { return dumpAsJSon(message, includeBody, 0); @@ -821,10 +826,10 @@ public final class MessageHelper { /** * Dumps the message as a generic JSon structure. * - * @param message the message - * @param includeBody whether or not to include the message body - * @param indent number of spaces to indent - * @return the JSon + * @param message the message + * @param includeBody whether or not to include the message body + * @param indent number of spaces to indent + * @return the JSon */ public static String dumpAsJSon(Message message, boolean includeBody, int indent) { return dumpAsJSon(message, includeBody, indent, false, true, 128 * 1024, true); @@ -833,14 +838,14 @@ public final class MessageHelper { /** * Dumps the message as a generic JSon structure. * - * @param message the message - * @param includeBody whether or not to include the message body - * @param indent number of spaces to indent - * @param allowStreams whether to include message body if they are stream based - * @param allowFiles whether to include message body if they are file based - * @param maxChars clip body after maximum chars (to avoid very big messages). Use 0 or negative value to not - * limit at all. - * @return the JSon + * @param message the message + * @param includeBody whether or not to include the message body + * @param indent number of spaces to indent + * @param allowStreams whether to include message body if they are stream based + * @param allowFiles whether to include message body if they are file based + * @param maxChars clip body after maximum chars (to avoid very big messages). Use 0 or negative value to not + * limit at all. + * @return the JSon */ public static String dumpAsJSon( Message message, boolean includeBody, int indent, boolean allowStreams, boolean allowFiles, int maxChars, @@ -851,17 +856,17 @@ public final class MessageHelper { /** * Dumps the message as a generic JSon structure. * - * @param message the message - * @param includeExchangeProperties whether or not to include exchange properties - * @param includeBody whether or not to include the message body - * @param indent number of spaces to indent - * @param allowCachedStreams whether to include message body if they are stream cached based - * @param allowStreams whether to include message body if they are stream based - * @param allowFiles whether to include message body if they are file based - * @param maxChars clip body after maximum chars (to avoid very big messages). Use 0 or negative - * value to not limit at all. - * @param pretty whether to pretty print JSon - * @return the JSon + * @param message the message + * @param includeExchangeProperties whether or not to include exchange properties + * @param includeBody whether or not to include the message body + * @param indent number of spaces to indent + * @param allowCachedStreams whether to include message body if they are stream cached based + * @param allowStreams whether to include message body if they are stream based + * @param allowFiles whether to include message body if they are file based + * @param maxChars clip body after maximum chars (to avoid very big messages). Use 0 or negative + * value to not limit at all. + * @param pretty whether to pretty print JSon + * @return the JSon */ public static String dumpAsJSon( Message message, boolean includeExchangeProperties, boolean includeBody, int indent, @@ -879,12 +884,17 @@ public final class MessageHelper { if (includeExchangeProperties && message.getExchange().hasProperties()) { JsonArray arr = new JsonArray(); // sort the exchange properties so they are listed A..Z - Map<String, Object> properties = new TreeMap<>(message.getExchange().getProperties()); + Map<String, Object> properties = new TreeMap<>(message.getExchange().getAllProperties()); for (Map.Entry<String, Object> entry : properties.entrySet()) { Object value = entry.getValue(); String type = ObjectHelper.classCanonicalName(value); JsonObject jh = new JsonObject(); - jh.put("key", entry.getKey()); + String key = entry.getKey(); + // skip message history + if (Exchange.MESSAGE_HISTORY.equals(key)) { + continue; + } + jh.put("key", key); if (type != null) { jh.put("type", type); } @@ -974,8 +984,8 @@ public final class MessageHelper { /** * Dumps the exception as a generic XML structure. * - * @param indent number of spaces to indent - * @return the XML + * @param indent number of spaces to indent + * @return the XML */ public static String dumpExceptionAsXML(Throwable exception, int indent) { StringBuilder prefix = new StringBuilder(); @@ -1012,9 +1022,9 @@ public final class MessageHelper { /** * Dumps the exception as a generic JSon structure. * - * @param indent number of spaces to indent - * @param pretty whether to pretty print JSon - * @return the JSon + * @param indent number of spaces to indent + * @param pretty whether to pretty print JSon + * @return the JSon */ public static String dumpExceptionAsJSon(Throwable exception, int indent, boolean pretty) { JsonObject root = new JsonObject(); diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelTraceAction.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelTraceAction.java index 9d583d47798..66a1f40a7fd 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelTraceAction.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelTraceAction.java @@ -691,7 +691,7 @@ public class CamelTraceAction extends ActionBaseCommand { TableRow eRow = new TableRow("Exchange", r.message.getString("exchangeType"), null, null); String tab1 = AsciiTable.getTable(AsciiTable.NO_BORDERS, List.of(eRow), Arrays.asList( new Column().dataAlign(HorizontalAlign.LEFT) - .minWidth(showExchangeProperties ? 11 : 9).with(TableRow::kindAsString), + .minWidth(showExchangeProperties ? 12 : 10).with(TableRow::kindAsString), new Column().dataAlign(HorizontalAlign.LEFT).with(TableRow::typeAndLengthAsString))); // exchange properties JsonArray arr = r.message.getCollection("exchangeProperties"); @@ -701,13 +701,21 @@ public class CamelTraceAction extends ActionBaseCommand { rows.add(new TableRow("Property", jo.getString("type"), jo.getString("key"), jo.get("value"))); } } + // internal exchange properties + arr = r.message.getCollection("internalExchangeProperties"); + if (arr != null) { + for (Object o : arr) { + JsonObject jo = (JsonObject) o; + rows.add(new TableRow("Property", jo.getString("type"), jo.getString("key"), jo.get("value"))); + } + } String tab2 = AsciiTable.getTable(AsciiTable.NO_BORDERS, rows, Arrays.asList( new Column().dataAlign(HorizontalAlign.LEFT) .minWidth(showExchangeProperties ? 12 : 10).with(TableRow::kindAsString), new Column().dataAlign(HorizontalAlign.LEFT) - .maxWidth(40, OverflowBehaviour.ELLIPSIS_LEFT).with(TableRow::typeAsString), + .minWidth(25).maxWidth(40, OverflowBehaviour.CLIP_LEFT).with(TableRow::typeAsString), new Column().dataAlign(HorizontalAlign.RIGHT) - .maxWidth(40, OverflowBehaviour.NEWLINE).with(TableRow::keyAsString), + .minWidth(25).maxWidth(40, OverflowBehaviour.NEWLINE).with(TableRow::keyAsString), new Column().dataAlign(HorizontalAlign.LEFT) .maxWidth(80, OverflowBehaviour.NEWLINE).with(TableRow::valueAsString))); rows.clear(); @@ -730,9 +738,9 @@ public class CamelTraceAction extends ActionBaseCommand { new Column().dataAlign(HorizontalAlign.LEFT) .minWidth(showExchangeProperties ? 12 : 10).with(TableRow::kindAsString), new Column().dataAlign(HorizontalAlign.LEFT) - .maxWidth(40, OverflowBehaviour.ELLIPSIS_LEFT).with(TableRow::typeAsString), + .minWidth(25).maxWidth(40, OverflowBehaviour.CLIP_LEFT).with(TableRow::typeAsString), new Column().dataAlign(HorizontalAlign.RIGHT) - .maxWidth(40, OverflowBehaviour.NEWLINE).with(TableRow::keyAsString), + .minWidth(25).maxWidth(40, OverflowBehaviour.NEWLINE).with(TableRow::keyAsString), new Column().dataAlign(HorizontalAlign.LEFT) .maxWidth(80, OverflowBehaviour.NEWLINE).with(TableRow::valueAsString))); @@ -756,9 +764,10 @@ public class CamelTraceAction extends ActionBaseCommand { eRow = new TableRow("Exception", jo.getString("type"), null, jo.get("message")); tab7 = AsciiTable.getTable(AsciiTable.NO_BORDERS, List.of(eRow), Arrays.asList( new Column().dataAlign(HorizontalAlign.LEFT) - .minWidth(showExchangeProperties ? 12 : 10).with(TableRow::kindAsStringRed), + .minWidth(showExchangeProperties ? 12 : 10) + .with(TableRow::kindAsStringRed), new Column().dataAlign(HorizontalAlign.LEFT) - .maxWidth(40, OverflowBehaviour.ELLIPSIS_LEFT).with(TableRow::typeAsString), + .maxWidth(40, OverflowBehaviour.CLIP_LEFT).with(TableRow::typeAsString), new Column().dataAlign(HorizontalAlign.LEFT) .maxWidth(80, OverflowBehaviour.NEWLINE).with(TableRow::valueAsStringRed))); } @@ -939,6 +948,8 @@ public class CamelTraceAction extends ActionBaseCommand { String s; if (type == null) { s = "null"; + } else if (type.startsWith("java.util.concurrent")) { + s = type.substring(21); } else if (type.startsWith("java.lang.") || type.startsWith("java.util.")) { s = type.substring(10); } else { @@ -955,6 +966,8 @@ public class CamelTraceAction extends ActionBaseCommand { String s; if (type == null) { s = "null"; + } else if (type.startsWith("java.util.concurrent")) { + s = type.substring(21); } else if (type.startsWith("java.lang.") || type.startsWith("java.util.")) { s = type.substring(10); } else { diff --git a/tooling/camel-util-json/src/main/java/org/apache/camel/util/json/Jsoner.java b/tooling/camel-util-json/src/main/java/org/apache/camel/util/json/Jsoner.java index 0ddfd375442..d8533163ae8 100644 --- a/tooling/camel-util-json/src/main/java/org/apache/camel/util/json/Jsoner.java +++ b/tooling/camel-util-json/src/main/java/org/apache/camel/util/json/Jsoner.java @@ -918,7 +918,7 @@ public final class Jsoner { /* See StringWriter. */ } String answer = writableDestination.toString(); - if ("SerializationOptions.ALLOW_INVALIDS_NOOP".equals(answer)) { + if (answer != null && answer.contains("SerializationOptions.ALLOW_INVALIDS_NOOP")) { answer = null; } return answer;