Ticket #11914: 11914.3.patch

File 11914.3.patch, 2.2 KB (added by GerdP, 2 months ago)
  • 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        purgeCredentialsCache(requestorType); // see #11914
    134135        delegate.store(requestorType, host, credentials);
    135136    }
    136137
     
    137138    @Override
    138139    public CredentialsAgentResponse getCredentials(RequestorType requestorType, String host, boolean noSuccessWithLastResponse)
    139140            throws CredentialsAgentException {
    140         return delegate.getCredentials(requestorType, host, noSuccessWithLastResponse);
     141        CredentialsAgentResponse credentials = delegate.getCredentials(requestorType, host, noSuccessWithLastResponse);
     142        if (requestorType == RequestorType.SERVER) {
     143            // see #11914
     144            String userName = credentials.getUsername();
     145            userName = userName == null ? "" : userName.trim();
     146            if (!Objects.equals(UserIdentityManager.getInstance().getUserName(), userName)) {
     147                if (userName.isEmpty())
     148                    UserIdentityManager.getInstance().setAnonymous();
     149                else
     150                    UserIdentityManager.getInstance().setPartiallyIdentified(userName);
     151            }
     152        }
     153        return credentials;
    141154    }
    142155
    143156    @Override