[ 
https://issues.apache.org/jira/browse/KNOX-3236?focusedWorklogId=998859&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-998859
 ]

ASF GitHub Bot logged work on KNOX-3236:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 06/Jan/26 20:12
            Start Date: 06/Jan/26 20:12
    Worklog Time Spent: 10m 
      Work Description: 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.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 998859)
    Time Spent: 1h 50m  (was: 1h 40m)

> Upgrade Maven PMD plugin to 3.28.0
> ----------------------------------
>
>                 Key: KNOX-3236
>                 URL: https://issues.apache.org/jira/browse/KNOX-3236
>             Project: Apache Knox
>          Issue Type: Task
>          Components: Build
>    Affects Versions: 2.1.0, 3.0.0
>            Reporter: Sandor Molnar
>            Assignee: Sandor Molnar
>            Priority: Critical
>             Fix For: 3.0.0
>
>         Attachments: image-2026-01-06-13-56-44-933.png
>
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> I noticed that my build occasionally hanging here:
> {code:java}
> [INFO] --- pmd:3.26.0:pmd (pmd) @ gateway-provider-security-shiro ---
> [INFO] PMD version: 7.7.0 {code}
> The last time it happened I got a thread dump (see attachment) which 
> confirmed my suspicion that PMD indeed has an intermittent issue running on 
> multiple threads.
> I also found this bug of theirs: [https://github.com/pmd/pmd/issues/5293]
> So, I checked and found that the latest Maven PMD plugin version, 3.28.0, 
> comes with PMD 7.17.0, where this issue is resolved.
> !image-2026-01-06-13-56-44-933.png|height=400!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to