Changeset 2189 in josm for trunk


Ignore:
Timestamp:
2009-09-26T10:37:00+02:00 (15 years ago)
Author:
Gubaer
Message:

fixed #3564: i18n fail in error when uploading OSM data to a fresh server

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/UploadAction.java

    r2181 r2189  
    415415                return;
    416416            }
     417            // Tried to update or delete a primitive which never existed on
     418            // the server?
     419            //
     420            else if (ex.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
     421                ExceptionDialogUtil.explainNotFound(ex);
     422                return;
     423            }
    417424            // any other API exception
    418425            //
  • trunk/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java

    r2097 r2189  
    133133
    134134    /**
     135     * Explains a {@see OsmApiException} which was thrown because a resource wasn't found
     136     * on the server
     137     *
     138     * @param e the exception
     139     */
     140    public static void explainNotFound(OsmApiException e) {
     141        JOptionPane.showMessageDialog(Main.parent, ExceptionUtil.explainNotFound(e), tr("Not Found"),
     142                JOptionPane.ERROR_MESSAGE);
     143    }
     144
     145    /**
    135146     * Explains a {@see UnknownHostException} which has caused an {@see OsmTransferException}.
    136147     * This is most likely happening when there is an error in the API URL or when
     
    216227                return;
    217228            }
     229            if (oae.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
     230                explainNotFound(oae);
     231                return;
     232            }
     233
    218234        }
    219235        explainGeneric(e);
  • trunk/src/org/openstreetmap/josm/io/OsmApiException.java

    r2181 r2189  
    8686            sb.append(tr(errorHeader));
    8787            sb.append(tr("(Code={0})", responseCode));
    88         } else if (errorBody != null) {
     88        } else if (errorBody != null && !errorBody.trim().equals("")) {
    8989            errorBody = errorBody.trim();
    9090            sb.append(tr(errorBody));
  • trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java

    r2097 r2189  
    168168            message += tr("<br>Error message(untranslated): {0}", e.getErrorHeader());
    169169        }
     170        message = "<html>" + message + "</html>";
     171        e.printStackTrace();
     172        return message;
     173    }
     174
     175    /**
     176     * Explains a {@see OsmApiException} which was thrown because a resource wasn't found.
     177     *
     178     * @param e the exception
     179     */
     180    public static String explainNotFound(OsmApiException e) {
     181        String apiUrl = OsmApi.getOsmApi().getBaseUrl();
     182        String message = tr("The OSM server ''{0}'' doesn't know about an object<br>"
     183                + "you tried to update or delete."
     184                , apiUrl);
    170185        message = "<html>" + message + "</html>";
    171186        e.printStackTrace();
Note: See TracChangeset for help on using the changeset viewer.