You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2022/02/10 17:32:09 UTC

[GitHub] [activemq-artemis] jbertram commented on a change in pull request #3948: ARTEMIS-3677 mitigate NPE when browsing messages

jbertram commented on a change in pull request #3948:
URL: https://github.com/apache/activemq-artemis/pull/3948#discussion_r803931330



##########
File path: artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JsonUtil.java
##########
@@ -338,6 +338,9 @@ public static String truncateString(final String str, final int valueSizeLimit)
    }
 
    public static Object truncate(final Object value, final int valueSizeLimit) {
+      if (value == null) {
+         return "";

Review comment:
       This method is used to deal with message data which is sent back to the web console for visual inspection. Given that it didn't handle `null` property values properly means that the web console wasn't actually getting any `null` property values either so it wasn't clear to me that it could actually handle them. I didn't want to fix this NPE only to create another one somewhere else.
   
   Also, there was a precedent for using a blank string for a `null` value already in `org.apache.activemq.artemis.core.message.impl.CoreMessage.TextMessageOpenTypeFactory#getFields`. I decided to carry that behavior forward here.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org