From 60af09d28037cccd7e5c48de48eb95314bf754e9 Mon Sep 17 00:00:00 2001 From: Roger Floriano <31597636+petruki@users.noreply.github.com> Date: Sat, 27 Jun 2026 15:21:49 -0700 Subject: [PATCH 1/2] fix: registerSwitcherKeys to load contextBase from location (#395) * chore(deps): bump test and plugins deps * fix(test): force context init * Revert "fix(test): force context init" This reverts commit 727e19e655a3d13c3b04cc31e91ce7899a9b7518. * chore: added debug logs for registerSwitcherKey * chore: added debug logs for registerSwitcherKey #2 * fix: registerSwitcherKeys to load contextBase from location --- .../com/switcherapi/client/SwitcherContextBase.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/switcherapi/client/SwitcherContextBase.java b/src/main/java/com/switcherapi/client/SwitcherContextBase.java index 83a6bed..126eb0f 100644 --- a/src/main/java/com/switcherapi/client/SwitcherContextBase.java +++ b/src/main/java/com/switcherapi/client/SwitcherContextBase.java @@ -230,11 +230,13 @@ private static void validateContext() throws SwitcherContextException { * Register Switcher Keys based on context properties */ private static void registerSwitcherKeys() { - if (Objects.nonNull(contextBase)) { + final String contextLocation = contextStr(ContextKey.CONTEXT_LOCATION); + + if (Objects.nonNull(contextBase) && contextBase.getClass().getName().equals(contextLocation)) { registerSwitcherKey(contextBase.getClass().getFields()); } else { try { - final Class clazz = Class.forName(contextStr(ContextKey.CONTEXT_LOCATION)); + final Class clazz = Class.forName(contextLocation); registerSwitcherKey(clazz.getFields()); } catch(ClassNotFoundException e){ throw new SwitcherContextException(e.getMessage()); @@ -250,10 +252,14 @@ private static void registerSwitcherKeys() { private static void registerSwitcherKey(Field[] fields) { Set switcherKeys = new HashSet<>(); + SwitcherUtils.debug(logger, "Registering Switcher Keys from context: {}", contextStr(ContextKey.CONTEXT_LOCATION)); + SwitcherUtils.debug(logger, "Found {} fields in context class", fields.length); for (Field field : fields) { if (field.isAnnotationPresent(SwitcherKey.class)) { try { - switcherKeys.add(field.get(null).toString()); + final String keyFound = field.get(null).toString(); + SwitcherUtils.debug(logger, "Found Switcher Key: {} in field: {}", keyFound, field.getName()); + switcherKeys.add(keyFound); } catch (Exception e) { throw new SwitcherContextException( String.format("Error retrieving Switcher Key value from field %s", field.getName())); From fb604bbbeb5d4c1068b829315cdd6538e3cca7be Mon Sep 17 00:00:00 2001 From: petruki <31597636+petruki@users.noreply.github.com> Date: Sat, 27 Jun 2026 15:28:44 -0700 Subject: [PATCH 2/2] chore(deps): bump test and plugins deps --- .github/workflows/sonar.yml | 2 +- pom.xml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index 1759faf..0347aac 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Get PR details id: pr - uses: actions/github-script@v7 + uses: actions/github-script@v9 with: script: | const pr = await github.rest.pulls.get({ diff --git a/pom.xml b/pom.xml index 16f092c..bcd322c 100644 --- a/pom.xml +++ b/pom.xml @@ -64,7 +64,7 @@ 2.0.18 - 5.3.2 + 5.4.0 5.14.4 1.9.1 1.14.4 @@ -73,11 +73,11 @@ 3.15.0 3.4.0 3.12.0 - 3.5.5 + 3.5.6 3.2.8 - 5.6.0.6792 - 0.8.14 - 0.10.0 + 5.7.0.6970 + 0.8.15 + 0.11.0 jacoco