Ticket #11914: 11914.4.patch

File 11914.4.patch, 2.3 KB (added by GerdP, 2 months ago)

improve comments

  • eclipse/JOSM

     
    1212<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.openstreetmap.josm.gui.MainApplication"/>
    1313<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--debug"/>
    1414<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="JOSM"/>
    15 <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xverify:none"/>
     15<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xverify:none -Xmx2G"/>
    1616</launchConfiguration>
  • src/org/openstreetmap/josm/io/auth/CredentialsManager.java

     
    131131                UserIdentityManager.getInstance().setPartiallyIdentified(username);
    132132            }
    133133        }
     134        // see #11914: clear cache before we store new value
     135        purgeCredentialsCache(requestorType);
    134136        delegate.store(requestorType, host, credentials);
    135137    }
    136138
     
    137139    @Override
    138140    public CredentialsAgentResponse getCredentials(RequestorType requestorType, String host, boolean noSuccessWithLastResponse)
    139141            throws CredentialsAgentException {
    140         return delegate.getCredentials(requestorType, host, noSuccessWithLastResponse);
     142        CredentialsAgentResponse credentials = delegate.getCredentials(requestorType, host, noSuccessWithLastResponse);
     143        if (requestorType == RequestorType.SERVER) {
     144            // see #11914 : Keep UserIdentityManager up to date
     145            String userName = credentials.getUsername();
     146            userName = userName == null ? "" : userName.trim();
     147            if (!Objects.equals(UserIdentityManager.getInstance().getUserName(), userName)) {
     148                if (userName.isEmpty())
     149                    UserIdentityManager.getInstance().setAnonymous();
     150                else
     151                    UserIdentityManager.getInstance().setPartiallyIdentified(userName);
     152            }
     153        }
     154        return credentials;
    141155    }
    142156
    143157    @Override