Changeset 17564 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolutionUtil.java
r17093 r17564 298 298 public String resolve(Set<String> values) { 299 299 Set<String> results = instantiateSortedSet(); 300 for (String value: values) { 301 String[] parts = value.split(Pattern.quote(separator), -1); 302 results.addAll(Arrays.asList(parts)); 300 String pattern = Pattern.quote(separator); 301 try { 302 for (String value: values) { 303 results.addAll(Arrays.asList(value.split(pattern, -1))); 304 } 305 } catch (NumberFormatException e) { 306 Logging.error("Unable to parse {0} values in {1} -> {2}", sort, this, e.getMessage()); 307 Logging.debug(e); 308 results = values; 303 309 } 304 310 return String.join(separator, results); -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolutionUtilTest.java
r17275 r17564 5 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 6 import static org.junit.jupiter.api.Assertions.assertNull; 7 import static org.junit.jupiter.api.Assertions.assertThrows; 7 8 import static org.junit.jupiter.api.Assertions.assertTrue; 8 import static org.junit.jupiter.api.Assertions.assertThrows;9 9 10 10 import java.util.Arrays; … … 213 213 void testResolve() { 214 214 for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine("random", "", true, "|", "String"))) { 215 assertEquals( resolver.resolve(newHashSet("value1", "value2")), "value1|value2");216 assertEquals( resolver.resolve(newHashSet("3|1", "4|2|1", "6|05", "3;1")), "05|1|2|3|3;1|4|6");215 assertEquals("value1|value2", resolver.resolve(newHashSet("value1", "value2"))); 216 assertEquals("05|1|2|3|3;1|4|6", resolver.resolve(newHashSet("3|1", "4|2|1", "6|05", "3;1"))); 217 217 } 218 218 219 219 for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine("test[45].*", "", true, ";", "Integer"))) { 220 assertEquals( resolver.resolve(newHashSet("1254545;95;24", "25;24;3")), "3;24;25;95;1254545");220 assertEquals("3;24;25;95;1254545", resolver.resolve(newHashSet("1254545;95;24", "25;24;3"))); 221 221 } 222 222 … … 224 224 String resolution = resolver.resolve(newHashSet("3;x;1", "4;x")); 225 225 assertTrue(resolution.equals("3;x;1;4") || resolution.equals("4;x;3;1")); 226 } 227 228 for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine("foo", "", true, ";", "Integer"))) { 229 assertEquals("bar;1;2;3", resolver.resolve(newHashSet("1;2;3", "bar"))); 226 230 } 227 231 }
Note:
See TracChangeset
for help on using the changeset viewer.