aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorblafoo <github@blafoo.de>2012-03-02 20:08:44 +0100
committerblafoo <github@blafoo.de>2012-03-02 20:08:44 +0100
commit7bd56373b7f01d0dd1316d3cdf67793a139247e5 (patch)
tree88b259e307797b0bb69b200c46ac78eaecb3d45a
parent0816152835818260387d6c21a8c912ed150b31be (diff)
downloadcgeo-7bd56373b7f01d0dd1316d3cdf67793a139247e5.zip
cgeo-7bd56373b7f01d0dd1316d3cdf67793a139247e5.tar.gz
cgeo-7bd56373b7f01d0dd1316d3cdf67793a139247e5.tar.bz2
Changed format of JSON key. Fixes #1212
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCBase.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/main/src/cgeo/geocaching/connector/gc/GCBase.java b/main/src/cgeo/geocaching/connector/gc/GCBase.java
index 566ef4a..5f40028 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCBase.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCBase.java
@@ -464,11 +464,16 @@ public class GCBase {
return new String[] { userSession, sessionToken };
}
- private static int[] splitJSONKey(final String key) {
- // two possible positions for the underscore
- int underscore = key.charAt(1) == '_' ? 1 : 2;
- int x = Integer.parseInt(key.substring(0, underscore));
- int y = Integer.parseInt(key.substring(underscore + 1));
+ /**
+ * @param key
+ * Key in the format (xx, xx)
+ * @return
+ */
+ private static int[] splitJSONKey(String key) {
+ // two possible positions for the ,
+ int seperator = key.charAt(2) == ',' ? 2 : 3;
+ int x = Integer.parseInt(key.substring(1, seperator));
+ int y = Integer.parseInt(key.substring(seperator + 2, key.length() - 1));
return new int[] { x, y };
}