Changeset 11058 in josm
- Timestamp:
- 2016-09-27T09:27:42+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Preferences.java
r10952 r11058 18 18 import java.lang.reflect.Field; 19 19 import java.nio.charset.StandardCharsets; 20 import java.util.AbstractMap; 20 21 import java.util.ArrayList; 21 22 import java.util.Collection; … … 38 39 import java.util.regex.Matcher; 39 40 import java.util.regex.Pattern; 41 import java.util.stream.Collectors; 40 42 import java.util.stream.Stream; 41 43 … … 1526 1528 "validator.org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.entries", 1527 1529 "resource://data/validator/power.mapcss"); 1530 // drop in March 2017 1531 if (loadedVersion < 11058) { 1532 migrateOldColorKeys(); 1533 } 1528 1534 1529 1535 for (String key : OBSOLETE_PREF_KEYS) { … … 1533 1539 } 1534 1540 } 1541 } 1542 1543 private void migrateOldColorKeys() { 1544 settingsMap.keySet().stream() 1545 .filter(key -> key.startsWith("color.")) 1546 .flatMap(key -> { 1547 final String newKey = ColorProperty.getColorKey(key.substring("color.".length())); 1548 return key.equals(newKey) || settingsMap.containsKey(newKey) 1549 ? Stream.empty() 1550 : Stream.of(new AbstractMap.SimpleImmutableEntry<>(key, newKey)); 1551 }) 1552 .collect(Collectors.toList()) // to avoid ConcurrentModificationException 1553 .forEach(entry -> { 1554 final String oldKey = entry.getKey(); 1555 final String newKey = entry.getValue(); 1556 Main.info("Migrating old color key {0} => {1}", oldKey, newKey); 1557 put(newKey, get(oldKey)); 1558 put(oldKey, null); 1559 }); 1535 1560 } 1536 1561
Note:
See TracChangeset
for help on using the changeset viewer.