Changeset 8304 in josm for trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
- Timestamp:
- 2015-05-01T21:47:18+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
r8193 r8304 2 2 package org.openstreetmap.josm.io.remotecontrol.handler; 3 3 4 import org.openstreetmap.josm.Main; 5 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault; 6 import org.openstreetmap.josm.tools.Utils; 7 8 import javax.swing.JLabel; 9 import javax.swing.JOptionPane; 10 import java.io.UnsupportedEncodingException; 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 11 6 import java.net.URI; 12 7 import java.net.URISyntaxException; 13 import java.net.URLDecoder;14 8 import java.text.MessageFormat; 15 9 import java.util.Collections; … … 20 14 import java.util.Map; 21 15 22 import static org.openstreetmap.josm.tools.I18n.tr; 16 import javax.swing.JLabel; 17 import javax.swing.JOptionPane; 18 19 import org.openstreetmap.josm.Main; 20 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault; 21 import org.openstreetmap.josm.tools.Utils; 23 22 24 23 /** … … 210 209 } 211 210 for (String kv : uri.getRawQuery().split("&")) { 212 try { 213 final String[] kvs = URLDecoder.decode(kv, "UTF-8").split("=", 2); 214 r.put(kvs[0], kvs.length > 1 ? kvs[1] : null); 215 } catch (UnsupportedEncodingException ex) { 216 throw new IllegalStateException(ex); 217 } 211 final String[] kvs = Utils.decodeUrl(kv).split("=", 2); 212 r.put(kvs[0], kvs.length > 1 ? kvs[1] : null); 218 213 } 219 214 return r; … … 275 270 } 276 271 277 protected static String decodeParam(String param) {278 try {279 return URLDecoder.decode(param, "UTF-8");280 } catch (UnsupportedEncodingException e) {281 throw new RuntimeException(e);282 }283 }284 285 272 public void setSender(String sender) { 286 273 this.sender = sender; … … 333 320 String query = request.substring(request.indexOf('?') + 1); 334 321 if (query.indexOf("url=") == 0) { 335 args.put("url", decodeParam(query.substring(4)));322 args.put("url", Utils.decodeUrl(query.substring(4))); 336 323 } else { 337 324 int urlIdx = query.indexOf("&url="); 338 325 if (urlIdx != -1) { 339 args.put("url", decodeParam(query.substring(urlIdx + 5)));326 args.put("url", Utils.decodeUrl(query.substring(urlIdx + 5))); 340 327 query = query.substring(0, urlIdx); 341 328 } else if (query.indexOf('#') != -1) { … … 346 333 int eq = param.indexOf('='); 347 334 if (eq != -1) { 348 args.put(param.substring(0, eq), decodeParam(param.substring(eq + 1)));335 args.put(param.substring(0, eq), Utils.decodeUrl(param.substring(eq + 1))); 349 336 } 350 337 }
Note:
See TracChangeset
for help on using the changeset viewer.