Skip to content

Commit

Permalink
Converting preferences loaded from json file from Long to Integer. Be…
Browse files Browse the repository at this point in the history
…casuse in Java a Long value is not equal to a similar Integer value. Who could imagine this...
  • Loading branch information
barancev committed Oct 28, 2014
1 parent 4103276 commit 25d1823
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion java/client/src/org/openqa/selenium/firefox/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,20 @@ private void readDefaultPreferences(Reader defaultsReader) {
for (Map.Entry<String, Object> entry : frozen.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
if (value instanceof Long) {
value = new Integer(((Long)value).intValue());
}
setPreference(key, value);
immutablePrefs.put(key, value);
}

Map<String, Object> mutable = (Map<String, Object>) map.get("mutable");
for (Map.Entry<String, Object> entry : mutable.entrySet()) {
setPreference(entry.getKey(), entry.getValue());
Object value = entry.getValue();
if (value instanceof Long) {
value = new Integer(((Long)value).intValue());
}
setPreference(entry.getKey(), value);
}
} catch (IOException e) {
throw new WebDriverException(e);
Expand Down

0 comments on commit 25d1823

Please sign in to comment.