Ignore:
Timestamp:
2017-11-28T00:56:29+01:00 (6 years ago)
Author:
Don-vip
Message:

see #15310 - remove most of deprecated APIs

File:
1 edited

Legend:

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

    r12928 r13173  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import org.openstreetmap.josm.data.Preferences;
    76import org.openstreetmap.josm.io.auth.CredentialsAgent;
    87import org.openstreetmap.josm.io.auth.CredentialsAgentException;
     
    165164
    166165    /**
    167      * Initializes the content of this holder from the Access Token managed by the
    168      * credential manager.
    169      *
    170      * @param pref the preferences. Must not be null.
    171      * @param cm the credential manager. Must not be null.
    172      * @throws IllegalArgumentException if cm is null
    173      * @deprecated (since 12928) replaced by {@link #init(org.openstreetmap.josm.io.auth.CredentialsAgent)}
    174      */
    175     @Deprecated
    176     public void init(Preferences pref, CredentialsAgent cm) {
    177         CheckParameterUtil.ensureParameterNotNull(pref, "pref");
    178         CheckParameterUtil.ensureParameterNotNull(cm, "cm");
    179         OAuthToken token = null;
    180         try {
    181             token = cm.lookupOAuthAccessToken();
    182         } catch (CredentialsAgentException e) {
    183             Logging.error(e);
    184             Logging.warn(tr("Failed to retrieve OAuth Access Token from credential manager"));
    185             Logging.warn(tr("Current credential manager is of type ''{0}''", cm.getClass().getName()));
    186         }
    187         saveToPreferences = pref.getBoolean("oauth.access-token.save-to-preferences", true);
    188         if (token != null) {
    189             accessTokenKey = token.getKey();
    190             accessTokenSecret = token.getSecret();
    191         }
    192     }
    193 
    194     /**
    195166     * Saves the content of this holder to the preferences and a credential store managed
    196167     * by a credential manager.
     
    216187
    217188    /**
    218      * Saves the content of this holder to the preferences and a credential store managed
    219      * by a credential manager.
    220      *
    221      * @param preferences the preferences. Must not be null.
    222      * @param cm the credentials manager. Must not be null.
    223      * @throws IllegalArgumentException if preferences is null
    224      * @throws IllegalArgumentException if cm is null
    225      * @deprecated (since 12928) replaced by {@link #save(org.openstreetmap.josm.io.auth.CredentialsAgent)}
    226      */
    227     @Deprecated
    228     public void save(Preferences preferences, CredentialsAgent cm) {
    229         CheckParameterUtil.ensureParameterNotNull(preferences, "preferences");
    230         CheckParameterUtil.ensureParameterNotNull(cm, "cm");
    231         preferences.putBoolean("oauth.access-token.save-to-preferences", saveToPreferences);
    232         try {
    233             if (!saveToPreferences) {
    234                 cm.storeOAuthAccessToken(null);
    235             } else {
    236                 cm.storeOAuthAccessToken(new OAuthToken(accessTokenKey, accessTokenSecret));
    237             }
    238         } catch (CredentialsAgentException e) {
    239             Logging.error(e);
    240             Logging.warn(tr("Failed to store OAuth Access Token to credentials manager"));
    241             Logging.warn(tr("Current credential manager is of type ''{0}''", cm.getClass().getName()));
    242         }
    243     }
    244 
    245     /**
    246189     * Clears the content of this holder
    247190     */
Note: See TracChangeset for help on using the changeset viewer.