diff --git a/README.md b/README.md index c8c49bb..ed1a915 100644 --- a/README.md +++ b/README.md @@ -18,16 +18,16 @@ Depending on which part of the API you use, you can only include what you need: ClassDependencyDescription CapabilitiesApi
de.westnordost:osmapi-core:2.0
Getting server capabilities PermissionsApi
de.westnordost:osmapi-core:2.0
Getting user permissions -MapDataApi
de.westnordost:osmapi-map:2.1
Getting map data, querying single elements and their relations toward each other and uploading changes in changesets -MapDataHistoryApi
de.westnordost:osmapi-map:2.1
Getting the history and specific versions of elements +MapDataApi
de.westnordost:osmapi-map:2.2
Getting map data, querying single elements and their relations toward each other and uploading changes in changesets +MapDataHistoryApi
de.westnordost:osmapi-map:2.2
Getting the history and specific versions of elements NotesApi
de.westnordost:osmapi-notes:2.0
Getting finding, creating, commenting on and solving notes GpsTracesApi
de.westnordost:osmapi-traces:2.0
Getting, uploading, updating and deleting GPS traces and trackpoints -ChangesetsApi
de.westnordost:osmapi-changesets:2.1
Finding changesets, changeset discussion, subscription and data +ChangesetsApi
de.westnordost:osmapi-changesets:2.2
Finding changesets, changeset discussion, subscription and data UserApi
de.westnordost:osmapi-user:2.0
Getting user information UserPreferencesApi
de.westnordost:osmapi-user:2.0
Managing user preferences -To include everything, add [`de.westnordost:osmapi:4.1`](https://mvnrepository.com/artifact/de.westnordost/osmapi/4.0) as a Maven dependency or download the jar from there. +To include everything, add [`de.westnordost:osmapi:4.2`](https://mvnrepository.com/artifact/de.westnordost/osmapi/4.0) as a Maven dependency or download the jar from there. ### Android @@ -35,7 +35,7 @@ On Android, you need to exclude kxml2 from the dependencies since it is already ```gradle dependencies { - implementation 'de.westnordost:osmapi:4.0' + implementation 'de.westnordost:osmapi:4.2' } configurations { diff --git a/build.gradle b/build.gradle index 4b829b9..6af9993 100644 --- a/build.gradle +++ b/build.gradle @@ -8,16 +8,16 @@ subprojects { group = "de.westnordost" - sourceCompatibility = 1.7 - targetCompatibility = 1.7 + sourceCompatibility = 1.8 + targetCompatibility = 1.8 } ext { - all_version = 4.1 + all_version = 4.2 core_version = 2.0 - changesets_version = 2.1 + changesets_version = 2.2 user_version = 2.0 traces_version = 2.0 notes_version = 2.0 - map_version = 2.1 + map_version = 2.2 } \ No newline at end of file diff --git a/libs/map/src/main/java/de/westnordost/osmapi/map/data/OsmTags.java b/libs/map/src/main/java/de/westnordost/osmapi/map/data/OsmTags.java index cccba4b..6083f09 100644 --- a/libs/map/src/main/java/de/westnordost/osmapi/map/data/OsmTags.java +++ b/libs/map/src/main/java/de/westnordost/osmapi/map/data/OsmTags.java @@ -37,15 +37,15 @@ public void putAll(Map map) private static void checkKeyValueLength(String key, String value) { - if(key.length() > 256) + if(key.codePoints().count() >= 256) { throw new IllegalArgumentException("For key \"" + key + "\": Key length is limited" + - "to less or equal 256 characters."); + " to less than 256 characters."); } - if(value.length() > 256) + if(value.codePoints().count() >= 256) { throw new IllegalArgumentException("For value \"" + value + "\": Value length is " + - "limited to less or equal 256 characters."); + "limited to less than 256 characters."); } } } diff --git a/libs/map/src/test/java/de/westnordost/osmapi/map/data/OsmTagsTest.java b/libs/map/src/test/java/de/westnordost/osmapi/map/data/OsmTagsTest.java index 18e613e..0b1bc52 100644 --- a/libs/map/src/test/java/de/westnordost/osmapi/map/data/OsmTagsTest.java +++ b/libs/map/src/test/java/de/westnordost/osmapi/map/data/OsmTagsTest.java @@ -14,11 +14,24 @@ public class OsmTagsTest "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy " + "eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptu" + "a. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gube" - + "rgren, no sead takimata "; + + "rgren, no sea takimata "; - @Test public void testStringIsExactly257CharactersLong() + @Test public void testStringIsExactly256CharactersLong() { - assertEquals(257, TOO_LONG.length()); + assertEquals(256, TOO_LONG.length()); + } + + @Test public void initWithKeyOrValueBelow256CharactersIsFine() + { + StringBuilder cools = new StringBuilder(); + while (cools.codePoints().count() < 255) + { + cools.append("\uD83D\uDE0E"); // 😎 + + Map tags = new HashMap<>(); + tags.put(cools.toString(), cools.toString()); + new OsmTags(tags); + } } @Test public void initWithTooLongKeyFails()