Index: trunk/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java (revision 3254)
+++ trunk/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java (revision 3255)
@@ -340,5 +340,5 @@
HelpAwareOptionPane.showOptionDialog(
Main.parent,
- ExceptionUtil.explainNestedUnkonwnHostException(e),
+ ExceptionUtil.explainNestedUnknownHostException(e),
tr("Unknown host"),
JOptionPane.ERROR_MESSAGE,
Index: trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java (revision 3254)
+++ trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java (revision 3255)
@@ -353,7 +353,9 @@
@Override
protected void realRun() throws SAXException, IOException, OsmTransferException {
+ String urlString = useserver.url+java.net.URLEncoder.encode(searchExpression, "UTF-8");
+
try {
getProgressMonitor().indeterminateSubTask(tr("Querying name server ..."));
- URL url = new URL(useserver.url+java.net.URLEncoder.encode(searchExpression, "UTF-8"));
+ URL url = new URL(urlString);
synchronized(this) {
connection = (HttpURLConnection)url.openConnection();
@@ -369,5 +371,7 @@
// ignore exception
return;
- lastException = e;
+ OsmTransferException ex = new OsmTransferException(e);
+ ex.setUrl(urlString);
+ lastException = ex;
}
}
Index: trunk/src/org/openstreetmap/josm/io/OsmTransferException.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OsmTransferException.java (revision 3254)
+++ trunk/src/org/openstreetmap/josm/io/OsmTransferException.java (revision 3255)
@@ -3,4 +3,6 @@
public class OsmTransferException extends Exception {
+
+ private String url = OsmApi.getOsmApi().getBaseUrl();
public OsmTransferException() {
@@ -19,3 +21,15 @@
}
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ /**
+ *
+ * @return Api base url or url set using setUrl method
+ */
+ public String getUrl() {
+ return url;
+ }
+
}
Index: trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java (revision 3254)
+++ trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java (revision 3255)
@@ -144,5 +144,5 @@
/**
* Explains an OSM API exception because of a client timeout (HTTP 408).
- *
+ *
* @param e the exception
* @return the message
@@ -159,5 +159,5 @@
/**
* Replies a generic error message for an OSM API exception
- *
+ *
* @param e the exception
* @return the message
@@ -278,5 +278,5 @@
public static String explainSecurityException(OsmTransferException e) {
- String apiUrl = OsmApi.getOsmApi().getBaseUrl();
+ String apiUrl = e.getUrl();
String host = tr("unknown");
try {
@@ -301,5 +301,5 @@
public static String explainNestedSocketException(OsmTransferException e) {
- String apiUrl = OsmApi.getOsmApi().getBaseUrl();
+ String apiUrl = e.getUrl();
String message = tr("Failed to open a connection to the remote server
" + "''{0}''.
"
+ "Please check your internet connection.", apiUrl);
@@ -318,5 +318,5 @@
public static String explainNestedIOException(OsmTransferException e) {
IOException ioe = getNestedException(e, IOException.class);
- String apiUrl = OsmApi.getOsmApi().getBaseUrl();
+ String apiUrl = e.getUrl();
String message = tr("Failed to upload data to or download data from
" + "''{0}''
"
+ "due to a problem with transferring data.
" + "Details(untranslated): {1}", apiUrl, ioe
@@ -349,5 +349,5 @@
public static String explainInternalServerError(OsmTransferException e) {
- String apiUrl = OsmApi.getOsmApi().getBaseUrl();
+ String apiUrl = e.getUrl();
String message = tr("The OSM server
" + "''{0}''
" + "reported an internal server error.
"
+ "This is most likely a temporary problem. Please try again later.", apiUrl);
@@ -404,6 +404,6 @@
*/
- public static String explainNestedUnkonwnHostException(OsmTransferException e) {
- String apiUrl = OsmApi.getOsmApi().getBaseUrl();
+ public static String explainNestedUnknownHostException(OsmTransferException e) {
+ String apiUrl = e.getUrl();
String host = tr("unknown");
try {
@@ -453,5 +453,5 @@
return explainNestedSocketException(e);
if (getNestedException(e, UnknownHostException.class) != null)
- return explainNestedUnkonwnHostException(e);
+ return explainNestedUnknownHostException(e);
if (getNestedException(e, IOException.class) != null)
return explainNestedIOException(e);