Changeset 18662 in josm


Ignore:
Timestamp:
2023-02-14T15:21:54+01:00 (2 years ago)
Author:
taylor.smock
Message:

Fix #22744, see #20768: Fix NPE when switching to authentication methods

The NPE occurs because the UI state and the saved preferences state does not
match. This is solved by saving the state to preferences and then reloading it.

This also fixes an issue where the http2 plugin would prevent the OAuth
workflow from working, due to differing default behaviors (see #22730).

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/oauth/OAuth20Authorization.java

    r18650 r18662  
    9393                        + (this.codeVerifier != null ? "&code_verifier=" + this.codeVerifier : "")
    9494                ).getBytes(StandardCharsets.UTF_8));
     95                tradeCodeForToken.setHeader("Content-Type", "application/x-www-form-urlencoded");
    9596                try {
    9697                    tradeCodeForToken.connect();
  • trunk/src/org/openstreetmap/josm/gui/preferences/server/AuthenticationPreferencesPanel.java

    r18650 r18662  
    180180            } else if (rbOAuth.isSelected()) {
    181181                pnlAuthenticationParameters.add(pnlOAuthPreferences, BorderLayout.CENTER);
     182                pnlOAuthPreferences.saveToPreferences();
     183                pnlOAuthPreferences.initFromPreferences();
    182184                pnlOAuthPreferences.revalidate();
    183185            } else if (rbOAuth20.isSelected()) {
    184186                pnlAuthenticationParameters.add(pnlOAuth20Preferences, BorderLayout.CENTER);
     187                pnlOAuth20Preferences.saveToPreferences();
     188                pnlOAuth20Preferences.initFromPreferences();
    185189                pnlOAuth20Preferences.revalidate();
    186190            }
Note: See TracChangeset for help on using the changeset viewer.