smolnar82 commented on code in PR #1135:
URL: https://github.com/apache/knox/pull/1135#discussion_r2666156917
##########
gateway-server/src/main/java/org/apache/knox/gateway/util/TokenMigrationTool.java:
##########
@@ -184,13 +184,11 @@ private void archiveTokens(Map<String, TokenData>
tokenDataMap) throws AliasServ
log("Archiving token aliases in the " + cluster + " credential
store...");
final long start = System.currentTimeMillis();
final Map<String, String> tokenAliasesToArchive = new HashMap<>();
- tokenDataMap.entrySet().forEach(tokenDataMapEntry -> {
- String tokenId = tokenDataMapEntry.getKey();
- tokenDataMapEntry.getValue();
- tokenAliasesToArchive.put(tokenId,
String.valueOf(tokenDataMapEntry.getValue().expiration));
- tokenAliasesToArchive.put(tokenId + TOKEN_MAX_LIFETIME_POSTFIX,
String.valueOf(tokenDataMapEntry.getValue().maxLifeTime));
- tokenAliasesToArchive.put(tokenId + TOKEN_ISSUE_TIME_POSTFIX,
String.valueOf(tokenDataMapEntry.getValue().issueTime));
- tokenAliasesToArchive.put(tokenId + TOKEN_META_POSTFIX,
tokenDataMapEntry.getValue().metadata.toJSON());
+ tokenDataMap.forEach((tokenId, value) -> {
Review Comment:
PMD indicated the redundant `tokenDataMapEntry.getValue();` call in the old
189 line. I removed that.
My IDE also suggested the improvement of using Map's foreach directly
instead of iterating through its entryset, so I applied it too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]