Ignore:
Timestamp:
2015-12-31T03:24:56+01:00 (10 years ago)
Author:
Don-vip
Message:

OAuth: add robustness, basic unit test, code cleanup

Location:
trunk/src/org/openstreetmap/josm/gui/oauth
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/oauth/OsmLoginFailedException.java

    r8510 r9227  
    22package org.openstreetmap.josm.gui.oauth;
    33
     4/**
     5 * OSM login failure exception.
     6 * @since 2746
     7 */
    48public class OsmLoginFailedException extends OsmOAuthAuthorizationException {
    59
    6     public OsmLoginFailedException() {
    7         super();
    8     }
    9 
    10     public OsmLoginFailedException(String arg0, Throwable arg1) {
    11         super(arg0, arg1);
    12     }
    13 
    14     public OsmLoginFailedException(String arg0) {
    15         super(arg0);
    16     }
    17 
    18     public OsmLoginFailedException(Throwable arg0) {
    19         super(arg0);
     10    /**
     11     * Constructs a new {@code OsmLoginFailedException} with the specified cause.
     12     * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method).
     13     */
     14    public OsmLoginFailedException(Throwable cause) {
     15        super(cause);
    2016    }
    2117}
  • trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java

    r9172 r9227  
    5050        private String token;
    5151        private String userName;
    52     }
    53 
    54     /**
    55      * Creates a new authorisation client with default OAuth parameters
    56      *
    57      */
    58     public OsmOAuthAuthorizationClient() {
    59         oauthProviderParameters = OAuthParameters.createDefault(Main.pref.get("osm-server.url"));
    60         consumer = oauthProviderParameters.buildConsumer();
    61         provider = oauthProviderParameters.buildProvider(consumer);
    6252    }
    6353
     
    241231    }
    242232
    243     protected String buildPostRequest(Map<String, String> parameters) throws OsmOAuthAuthorizationException {
     233    protected static String buildPostRequest(Map<String, String> parameters) {
    244234        StringBuilder sb = new StringBuilder(32);
    245235
     
    322312     * Submits a request to the OSM website for a OAuth form. The OSM website replies a session token in
    323313     * a hidden parameter.
     314     * @param sessionId session id
     315     * @param requestToken request token
    324316     *
    325317     * @throws OsmOAuthAuthorizationException if something went wrong
  • trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationException.java

    r3083 r9227  
    22package org.openstreetmap.josm.gui.oauth;
    33
     4/**
     5 * OSM OAuth authorization exception.
     6 * @since 2746
     7 */
    48public class OsmOAuthAuthorizationException extends Exception {
    59
    6     public OsmOAuthAuthorizationException() {
    7         super();
     10    /**
     11     * Constructs a new {@code OsmLoginFailedException} with the specified detail message.
     12     * @param message the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method.
     13     */
     14    public OsmOAuthAuthorizationException(String message) {
     15        super(message);
    816    }
    917
    10     public OsmOAuthAuthorizationException(String arg0, Throwable arg1) {
    11         super(arg0, arg1);
    12     }
    13 
    14     public OsmOAuthAuthorizationException(String arg0) {
    15         super(arg0);
    16     }
    17 
    18     public OsmOAuthAuthorizationException(Throwable arg0) {
    19         super(arg0);
     18    /**
     19     * Constructs a new {@code OsmLoginFailedException} with the specified cause.
     20     * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method).
     21     */
     22    public OsmOAuthAuthorizationException(Throwable cause) {
     23        super(cause);
    2024    }
    2125}
Note: See TracChangeset for help on using the changeset viewer.