Ignore:
Timestamp:
2015-06-20T23:42:21+02:00 (9 years ago)
Author:
Don-vip
Message:

checkstyle: enable relevant whitespace checks and fix them

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

Legend:

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

    r6890 r8510  
    3434        gc.fill = GridBagConstraints.HORIZONTAL;
    3535        gc.weightx = 0.0;
    36         gc.insets = new Insets(0,0,3,3);
     36        gc.insets = new Insets(0, 0, 3, 3);
    3737        add(new JLabel(tr("Access Token Key:")), gc);
    3838
     
    4646        gc.gridy = 1;
    4747        gc.weightx = 0.0;
    48         gc.insets = new Insets(0,0,3,3);
     48        gc.insets = new Insets(0, 0, 3, 3);
    4949        add(new JLabel(tr("Access Token Secret:")), gc);
    5050
  • trunk/src/org/openstreetmap/josm/gui/oauth/AdvancedOAuthPropertiesPanel.java

    r8444 r8510  
    5353    protected final void build() {
    5454        setLayout(new GridBagLayout());
    55         setBorder(BorderFactory.createEmptyBorder(3,3,3,3));
     55        setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    5656        GridBagConstraints gc = new GridBagConstraints();
    5757
     
    5959        gc.fill = GridBagConstraints.HORIZONTAL;
    6060        gc.weightx = 1.0;
    61         gc.insets = new Insets(0,0, 3, 3);
     61        gc.insets = new Insets(0, 0, 3, 3);
    6262        gc.gridwidth = 2;
    6363        cbUseDefaults = new JCheckBox(tr("Use default settings"));
     
    177177    }
    178178
    179     protected void setChildComponentsEnabled(boolean enabled){
     179    protected void setChildComponentsEnabled(boolean enabled) {
    180180        for (Component c: getComponents()) {
    181181            if (c instanceof JosmTextField || c instanceof JLabel) {
  • trunk/src/org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUI.java

    r8509 r8510  
    8686        VerticallyScrollablePanel pnl = new VerticallyScrollablePanel(new GridBagLayout());
    8787        GridBagConstraints gc = new GridBagConstraints();
    88         pnl.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
     88        pnl.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    8989
    9090        gc.anchor = GridBagConstraints.NORTHWEST;
     
    9393        gc.gridwidth = 2;
    9494        HtmlPanel pnlMessage = new HtmlPanel();
    95         HTMLEditorKit kit = (HTMLEditorKit)pnlMessage.getEditorPane().getEditorKit();
     95        HTMLEditorKit kit = (HTMLEditorKit) pnlMessage.getEditorPane().getEditorKit();
    9696        kit.getStyleSheet().addRule(
    97                 ".warning-body {background-color:rgb(253,255,221);padding: 10pt; border-color:rgb(128,128,128);border-style: solid;border-width: 1px;}");
     97                ".warning-body {background-color:rgb(253,255,221);padding: 10pt; " +
     98                "border-color:rgb(128,128,128);border-style: solid;border-width: 1px;}");
    9899        kit.getStyleSheet().addRule("ol {margin-left: 1cm}");
    99100        pnlMessage.setText("<html><body><p class=\"warning-body\">"
     
    111112        gc.fill = GridBagConstraints.HORIZONTAL;
    112113        gc.weightx = 0.0;
    113         gc.insets = new Insets(0,0,3,3);
     114        gc.insets = new Insets(0, 0, 3, 3);
    114115        pnl.add(new JLabel(tr("Username: ")), gc);
    115116
     
    143144        gc.gridwidth = 2;
    144145        pnlMessage = new HtmlPanel();
    145         kit = (HTMLEditorKit)pnlMessage.getEditorPane().getEditorKit();
     146        kit = (HTMLEditorKit) pnlMessage.getEditorPane().getEditorKit();
    146147        kit.getStyleSheet().addRule(
    147                 ".warning-body {background-color:rgb(253,255,221);padding: 10pt; border-color:rgb(128,128,128);border-style: solid;border-width: 1px;}");
     148                ".warning-body {background-color:rgb(253,255,221);padding: 10pt; " +
     149                "border-color:rgb(128,128,128);border-style: solid;border-width: 1px;}");
    148150        kit.getStyleSheet().addRule("ol {margin-left: 1cm}");
    149151        pnlMessage.setText("<html><body>"
     
    197199                tfPassword.setText(pa.getPassword() == null ? "" : String.valueOf(pa.getPassword()));
    198200            }
    199         } catch(CredentialsAgentException e) {
     201        } catch (CredentialsAgentException e) {
    200202            Main.error(e);
    201203            tfUserName.setText("");
     
    212214        JPanel pnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
    213215
    214         RunAuthorisationAction runAuthorisationAction= new RunAuthorisationAction();
     216        RunAuthorisationAction runAuthorisationAction = new RunAuthorisationAction();
    215217        tfPassword.getDocument().addDocumentListener(runAuthorisationAction);
    216218        tfUserName.getDocument().addDocumentListener(runAuthorisationAction);
     
    227229        JPanel pnl = new JPanel(new GridBagLayout());
    228230        GridBagConstraints gc = new GridBagConstraints();
    229         pnl.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
     231        pnl.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    230232
    231233        // the message panel
     
    240242                + "Click on <strong>{0}</strong> to accept the token. JOSM will use it in "
    241243                + "subsequent requests to gain access to the OSM API."
    242                 + "</html>",lbl));
     244                + "</html>", lbl));
    243245        pnl.add(msg, gc);
    244246
    245247        // infos about the access token
    246248        gc.gridy = 1;
    247         gc.insets = new Insets(5,0,0,0);
     249        gc.insets = new Insets(5, 0, 0, 0);
    248250        pnl.add(pnlAccessTokenInfo = new AccessTokenInfoPanel(), gc);
    249251
     
    495497            try {
    496498                loginUrl = authClient.buildOsmLoginUrl();
    497             } catch(OsmOAuthAuthorizationException e1) {
     499            } catch (OsmOAuthAuthorizationException e1) {
    498500                alertInvalidLoginUrl();
    499501                return;
     
    520522                public void run() {
    521523                    if (e instanceof OsmLoginFailedException) {
    522                         alertLoginFailed((OsmLoginFailedException)e);
     524                        alertLoginFailed((OsmLoginFailedException) e);
    523525                    } else {
    524526                        alertAuthorisationFailed(e);
     
    541543                );
    542544                getProgressMonitor().worked(1);
    543                 if (canceled)return;
     545                if (canceled) return;
    544546                authClient.authorise(
    545547                        requestToken,
     
    550552                );
    551553                getProgressMonitor().worked(1);
    552                 if (canceled)return;
     554                if (canceled) return;
    553555                final OAuthToken accessToken = authClient.getAccessToken(
    554                         getProgressMonitor().createSubTaskMonitor(1,false)
     556                        getProgressMonitor().createSubTaskMonitor(1, false)
    555557                );
    556558                getProgressMonitor().worked(1);
    557                 if (canceled)return;
     559                if (canceled) return;
    558560                GuiHelper.runInEDT(new Runnable() {
    559561                    @Override
     
    563565                    }
    564566                });
    565             } catch(final OsmOAuthAuthorizationException e) {
     567            } catch (final OsmOAuthAuthorizationException e) {
    566568                handleException(e);
    567569            }
  • trunk/src/org/openstreetmap/josm/gui/oauth/FullyAutomaticPropertiesPanel.java

    r8461 r8510  
    3030        gc.fill = GridBagConstraints.HORIZONTAL;
    3131        gc.weightx = 0.0;
    32         gc.insets = new Insets(0,0,3,3);
     32        gc.insets = new Insets(0, 0, 3, 3);
    3333        pnl.add(new JLabel(tr("Username: ")), gc);
    3434
     
    6161        setLayout(new GridBagLayout());
    6262        GridBagConstraints gc = new GridBagConstraints();
    63         setBorder(BorderFactory.createEmptyBorder(3,3,3,3));
     63        setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    6464
    6565        gc.anchor = GridBagConstraints.NORTHWEST;
  • trunk/src/org/openstreetmap/josm/gui/oauth/ManualAuthorizationUI.java

    r8444 r8510  
    5050    protected JPanel buildAccessTokenPanel() {
    5151        JPanel pnl = new JPanel(new GridBagLayout());
    52         pnl.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
     52        pnl.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    5353        GridBagConstraints gc = new GridBagConstraints();
    5454        AccessTokenBuilder accessTokenBuilder = new AccessTokenBuilder();
     
    5959        gc.weightx = 0.0;
    6060        gc.gridwidth = 2;
    61         gc.insets = new Insets(0,0,5,0);
     61        gc.insets = new Insets(0, 0, 5, 0);
    6262        pnlMessage = new HtmlPanel();
    6363        pnlMessage.setText("<html><body>"
     
    7171        gc.weightx = 0.0;
    7272        gc.gridwidth = 1;
    73         gc.insets = new Insets(0,0,0,3);
     73        gc.insets = new Insets(0, 0, 0, 3);
    7474        pnl.add(new JLabel(tr("Access Token Key:")), gc);
    7575
     
    9999        gc.gridy = 3;
    100100        gc.gridx = 0;
    101         gc.gridwidth =2;
     101        gc.gridwidth = 2;
    102102        gc.weightx = 1.0;
    103103        pnl.add(cbSaveToPreferences = new JCheckBox(tr("Save Access Token in preferences")), gc);
     
    107107        gc.gridy = 3;
    108108        gc.gridx = 0;
    109         gc.gridwidth =2;
     109        gc.gridwidth = 2;
    110110        gc.weightx = 1.0;
    111111        gc.weighty = 1.0;
     
    155155    protected final void build() {
    156156        setLayout(new BorderLayout());
    157         setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
     157        setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    158158        add(buildTabbedPreferencesPanel(), BorderLayout.CENTER);
    159159        add(buildActionsPanel(), BorderLayout.SOUTH);
     
    225225            }
    226226        }
     227
    227228        @Override
    228229        public void changedUpdate(DocumentEvent e) {
  • trunk/src/org/openstreetmap/josm/gui/oauth/OAuthAuthorizationWizard.java

    r8468 r8510  
    7171     * @return panel with buttons
    7272     */
    73     protected JPanel buildButtonRow(){
     73    protected JPanel buildButtonRow() {
    7474        JPanel pnl = new JPanel(new FlowLayout(FlowLayout.CENTER));
    7575
     
    9393    protected JPanel buildHeaderInfoPanel() {
    9494        JPanel pnl = new JPanel(new GridBagLayout());
    95         pnl.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
     95        pnl.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    9696        GridBagConstraints gc = new GridBagConstraints();
    9797
     
    109109        // OAuth in a nutshell ...
    110110        gc.gridy  = 1;
    111         gc.insets = new Insets(5,0,0,5);
     111        gc.insets = new Insets(5, 0, 0, 5);
    112112        HtmlPanel pnlMessage = new HtmlPanel();
    113113        pnlMessage.setText("<html><body>"
     
    125125        lbl = new JLabel(tr("Please select an authorization procedure: "));
    126126        lbl.setFont(lbl.getFont().deriveFont(Font.PLAIN));
    127         pnl.add(lbl,gc);
     127        pnl.add(lbl, gc);
    128128
    129129        gc.gridx = 1;
    130130        gc.gridwidth = 1;
    131131        gc.weightx = 1.0;
    132         pnl.add(cbAuthorisationProcedure = new AuthorizationProcedureComboBox(),gc);
     132        pnl.add(cbAuthorisationProcedure = new AuthorizationProcedureComboBox(), gc);
    133133        cbAuthorisationProcedure.addItemListener(new AuthorisationProcedureChangeListener());
    134134        lbl.setLabelFor(cbAuthorisationProcedure);
     
    141141     */
    142142    protected void refreshAuthorisationProcedurePanel() {
    143         AuthorizationProcedure procedure = (AuthorizationProcedure)cbAuthorisationProcedure.getSelectedItem();
     143        AuthorizationProcedure procedure = (AuthorizationProcedure) cbAuthorisationProcedure.getSelectedItem();
    144144        switch(procedure) {
    145145        case FULLY_AUTOMATIC:
     
    189189                    @Override
    190190                    public void componentResized(ComponentEvent e) {}
     191
    191192                    @Override
    192193                    public void componentMoved(ComponentEvent e) {}
     
    239240
    240241    protected AbstractAuthorizationUI getCurrentAuthorisationUI() {
    241         switch((AuthorizationProcedure)cbAuthorisationProcedure.getSelectedItem()) {
     242        switch((AuthorizationProcedure) cbAuthorisationProcedure.getSelectedItem()) {
    242243        case FULLY_AUTOMATIC: return pnlFullyAutomaticAuthorisationUI;
    243244        case MANUALLY: return pnlManualAuthorisationUI;
     
    296297                    WindowGeometry.centerInWindow(
    297298                            Main.parent,
    298                             new Dimension(450,540)
     299                            new Dimension(450, 540)
    299300                    )
    300301            ).applySafe(this);
     
    365366            if (!evt.getPropertyName().equals(AbstractAuthorizationUI.ACCESS_TOKEN_PROP))
    366367                return;
    367             updateEnabledState((OAuthToken)evt.getNewValue());
     368            updateEnabledState((OAuthToken) evt.getNewValue());
    368369        }
    369370    }
  • trunk/src/org/openstreetmap/josm/gui/oauth/OsmLoginFailedException.java

    r3408 r8510  
    22package org.openstreetmap.josm.gui.oauth;
    33
    4 public class OsmLoginFailedException extends OsmOAuthAuthorizationException{
     4public class OsmLoginFailedException extends OsmOAuthAuthorizationException {
    55
    66    public OsmLoginFailedException() {
  • trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java

    r8509 r8510  
    9999     */
    100100    public void cancel() {
    101         DefaultOAuthProvider p  = (DefaultOAuthProvider)provider;
     101        DefaultOAuthProvider p  = (DefaultOAuthProvider) provider;
    102102        canceled = true;
    103103        if (p != null) {
     
    105105                Field f =  p.getClass().getDeclaredField("connection");
    106106                f.setAccessible(true);
    107                 HttpURLConnection con = (HttpURLConnection)f.get(p);
     107                HttpURLConnection con = (HttpURLConnection) f.get(p);
    108108                if (con != null) {
    109109                    con.disconnect();
     
    114114            }
    115115        }
    116         synchronized(this) {
     116        synchronized (this) {
    117117            if (connection != null) {
    118118                connection.disconnect();
     
    139139            provider.retrieveRequestToken(consumer, "");
    140140            return OAuthToken.createToken(consumer);
    141         } catch(OAuthException e){
     141        } catch (OAuthException e) {
    142142            if (canceled)
    143143                throw new OsmTransferCanceledException(e);
     
    169169            provider.retrieveAccessToken(consumer, null);
    170170            return OAuthToken.createToken(consumer);
    171         } catch(OAuthException e){
     171        } catch (OAuthException e) {
    172172            if (canceled)
    173173                throw new OsmTransferCanceledException(e);
     
    235235                    // osm session cookie found
    236236                    String token = extractToken(connection);
    237                     if(token == null)
     237                    if (token == null)
    238238                        return null;
    239239                    SessionId si = new SessionId();
     
    247247    }
    248248
    249     protected String buildPostRequest(Map<String,String> parameters) throws OsmOAuthAuthorizationException {
     249    protected String buildPostRequest(Map<String, String> parameters) throws OsmOAuthAuthorizationException {
    250250        StringBuilder sb = new StringBuilder(32);
    251251
    252         for(Iterator<Entry<String,String>> it = parameters.entrySet().iterator(); it.hasNext();) {
    253             Entry<String,String> entry = it.next();
     252        for (Iterator<Entry<String, String>> it = parameters.entrySet().iterator(); it.hasNext();) {
     253            Entry<String, String> entry = it.next();
    254254            String value = entry.getValue();
    255255            value = (value == null) ? "" : value;
     
    269269     * URLs are malformed
    270270     */
    271     public String buildOsmLoginUrl() throws OsmOAuthAuthorizationException{
     271    public String buildOsmLoginUrl() throws OsmOAuthAuthorizationException {
    272272        try {
    273273            URL autUrl = new URL(oauthProviderParameters.getAuthoriseUrl());
    274274            URL url = new URL(Main.pref.get("oauth.protocol", "https"), autUrl.getHost(), autUrl.getPort(), "/login");
    275275            return url.toString();
    276         } catch(MalformedURLException e) {
     276        } catch (MalformedURLException e) {
    277277            throw new OsmOAuthAuthorizationException(e);
    278278        }
     
    286286     * URLs are malformed
    287287     */
    288     protected String buildOsmLogoutUrl() throws OsmOAuthAuthorizationException{
     288    protected String buildOsmLogoutUrl() throws OsmOAuthAuthorizationException {
    289289        try {
    290290            URL autUrl = new URL(oauthProviderParameters.getAuthoriseUrl());
    291291            URL url = new URL("http", autUrl.getHost(), autUrl.getPort(), "/logout");
    292292            return url.toString();
    293         } catch(MalformedURLException e) {
     293        } catch (MalformedURLException e) {
    294294            throw new OsmOAuthAuthorizationException(e);
    295295        }
     
    308308            sb.append(buildOsmLoginUrl()).append("?cookie_test=true");
    309309            URL url = new URL(sb.toString());
    310             synchronized(this) {
     310            synchronized (this) {
    311311                connection = Utils.openHttpConnection(url);
    312312            }
     
    319319                throw new OsmOAuthAuthorizationException(tr("OSM website did not return a session cookie in response to ''{0}'',", url.toString()));
    320320            return sessionId;
    321         } catch(IOException e) {
    322             throw new OsmOAuthAuthorizationException(e);
    323         } finally {
    324             synchronized(this) {
     321        } catch (IOException e) {
     322            throw new OsmOAuthAuthorizationException(e);
     323        } finally {
     324            synchronized (this) {
    325325                connection = null;
    326326            }
     
    337337        try {
    338338            URL url = new URL(getAuthoriseUrl(requestToken));
    339             synchronized(this) {
     339            synchronized (this) {
    340340                connection = Utils.openHttpConnection(url);
    341341            }
     
    348348            if (sessionId.token == null)
    349349                throw new OsmOAuthAuthorizationException(tr("OSM website did not return a session cookie in response to ''{0}'',", url.toString()));
    350         } catch(IOException e) {
    351             throw new OsmOAuthAuthorizationException(e);
    352         } finally {
    353             synchronized(this) {
     350        } catch (IOException e) {
     351            throw new OsmOAuthAuthorizationException(e);
     352        } finally {
     353            synchronized (this) {
    354354                connection = null;
    355355            }
     
    360360        try {
    361361            URL url = new URL(buildOsmLoginUrl());
    362             synchronized(this) {
     362            synchronized (this) {
    363363                connection = Utils.openHttpConnection(url);
    364364            }
     
    368368            connection.setUseCaches(false);
    369369
    370             Map<String,String> parameters = new HashMap<>();
     370            Map<String, String> parameters = new HashMap<>();
    371371            parameters.put("username", userName);
    372372            parameters.put("password", password);
     
    397397            if (retCode != HttpURLConnection.HTTP_MOVED_TEMP)
    398398                throw new OsmOAuthAuthorizationException(tr("Failed to authenticate user ''{0}'' with password ''***'' as OAuth user", userName));
    399         } catch(OsmOAuthAuthorizationException e) {
     399        } catch (OsmOAuthAuthorizationException e) {
    400400            throw new OsmLoginFailedException(e.getCause());
    401         } catch(IOException e) {
     401        } catch (IOException e) {
    402402            throw new OsmLoginFailedException(e);
    403403        } finally {
    404             synchronized(this) {
     404            synchronized (this) {
    405405                connection = null;
    406406            }
     
    411411        try {
    412412            URL url = new URL(buildOsmLogoutUrl());
    413             synchronized(this) {
     413            synchronized (this) {
    414414                connection = Utils.openHttpConnection(url);
    415415            }
     
    418418            connection.setDoOutput(false);
    419419            connection.connect();
    420         } catch(IOException e) {
     420        } catch (IOException e) {
    421421            throw new OsmOAuthAuthorizationException(e);
    422422        }  finally {
    423             synchronized(this) {
     423            synchronized (this) {
    424424                connection = null;
    425425            }
     
    458458        try {
    459459            URL url = new URL(oauthProviderParameters.getAuthoriseUrl());
    460             synchronized(this) {
     460            synchronized (this) {
    461461                connection = Utils.openHttpConnection(url);
    462462            }
     
    483483            throw new OsmOAuthAuthorizationException(e);
    484484        } finally {
    485             synchronized(this) {
     485            synchronized (this) {
    486486                connection = null;
    487487            }
     
    541541                throw new OsmTransferCanceledException("Authorization canceled");
    542542            monitor.worked(1);
    543         } catch(OsmOAuthAuthorizationException e) {
     543        } catch (OsmOAuthAuthorizationException e) {
    544544            if (canceled)
    545545                throw new OsmTransferCanceledException(e);
  • trunk/src/org/openstreetmap/josm/gui/oauth/OsmPrivilegesPanel.java

    r6890 r8510  
    2727        setLayout(new GridBagLayout());
    2828        GridBagConstraints gc = new GridBagConstraints();
    29         setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
     29        setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    3030
    3131        // checkbox for "allow to upload map data"
     
    3434        gc.fill = GridBagConstraints.HORIZONTAL;
    3535        gc.weightx = 1.0;
    36         gc.insets = new Insets(0,0,3,3);
     36        gc.insets = new Insets(0, 0, 3, 3);
    3737        add(cbWriteApi = new JCheckBox(), gc);
    3838        cbWriteApi.setText(tr("Allow to upload map data"));
  • trunk/src/org/openstreetmap/josm/gui/oauth/RetrieveAccessTokenTask.java

    r8291 r8510  
    5555    protected void cancel() {
    5656        canceled = true;
    57         synchronized(this) {
     57        synchronized (this) {
    5858            if (client != null) {
    5959                client.cancel();
     
    8181    protected void realRun() throws SAXException, IOException, OsmTransferException {
    8282        try {
    83             synchronized(this) {
     83            synchronized (this) {
    8484                client = new OsmOAuthAuthorizationClient(parameters, requestToken);
    8585            }
    8686            accessToken = client.getAccessToken(getProgressMonitor().createSubTaskMonitor(0, false));
    87         } catch(OsmTransferCanceledException e) {
     87        } catch (OsmTransferCanceledException e) {
    8888            return;
    8989        } catch (OsmOAuthAuthorizationException e) {
     
    9292            accessToken = null;
    9393        } finally {
    94             synchronized(this) {
     94            synchronized (this) {
    9595                client = null;
    9696            }
  • trunk/src/org/openstreetmap/josm/gui/oauth/RetrieveRequestTokenTask.java

    r8444 r8510  
    4949    protected void cancel() {
    5050        canceled = true;
    51         synchronized(this) {
     51        synchronized (this) {
    5252            if (client != null) {
    5353                client.cancel();
     
    7575    protected void realRun() throws SAXException, IOException, OsmTransferException {
    7676        try {
    77             synchronized(this) {
     77            synchronized (this) {
    7878                client = new OsmOAuthAuthorizationClient(parameters);
    7979            }
    8080            requestToken = client.getRequestToken(getProgressMonitor().createSubTaskMonitor(0, false));
    81         } catch(OsmTransferCanceledException e) {
     81        } catch (OsmTransferCanceledException e) {
    8282            return;
    8383        } catch (OsmOAuthAuthorizationException e) {
     
    8686            requestToken = null;
    8787        } finally {
    88             synchronized(this) {
     88            synchronized (this) {
    8989                client = null;
    9090            }
  • trunk/src/org/openstreetmap/josm/gui/oauth/SemiAutomaticAuthorizationUI.java

    r8468 r8510  
    5353    protected final void build() {
    5454        setLayout(new BorderLayout());
    55         setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
     55        setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    5656        pnlRetrieveRequestToken = new RetrieveRequestTokenPanel();
    5757        pnlRetrieveAccessToken = new RetrieveAccessTokenPanel();
     
    123123        protected JPanel buildAdvancedParametersPanel() {
    124124            JPanel pnl = new JPanel(new GridBagLayout());
    125             GridBagConstraints gc= new GridBagConstraints();
     125            GridBagConstraints gc = new GridBagConstraints();
    126126
    127127            gc.anchor = GridBagConstraints.NORTHWEST;
    128128            gc.fill = GridBagConstraints.HORIZONTAL;
    129129            gc.weightx = 0.0;
    130             gc.insets = new Insets(0,0,0,3);
     130            gc.insets = new Insets(0, 0, 0, 3);
    131131            JCheckBox cbShowAdvancedParameters = new JCheckBox();
    132132            pnl.add(cbShowAdvancedParameters, gc);
     
    149149            gc.gridy = 1;
    150150            gc.gridx = 1;
    151             gc.insets = new Insets(3,0,3,0);
     151            gc.insets = new Insets(3, 0, 3, 0);
    152152            gc.fill = GridBagConstraints.BOTH;
    153153            gc.weightx = 1.0;
     
    157157                    BorderFactory.createCompoundBorder(
    158158                            BorderFactory.createLineBorder(Color.GRAY, 1),
    159                             BorderFactory.createEmptyBorder(3,3,3,3)
     159                            BorderFactory.createEmptyBorder(3, 3, 3, 3)
    160160                    )
    161161            );
     
    166166        protected JPanel buildCommandPanel() {
    167167            JPanel pnl = new JPanel(new GridBagLayout());
    168             GridBagConstraints gc= new GridBagConstraints();
     168            GridBagConstraints gc = new GridBagConstraints();
    169169
    170170            gc.anchor = GridBagConstraints.NORTHWEST;
     
    172172            gc.weightx = 1.0;
    173173            gc.weighty = 1.0;
    174             gc.insets = new Insets(0,0,0,3);
     174            gc.insets = new Insets(0, 0, 0, 3);
    175175
    176176
     
    193193
    194194        }
     195
    195196        protected final void build() {
    196             setLayout(new BorderLayout(0,5));
     197            setLayout(new BorderLayout(0, 5));
    197198            JLabel lbl = new JLabel(tr("<html>Step 1/3: Retrieve an OAuth Request Token</html>"));
    198199            lbl.setFont(lbl.getFont().deriveFont(16f));
     
    229230            GridBagConstraints gc = new GridBagConstraints();
    230231
    231             gc.anchor= GridBagConstraints.NORTHWEST;
     232            gc.anchor = GridBagConstraints.NORTHWEST;
    232233            gc.fill = GridBagConstraints.HORIZONTAL;
    233234            gc.weightx = 1.0;
     
    320321            GridBagConstraints gc = new GridBagConstraints();
    321322
    322             gc.anchor= GridBagConstraints.NORTHWEST;
     323            gc.anchor = GridBagConstraints.NORTHWEST;
    323324            gc.fill = GridBagConstraints.HORIZONTAL;
    324325            gc.weightx = 1.0;
  • trunk/src/org/openstreetmap/josm/gui/oauth/TestAccessTokenTask.java

    r8509 r8510  
    7070    protected void cancel() {
    7171        canceled = true;
    72         synchronized(this) {
     72        synchronized (this) {
    7373            if (connection != null) {
    7474                connection.disconnect();
     
    8080    protected void finish() {}
    8181
    82     protected void sign(HttpURLConnection con) throws OAuthException{
     82    protected void sign(HttpURLConnection con) throws OAuthException {
    8383        OAuthConsumer consumer = oauthParameters.buildConsumer();
    8484        consumer.setTokenWithSecret(token.getKey(), token.getSecret());
     
    9191
    9292        // remove trailing slashes
    93         while(url.endsWith("/")) {
     93        while (url.endsWith("/")) {
    9494            url = url.substring(0, url.lastIndexOf('/'));
    9595        }
     
    103103            authenticatorEnabled = DefaultAuthenticator.getInstance().isEnabled();
    104104            DefaultAuthenticator.getInstance().setEnabled(false);
    105             synchronized(this) {
     105            synchronized (this) {
    106106                connection = Utils.openHttpConnection(url);
    107107            }
     
    121121
    122122            if (connection.getResponseCode() != HttpURLConnection.HTTP_OK)
    123                 throw new OsmApiException(connection.getResponseCode(),connection.getHeaderField("Error"), null);
     123                throw new OsmApiException(connection.getResponseCode(), connection.getHeaderField("Error"), null);
    124124            Document d = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(connection.getInputStream());
    125125            return OsmServerUserInfoReader.buildFromXML(d);
    126         } catch(SAXException | ParserConfigurationException e) {
     126        } catch (SAXException | ParserConfigurationException e) {
    127127            throw new XmlParsingException(e);
    128         } catch(IOException e) {
     128        } catch (IOException e) {
    129129            throw new OsmTransferException(e);
    130         } catch(OAuthException e) {
     130        } catch (OAuthException e) {
    131131            throw new OsmOAuthAuthorizationException(e);
    132132        } finally {
     
    249249            if (canceled) return;
    250250            notifySuccess(userInfo);
    251         }catch(OsmOAuthAuthorizationException e) {
     251        } catch (OsmOAuthAuthorizationException e) {
    252252            if (canceled) return;
    253253            Main.error(e);
    254254            alertFailedSigning();
    255         } catch(OsmApiException e) {
     255        } catch (OsmApiException e) {
    256256            if (canceled) return;
    257257            Main.error(e);
     
    267267            }
    268268            alertFailedConnection();
    269         } catch(OsmTransferException e) {
     269        } catch (OsmTransferException e) {
    270270            if (canceled) return;
    271271            Main.error(e);
Note: See TracChangeset for help on using the changeset viewer.