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 2021/03/15 18:13:43 UTC

[GitHub] [activemq-artemis] michaelandrepearce commented on a change in pull request #3490: ARTEMIS-3175 - implement address setting management-message-attributeā€¦

michaelandrepearce commented on a change in pull request #3490:
URL: https://github.com/apache/activemq-artemis/pull/3490#discussion_r594574442



##########
File path: artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java
##########
@@ -726,20 +728,44 @@ default long getWholeMessageSize() {
 
    /**
     * @return Returns the message properties in Map form, useful when encoding to JSON
+    * @param valueSizeLimit
     */
-   default Map<String, Object> toPropertyMap() {
+   default Map<String, Object> toPropertyMap(int valueSizeLimit) {
       Map map = new HashMap<>();
       for (SimpleString name : getPropertyNames()) {
          Object value = getObjectProperty(name.toString());
          //some property is SimpleString, which is not available for management console
          if (value instanceof SimpleString) {
             value = value.toString();
          }
+         value = truncate(value, valueSizeLimit);
          map.put(name.toString(), value);
       }
       return map;
    }
 
+   static Object truncate(final Object value, final int valueSizeLimit) {
+      Object result = value;
+      if (valueSizeLimit > 0) {

Review comment:
       I would expect truncate 0 to give me zero, normally expect to not truncate or unlimited to be denoted by -1




----------------------------------------------------------------
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.

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