Skip to content

Commit 3311095

Browse files
GerdPGerdP
authored andcommitted
fix #23748: NPE: Reverse way direction: Automatic tag correction
(furter already expected regrression from r19101) - don't use Map.ofEntries() when map may contain null keys or values I try to write a unit test for this as well git-svn-id: https://josm.openstreetmap.de/svn/trunk@19124 0c6e7542-c601-0410-84e7-c038aed88b3b
1 parent f0f3e59 commit 3311095

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/org/openstreetmap/josm/tools/Utils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,8 +665,8 @@ public static <K, V> Map<K, V> toUnmodifiableMap(Map<K, V> map) {
665665
final Map.Entry<K, V> entry = map.entrySet().iterator().next();
666666
return Collections.singletonMap(entry.getKey(), entry.getValue());
667667
}
668-
// Map.copyOf would also work, but if the original map is immutable, it just returns the original map.
669-
return Map.ofEntries(map.entrySet().toArray(new Map.Entry[0]));
668+
// see #23748 don't use Map.ofEntries as it doesn't allow null keys or values
669+
return Collections.unmodifiableMap(map);
670670
}
671671

672672
/**

0 commit comments

Comments
 (0)