Changeset 431 in josm for trunk/src/org/openstreetmap/josm/data/ServerSidePreferences.java
- Timestamp:
- 2007-10-26T21:58:25+02:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/ServerSidePreferences.java
r343 r431 12 12 import java.io.StringReader; 13 13 import java.net.HttpURLConnection; 14 import java.net.URLConnection; 14 15 import java.net.MalformedURLException; 15 16 import java.net.URL; … … 46 47 try { 47 48 System.out.println("reading preferences from "+serverUrl); 48 HttpURLConnection con = (HttpURLConnection)serverUrl.openConnection();49 addAuth(con);49 URLConnection con = serverUrl.openConnection(); 50 if (con instanceof HttpURLConnection) addAuth((HttpURLConnection) con); 50 51 con.connect(); 51 52 BufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream())); … … 55 56 b.append("\n"); 56 57 } 57 con.disconnect();58 if (con instanceof HttpURLConnection) ((HttpURLConnection) con).disconnect(); 58 59 return b.toString(); 59 60 } catch (IOException e) { … … 122 123 if (!properties.containsKey("osm-server.password") && password != null) 123 124 properties.put("osm-server.password", password); 124 Reader in = new StringReader(connection.download()); 125 String cont = connection.download(); 126 if (cont == null) return; 127 Reader in = new StringReader(cont); 125 128 try { 126 129 XmlObjectParser.Uniform<Prop> parser = new XmlObjectParser.Uniform<Prop>(in, "tag", Prop.class); … … 176 179 } catch (MalformedURLException e) { 177 180 e.printStackTrace(); 181 } catch (IllegalArgumentException e) { 182 e.printStackTrace(); 178 183 } catch (IOException e) { 179 184 e.printStackTrace();
Note:
See TracChangeset
for help on using the changeset viewer.