From 2383d0f03bc60d05b23c1710959c54441e6f242f Mon Sep 17 00:00:00 2001 From: rishtigupta Date: Fri, 28 Jun 2024 09:22:53 -0700 Subject: [PATCH] fix: make runtimeVersion private final --- .../src/main/java/momento/sdk/UserHeaderInterceptor.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/momento-sdk/src/main/java/momento/sdk/UserHeaderInterceptor.java b/momento-sdk/src/main/java/momento/sdk/UserHeaderInterceptor.java index 63eb6556..dd43fe83 100644 --- a/momento-sdk/src/main/java/momento/sdk/UserHeaderInterceptor.java +++ b/momento-sdk/src/main/java/momento/sdk/UserHeaderInterceptor.java @@ -20,7 +20,7 @@ final class UserHeaderInterceptor implements ClientInterceptor { Metadata.Key.of("runtime-version", ASCII_STRING_MARSHALLER); private final String tokenValue; private final String sdkVersion; - String runtimeVer = System.getProperty("java.vendor") + ", " + System.getProperty("java.version"); + private final String runtimeVersion; private boolean isUserAgentSent = false; UserHeaderInterceptor(String token, String clientType) { @@ -28,6 +28,7 @@ final class UserHeaderInterceptor implements ClientInterceptor { sdkVersion = String.format( "java:%s:%s", clientType, this.getClass().getPackage().getImplementationVersion()); + runtimeVersion = System.getProperty("java.vendor") + ", " + System.getProperty("java.version"); } @Override @@ -40,7 +41,7 @@ public void start(Listener listener, Metadata metadata) { metadata.put(AUTH_HEADER_KEY, tokenValue); if (!isUserAgentSent) { metadata.put(SDK_AGENT_KEY, sdkVersion); - metadata.put(RUNTIME_VERSION_KEY, runtimeVer); + metadata.put(RUNTIME_VERSION_KEY, runtimeVersion); isUserAgentSent = true; } super.start(listener, metadata);