Changeset 8541 in josm


Ignore:
Timestamp:
2015-06-28T14:38:26+02:00 (4 years ago)
Author:
wiktorn
Message:

Cast JsonValue to JsonString and use getString instead of toString on preferences deserialization. Prevents from adding additional quotation marks in values. Closes: #11611

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r8513 r8541  
    4545import javax.json.JsonObjectBuilder;
    4646import javax.json.JsonReader;
     47import javax.json.JsonString;
    4748import javax.json.JsonValue;
    4849import javax.json.JsonWriter;
     
    13611362            ret = new HashMap(object.size());
    13621363            for (Entry<String, JsonValue> e: object.entrySet()) {
    1363                 ret.put(e.getKey(), e.getValue().toString());
     1364                JsonValue value = e.getValue();
     1365                if (value instanceof JsonString) {
     1366                    // in some cases, when JsonValue.toString() is called, then additional quotation marks are left in value
     1367                    ret.put(e.getKey(), ((JsonString)value).getString());
     1368                } else {
     1369                    ret.put(e.getKey(), e.getValue().toString());
     1370                }
    13641371            }
    13651372        }
Note: See TracChangeset for help on using the changeset viewer.