actinium15 commented on a change in pull request #55:
URL: 
https://github.com/apache/sling-org-apache-sling-distribution-core/pull/55#discussion_r707371685



##########
File path: 
src/main/java/org/apache/sling/distribution/queue/DistributionQueueItem.java
##########
@@ -64,7 +67,25 @@ public long getSize() {
     public String toString() {
         return "DistributionQueueItem{" +
                 "id='" + packageId + '\'' +
-                ", info=" + super.toString() +
+                ", info={" + queueInfo(base) + '}' +
                 '}';
     }
+
+    /*
+     * convert the map of object values into string form
+     */
+    private String queueInfo(Map<String, Object> base) {
+        String queueItem = "";
+        for(String key : base.keySet()) {
+            Object value = base.get(key);
+            String valueString = "";
+            if (value instanceof String[]) {
+                valueString = key + "=" + Arrays.toString((String[])value);

Review comment:
       ```suggestion
               if (value.getClass().isArray()) {
                   valueString = key + "=" + Arrays.toString((Object[])value);
   ```

##########
File path: 
src/main/java/org/apache/sling/distribution/queue/DistributionQueueItem.java
##########
@@ -44,7 +47,7 @@ public DistributionQueueItem(String packageId, long size, 
Map<String, Object> ba
         super(base);
         this.packageId = packageId;
         this.size = size;
-
+        this.base = base;

Review comment:
       I think we shouldn't keep this field because
   1. it is unnecessary
   2. it is possible to invoke `.put` directly on `this` because it extends 
`ValueMapDecorator`, which can make `base` out of sync with what's there in 
`DistributionQueueItem` object

##########
File path: 
src/main/java/org/apache/sling/distribution/queue/DistributionQueueItem.java
##########
@@ -64,7 +67,25 @@ public long getSize() {
     public String toString() {
         return "DistributionQueueItem{" +
                 "id='" + packageId + '\'' +
-                ", info=" + super.toString() +
+                ", info={" + queueInfo(base) + '}' +
                 '}';
     }
+
+    /*
+     * convert the map of object values into string form
+     */
+    private String queueInfo(Map<String, Object> base) {
+        String queueItem = "";

Review comment:
       ```suggestion
           String queueItemStr = "";
   ```




-- 
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: dev-unsubscr...@sling.apache.org

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


Reply via email to