Changeset 1608 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2009-05-23T11:36:04+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/io
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r1581 r1608 129 129 /** 130 130 * Initializes this component by negotiating a protocol version with the server. 131 */ 132 public void initialize() { 131 * 132 * @exception UnknownHostException thrown, if the API host is unknown 133 * @exception SocketTimeoutException thrown, if the connection to the API host times out 134 * @exception ConnectException throw, if the connection to the API host fails 135 * @exception Exception any other exception 136 */ 137 public void initialize() throws UnknownHostException,SocketTimeoutException, ConnectException,Exception { 133 138 initAuthentication(); 134 139 try { … … 153 158 } catch (Exception ex) { 154 159 initialized = false; 155 ex.printStackTrace();160 throw ex; 156 161 } 157 162 } -
trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
r1523 r1608 11 11 import java.util.zip.InflaterInputStream; 12 12 import java.util.zip.GZIPInputStream; 13 14 import javax.swing.JOptionPane; 13 15 14 16 import org.openstreetmap.josm.Main; … … 38 40 */ 39 41 protected InputStream getInputStream(String urlStr, PleaseWaitDialog pleaseWaitDlg) throws IOException { 40 api.initialize(); 42 43 // initialize API. Abort download in case of configuration or network 44 // errors 45 // 46 try { 47 api.initialize(); 48 } catch(Exception e) { 49 JOptionPane.showMessageDialog( 50 null, 51 tr( "Failed to initialize communication with the OSM server {0}.\n" 52 + "Check the server URL in your preferences and your internet connection.", 53 Main.pref.get("osm-server.url") 54 ), 55 tr("Error"), 56 JOptionPane.ERROR_MESSAGE 57 ); 58 e.printStackTrace(); 59 return null; 60 } 61 41 62 urlStr = api.getBaseUrl() + urlStr; 42 63 return getInputStreamRaw(urlStr, pleaseWaitDlg); -
trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java
r1581 r1608 68 68 public void uploadOsm(String the_version, Collection<OsmPrimitive> list) { 69 69 processed = new LinkedList<OsmPrimitive>(); 70 api.initialize(); 70 71 // initialize API. Abort upload in case of configuration or network 72 // errors 73 // 74 try { 75 api.initialize(); 76 } catch(Exception e) { 77 JOptionPane.showMessageDialog( 78 null, 79 tr( "Failed to initialize communication with the OSM server {0}.\n" 80 + "Check the server URL in your preferences and your internet connection.", 81 Main.pref.get("osm-server.url") 82 ), 83 tr("Error"), 84 JOptionPane.ERROR_MESSAGE 85 ); 86 e.printStackTrace(); 87 return; 88 } 89 71 90 72 91 Main.pleaseWaitDlg.progress.setMaximum(list.size());
Note:
See TracChangeset
for help on using the changeset viewer.