Package org.openstreetmap.josm.io

Examples of org.openstreetmap.josm.io.OsmApiException


        if (e instanceof OsmApiPrimitiveGoneException) {
            handleGone((OsmApiPrimitiveGoneException)e);
            return;
        }
        if (e instanceof OsmApiException) {
            OsmApiException ex = (OsmApiException)e;
            // There was an upload conflict. Let the user decide whether
            // and how to resolve it
            //
            if(ex.getResponseCode() == HttpURLConnection.HTTP_CONFLICT) {
                handleUploadConflict(ex);
                return;
            }
            // There was a precondition failed. Notify the user.
            //
            else if (ex.getResponseCode() == HttpURLConnection.HTTP_PRECON_FAILED) {
                handlePreconditionFailed(ex);
                return;
            }
            // Tried to update or delete a primitive which never existed on
            // the server?
            //
            else if (ex.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
                ExceptionDialogUtil.explainNotFound(ex);
                return;
            }
        }
View Full Code Here


        if (e instanceof ChangesetClosedException)
            return explainChangesetClosedException((ChangesetClosedException)e);

        if (e instanceof OsmApiException) {
            OsmApiException oae = (OsmApiException) e;
            if (oae.getResponseCode() == HttpURLConnection.HTTP_PRECON_FAILED)
                return explainPreconditionFailed(oae);
            if (oae.getResponseCode() == HttpURLConnection.HTTP_GONE)
                return explainGoneForUnknownPrimitive(oae);
            if (oae.getResponseCode() == HttpURLConnection.HTTP_INTERNAL_ERROR)
                return explainInternalServerError(oae);
            if (oae.getResponseCode() == HttpURLConnection.HTTP_BAD_REQUEST)
                return explainBadRequest(oae);
            if (oae.getResponseCode() == 509)
                return explainBandwidthLimitExceeded(oae);
        }
        return explainGeneric(e);
    }
View Full Code Here

            connection.setRequestMethod("GET");
            sign(connection);
            connection.connect();

            if (connection.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED)
                throw new OsmApiException(HttpURLConnection.HTTP_UNAUTHORIZED, tr("Retrieving user details with Access Token Key ''{0}'' was rejected.", token.getKey()), null);

            if (connection.getResponseCode() == HttpURLConnection.HTTP_FORBIDDEN)
                throw new OsmApiException(HttpURLConnection.HTTP_FORBIDDEN, tr("Retrieving user details with Access Token Key ''{0}'' was forbidden.", token.getKey()), null);

            if (connection.getResponseCode() != HttpURLConnection.HTTP_OK)
                throw new OsmApiException(connection.getResponseCode(),connection.getHeaderField("Error"), null);
            Document d = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(connection.getInputStream());
            return OsmServerUserInfoReader.buildFromXML(d);
        } catch(SAXException | ParserConfigurationException e) {
            throw new XmlParsingException(e);
        } catch(IOException e) {
View Full Code Here

            explainMissingOAuthAccessTokenException((MissingOAuthAccessTokenException)e);
            return;
        }

        if (e instanceof OsmApiException) {
            OsmApiException oae = (OsmApiException) e;
            switch(oae.getResponseCode()) {
            case HttpURLConnection.HTTP_PRECON_FAILED:
                explainPreconditionFailed(oae);
                return;
            case HttpURLConnection.HTTP_GONE:
                explainGoneForUnknownPrimitive(oae);
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.io.OsmApiException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.