Changeset 11587 in osm
- Timestamp:
- 2008-11-01T15:55:17+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/NewAction.java
r11584 r11587 31 31 import java.io.IOException; 32 32 import java.net.URLEncoder; 33 import java.util.regex.Matcher; 34 import java.util.regex.Pattern; 33 35 34 36 import org.openstreetmap.josm.Main; … … 59 61 String result = null; 60 62 if(Main.pref.getBoolean(ConfigKeys.OSB_API_DISABLED)) { 61 result = "ok"; 63 result = "ok 12345"; 62 64 } else { 63 65 result = HttpUtils.post(uri, null, post, CHARSET); 64 66 } 65 67 66 if(result != null && !result.startsWith("ok")) { 68 Pattern resultPattern = Pattern.compile("ok\\s+(\\d+)"); 69 Matcher m = resultPattern.matcher(result); 70 String id = "-1"; 71 if(m.matches()) { 72 id = m.group(1); 73 } else { 67 74 throw new RuntimeException("Couldn't create new bug. Result: " + result); 68 75 } 69 76 70 77 Node osmNode = new Node(latlon); 71 osmNode.put("id", "-1");78 osmNode.put("id", id); 72 79 osmNode.put("note", text); 73 80 osmNode.put("openstreetbug", "FIXME");
Note:
See TracChangeset
for help on using the changeset viewer.