Changeset 4020 in josm for trunk/src


Ignore:
Timestamp:
2011-04-13T22:09:36+02:00 (13 years ago)
Author:
bastiK
Message:

generic handling of 403 - 'forbidden' in anticipation of server change that will reject uploads from users that haven't accepted or declined the license change

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

Legend:

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

    r3255 r4020  
    272272     */
    273273    public static void explainAuthorizationFailed(OsmApiException e) {
    274         HelpAwareOptionPane.showOptionDialog(
    275                 Main.parent,
    276                 ExceptionUtil.explainFailedOAuthAuthorisation(e),
     274        // Fixme: add special handling that calls ExceptionUtil.explainFailedOAuthAuthorisation(e)
     275        HelpAwareOptionPane.showOptionDialog(
     276                Main.parent,
     277                ExceptionUtil.explainFailedAuthorisation(e),
    277278                tr("Authorisation Failed"),
    278279                JOptionPane.ERROR_MESSAGE,
  • trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java

    r3562 r4020  
    126126                + "</html>",
    127127                OAuthAccessTokenHolder.getInstance().getAccessTokenKey()
     128        );
     129    }
     130
     131    public static String explainFailedAuthorisation(OsmApiException e) {
     132        e.printStackTrace();
     133        String header = e.getErrorHeader();
     134        String body = e.getErrorBody();
     135        String msg = null;
     136        if (header != null) {
     137            if (body != null && !header.equals(body)) {
     138                msg = header + " (" + body + ")";
     139            } else {
     140                msg = header;
     141            }
     142        } else {
     143            msg = body;
     144        }
     145       
     146        return tr("<html>"
     147                + "Authorisation at the OSM server failed.<br>"
     148                + "The server reported the following error:<br>"
     149                + "''{0}''"
     150                + "</html>",
     151                msg
    128152        );
    129153    }
Note: See TracChangeset for help on using the changeset viewer.