From ede0c545661df38471edb8ac074a7f039a4189b1 Mon Sep 17 00:00:00 2001 From: Jonathan Breedlove Date: Fri, 22 Nov 2024 09:14:41 -0800 Subject: [PATCH] Fix deser bug on ssoTokenChanged events (#258) --- .../eclipse/amazonq/lsp/AmazonQLspClientImpl.java | 2 +- .../amazonq/lsp/auth/model/SsoTokenChangedKind.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/plugin/src/software/aws/toolkits/eclipse/amazonq/lsp/AmazonQLspClientImpl.java b/plugin/src/software/aws/toolkits/eclipse/amazonq/lsp/AmazonQLspClientImpl.java index 183d131b3..f385dec99 100644 --- a/plugin/src/software/aws/toolkits/eclipse/amazonq/lsp/AmazonQLspClientImpl.java +++ b/plugin/src/software/aws/toolkits/eclipse/amazonq/lsp/AmazonQLspClientImpl.java @@ -151,7 +151,7 @@ public final CompletableFuture showDocument(final ShowDocume @Override public final void ssoTokenChanged(final SsoTokenChangedParams params) { - SsoTokenChangedKind kind = SsoTokenChangedKind.valueOf(params.kind()); + SsoTokenChangedKind kind = SsoTokenChangedKind.fromValue(params.kind()); Activator.getLogger().info("Processing " + kind + "ssoTokenChanged notification..."); try { diff --git a/plugin/src/software/aws/toolkits/eclipse/amazonq/lsp/auth/model/SsoTokenChangedKind.java b/plugin/src/software/aws/toolkits/eclipse/amazonq/lsp/auth/model/SsoTokenChangedKind.java index 8124633ee..d29664410 100644 --- a/plugin/src/software/aws/toolkits/eclipse/amazonq/lsp/auth/model/SsoTokenChangedKind.java +++ b/plugin/src/software/aws/toolkits/eclipse/amazonq/lsp/auth/model/SsoTokenChangedKind.java @@ -13,6 +13,15 @@ public enum SsoTokenChangedKind { this.value = value; } + public static SsoTokenChangedKind fromValue(final String value) { + for (SsoTokenChangedKind kind : values()) { + if (kind.getValue().equalsIgnoreCase(value)) { + return kind; + } + } + throw new IllegalArgumentException("No enum constant " + SsoTokenChangedKind.class.getSimpleName() + " with value " + value); + } + public String getValue() { return this.value; }