Changeset 3255 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2010-05-15T21:57:19+02:00 (14 years ago)
Author:
jttt
Message:

Fix #4764 Fehler

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

Legend:

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

    r3101 r3255  
    340340        HelpAwareOptionPane.showOptionDialog(
    341341                Main.parent,
    342                 ExceptionUtil.explainNestedUnkonwnHostException(e),
     342                ExceptionUtil.explainNestedUnknownHostException(e),
    343343                tr("Unknown host"),
    344344                JOptionPane.ERROR_MESSAGE,
  • trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java

    r3083 r3255  
    353353        @Override
    354354        protected void realRun() throws SAXException, IOException, OsmTransferException {
     355            String urlString = useserver.url+java.net.URLEncoder.encode(searchExpression, "UTF-8");
     356
    355357            try {
    356358                getProgressMonitor().indeterminateSubTask(tr("Querying name server ..."));
    357                 URL url = new URL(useserver.url+java.net.URLEncoder.encode(searchExpression, "UTF-8"));
     359                URL url = new URL(urlString);
    358360                synchronized(this) {
    359361                    connection = (HttpURLConnection)url.openConnection();
     
    369371                    // ignore exception
    370372                    return;
    371                 lastException = e;
     373                OsmTransferException ex = new OsmTransferException(e);
     374                ex.setUrl(urlString);
     375                lastException = ex;
    372376            }
    373377        }
  • trunk/src/org/openstreetmap/josm/io/OsmTransferException.java

    r3083 r3255  
    33
    44public class OsmTransferException extends Exception {
     5
     6    private String url = OsmApi.getOsmApi().getBaseUrl();
    57
    68    public OsmTransferException() {
     
    1921    }
    2022
     23    public void setUrl(String url) {
     24        this.url = url;
     25    }
     26
     27    /**
     28     *
     29     * @return Api base url or url set using setUrl method
     30     */
     31    public String getUrl() {
     32        return url;
     33    }
     34
    2135}
  • trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java

    r3112 r3255  
    144144    /**
    145145     * Explains an OSM API exception because of a client timeout (HTTP 408).
    146      * 
     146     *
    147147     * @param e the exception
    148148     * @return the message
     
    159159    /**
    160160     * Replies a generic error message for an OSM API exception
    161      * 
     161     *
    162162     * @param e the exception
    163163     * @return the message
     
    278278
    279279    public static String explainSecurityException(OsmTransferException e) {
    280         String apiUrl = OsmApi.getOsmApi().getBaseUrl();
     280        String apiUrl = e.getUrl();
    281281        String host = tr("unknown");
    282282        try {
     
    301301
    302302    public static String explainNestedSocketException(OsmTransferException e) {
    303         String apiUrl = OsmApi.getOsmApi().getBaseUrl();
     303        String apiUrl = e.getUrl();
    304304        String message = tr("<html>Failed to open a connection to the remote server<br>" + "''{0}''.<br>"
    305305                + "Please check your internet connection.</html>", apiUrl);
     
    318318    public static String explainNestedIOException(OsmTransferException e) {
    319319        IOException ioe = getNestedException(e, IOException.class);
    320         String apiUrl = OsmApi.getOsmApi().getBaseUrl();
     320        String apiUrl = e.getUrl();
    321321        String message = tr("<html>Failed to upload data to or download data from<br>" + "''{0}''<br>"
    322322                + "due to a problem with transferring data.<br>" + "Details(untranslated): {1}</html>", apiUrl, ioe
     
    349349
    350350    public static String explainInternalServerError(OsmTransferException e) {
    351         String apiUrl = OsmApi.getOsmApi().getBaseUrl();
     351        String apiUrl = e.getUrl();
    352352        String message = tr("<html>The OSM server<br>" + "''{0}''<br>" + "reported an internal server error.<br>"
    353353                + "This is most likely a temporary problem. Please try again later.</html>", apiUrl);
     
    404404     */
    405405
    406     public static String explainNestedUnkonwnHostException(OsmTransferException e) {
    407         String apiUrl = OsmApi.getOsmApi().getBaseUrl();
     406    public static String explainNestedUnknownHostException(OsmTransferException e) {
     407        String apiUrl = e.getUrl();
    408408        String host = tr("unknown");
    409409        try {
     
    453453            return explainNestedSocketException(e);
    454454        if (getNestedException(e, UnknownHostException.class) != null)
    455             return explainNestedUnkonwnHostException(e);
     455            return explainNestedUnknownHostException(e);
    456456        if (getNestedException(e, IOException.class) != null)
    457457            return explainNestedIOException(e);
Note: See TracChangeset for help on using the changeset viewer.