You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2021/12/14 13:55:12 UTC

[activemq-artemis] 03/04: ARTEMIS-3570 do not try to use header fields when they are not even numeric

This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit dcd993d8e40de1ffe0d03e259afd021d37446e57
Author: Erwin Dondorp <er...@cgi.com>
AuthorDate: Sun Nov 14 22:50:15 2021 +0100

    ARTEMIS-3570 do not try to use header fields when they are not even numeric
---
 .../src/main/webapp/plugin/js/components/browse.js           | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/components/browse.js b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/components/browse.js
index 30dbbc2..8527b79 100644
--- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/components/browse.js
+++ b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/components/browse.js
@@ -465,7 +465,7 @@ var Artemis;
         }
 
         function formatExpires(timestamp) {
-             if (isNaN(timestamp)) {
+             if (isNaN(timestamp) || typeof timestamp !== "number") {
                 return timestamp;
              }
              if (timestamp == 0) {
@@ -488,7 +488,7 @@ var Artemis;
           }
 
           function formatTimestamp(timestamp) {
-             if (isNaN(timestamp)) {
+             if (isNaN(timestamp) || typeof timestamp !== "number") {
                 return timestamp;
              }
              var d = new Date(timestamp);
@@ -499,7 +499,7 @@ var Artemis;
 
         var typeLabels = ["default", "1", "object", "text", "bytes", "map", "stream", "embedded"];
         function formatType(type) {
-            if (isNaN(type)) {
+            if (isNaN(type) || typeof type !== "number") {
                 return type;
             }
             return type > -1 && type < 8 ? typeLabels[type] : type
@@ -507,7 +507,7 @@ var Artemis;
 
         var bindingTypeLabels = ["local-queue", "remote-queue", "divert"];
         function formatBindingType(type) {
-            if (isNaN(type)) {
+            if (isNaN(type) || typeof type !== "number") {
                 return type;
             }
             return type > -1 && type < 3 ? bindingTypeLabels[type] : type
@@ -526,7 +526,7 @@ var Artemis;
         }
 
         function formatPersistentSize(bytes) {
-            if(isNaN(bytes) || bytes < 0) return "n/a";
+            if(isNaN(bytes) || typeof bytes !== "number" || bytes < 0) return "n/a";
             if(bytes < 10240) return bytes.toLocaleString() + " Bytes";
             if(bytes < 1048576) return (bytes / 1024).toFixed(2) + " KB";
             if(bytes < 1073741824) return (bytes / 1048576).toFixed(2) + " MB";
@@ -820,7 +820,7 @@ var Artemis;
             "amqp-unknown", "amqp-null", "amqp-data", "amqp-sequence", "amqp-value-null",
             "amqp-value-string", "amqp-value-binary", "amqp-value-map", "amqp-value-list"];
         function formatAmqpEncoding(enc) {
-            if (isNaN(enc)) {
+            if (isNaN(enc) || typeof enc !== "number") {
                 return enc;
             }
             return enc > -1 && enc < 9 ? amqpEncodingLabels[enc] : enc;