From 3f66dd35c110be810fde96c0a117fdc7d1f8794a Mon Sep 17 00:00:00 2001 From: Tadayoshi Sato Date: Thu, 16 Nov 2023 11:13:55 +0900 Subject: [PATCH] fix(jmx,camel): fix Operations tab crashes when used with Camel JBang Fix #670 --- packages/hawtio/src/plugins/shared/jolokia-service.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/hawtio/src/plugins/shared/jolokia-service.ts b/packages/hawtio/src/plugins/shared/jolokia-service.ts index f9d480c5..b5e1710d 100644 --- a/packages/hawtio/src/plugins/shared/jolokia-service.ts +++ b/packages/hawtio/src/plugins/shared/jolokia-service.ts @@ -65,7 +65,7 @@ export enum JolokiaListMethod { */ const OPTIMISED_JOLOKIA_LIST_MBEAN = 'hawtio:type=security,name=RBACRegistry' -const OPTIMISED_JOLOKIA_LIST_MAX_DEPTH = 9 +const JOLOKIA_LIST_MAX_DEPTH = 9 export type OptimisedListResponse = { cache: OptimisedMBeanInfoCache @@ -461,6 +461,9 @@ class JolokiaService implements IJolokiaService { ajaxError?.(xhr, text, error) reject(error) } + // Overwrite max depth as listing MBeans requires some constant depth to work + // See: https://github.com/hawtio/hawtio-next/issues/670 + options.maxDepth = JOLOKIA_LIST_MAX_DEPTH switch (method) { case JolokiaListMethod.OPTIMISED: { log.debug('Invoke Jolokia list MBean in optimised mode:', paths) @@ -478,9 +481,6 @@ class JolokiaService implements IJolokiaService { }, options as BaseRequestOptions, ) - // Overwrite max depth as listing MBeans requires some constant depth to work - // TODO: Is this needed? - execOptions.maxDepth = OPTIMISED_JOLOKIA_LIST_MAX_DEPTH if (paths.length === 0) { jolokia.execute(mbean, 'list()', execOptions) } else if (paths.length === 1) {