This is an automated email from the ASF dual-hosted git repository.
jmclean pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new 4789f4df7f [#7706] improvement: Reuse token in OAuth2TokenProvider’s
getTokenData method instead of calling getAccessToken twice (#7709)
4789f4df7f is described below
commit 4789f4df7fda383f0d6dc2ad777b1393e875e8fa
Author: arjun <[email protected]>
AuthorDate: Wed Jul 16 11:44:00 2025 +0530
[#7706] improvement: Reuse token in OAuth2TokenProvider’s getTokenData
method instead of calling getAccessToken twice (#7709)
### What changes were proposed in this pull request?
Instead of calling the `getAccessToken()` function twice, we store the
returned value in a variable and reuse it within the method.
### Why are the changes needed?
The previous approach was inefficient because it invoked the same
function twice. With this change, the function is called only once, and
the result is cached in a local variable, improving performance and
avoiding redundant method calls.
Fix: #7706
---
.../src/main/java/org/apache/gravitino/client/OAuth2TokenProvider.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/clients/client-java/src/main/java/org/apache/gravitino/client/OAuth2TokenProvider.java
b/clients/client-java/src/main/java/org/apache/gravitino/client/OAuth2TokenProvider.java
index 0c7dfa0788..3b421a44b9 100644
---
a/clients/client-java/src/main/java/org/apache/gravitino/client/OAuth2TokenProvider.java
+++
b/clients/client-java/src/main/java/org/apache/gravitino/client/OAuth2TokenProvider.java
@@ -58,7 +58,7 @@ public abstract class OAuth2TokenProvider implements
AuthDataProvider {
if (accessToken == null) {
return null;
}
- return (AuthConstants.AUTHORIZATION_BEARER_HEADER + getAccessToken())
+ return (AuthConstants.AUTHORIZATION_BEARER_HEADER + accessToken)
.getBytes(StandardCharsets.UTF_8);
}