You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2022/12/21 09:23:26 UTC

[GitHub] [cloudstack] DaanHoogland commented on a diff in pull request #7008: utils: fix human-readable parsing failures

DaanHoogland commented on code in PR #7008:
URL: https://github.com/apache/cloudstack/pull/7008#discussion_r1054161000


##########
utils/src/main/java/com/cloud/utils/HumanReadableJson.java:
##########
@@ -64,11 +65,13 @@ private void addElement(String content) {
             firstElement = false;
         }
         if (jsonElement.isJsonPrimitive()) {
+            String changedValue = jsonElement.getAsString();
             if (changeValue) {
-                output.append("\"" + toHumanReadableSize(jsonElement.getAsLong()) + "\"");
-            } else {
-                output.append("\"" + jsonElement.getAsString() + "\"");
+                try {
+                    changedValue = toHumanReadableSize(jsonElement.getAsLong());
+                } catch (NumberFormatException ignored) {}

Review Comment:
   I would like this logged, not ignored



-- 
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: commits-unsubscribe@cloudstack.apache.org

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