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

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


The following commit(s) were added to refs/heads/main by this push:
     new 4dd643c  ARTEMIS-3466 byte arrays can have negative hex numbers in web 
console
     new 10cf415  This closes #3735
4dd643c is described below

commit 4dd643cbece19e2f9f06e246403bfade784a582d
Author: Justin Bertram <[email protected]>
AuthorDate: Thu Sep 9 14:19:01 2021 -0500

    ARTEMIS-3466 byte arrays can have negative hex numbers in web console
---
 .../src/main/webapp/plugin/js/components/browse.js         | 14 ++++++++------
 1 file changed, 8 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 ea416be..4874e8c 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
@@ -746,12 +746,14 @@ var Artemis;
                             textArr.push(String.fromCharCode(b));
                         }
                         if (code === 1 || code === 4) {
-                        // hex and must be 2 digit so they space out evenly
-                        var s = b.toString(16);
-                        if (s.length === 1) {
-                            s = "0" + s;
-                        }
-                        bytesArr.push(s);
+                            var unsignedByte = b & 0xff;
+
+                            if (unsignedByte < 16) {
+                                // hex and must be 2 digit so they space out 
evenly
+                                bytesArr.push('0' + unsignedByte.toString(16));
+                            } else {
+                                bytesArr.push(unsignedByte.toString(16));
+                            }
                         } else {
                             // just show as is without spacing out, as that is 
usually more used for hex than decimal
                             var s = b.toString(10);

Reply via email to