Fix issue #5719 - add test and workaround

This commit is contained in:
Victor Shcherb 2018-07-31 12:00:42 +02:00
parent 94b798278e
commit 39abc1e834
3 changed files with 19 additions and 10 deletions

View file

@ -423,6 +423,9 @@ public class GeoPointParserUtil {
if (schemeSpecific == null) {
return null;
}
if(uri.getRawSchemeSpecificPart().contains("%2B")) {
schemeSpecific = schemeSpecific.replace("+", "%2B");
}
String name = null;
final Pattern namePattern = Pattern.compile("[\\+\\s]*\\((.*)\\)[\\+\\s]*$");
@ -441,8 +444,9 @@ public class GeoPointParserUtil {
positionPart = schemeSpecific;
} else {
positionPart = schemeSpecific.substring(0, queryStartIndex);
if (queryStartIndex < schemeSpecific.length())
if (queryStartIndex < schemeSpecific.length()) {
queryPart = schemeSpecific.substring(queryStartIndex + 1);
}
}
final Pattern positionPattern = Pattern.compile(

View file

@ -1,14 +1,24 @@
package net.osmand.util;
import java.net.URI;
import java.net.URLEncoder;
import java.util.Map;
import org.junit.Assert;
import org.junit.Test;
import net.osmand.util.GeoPointParserUtil.GeoParsedPoint;
public class GeoPointParserUtilTest {
@Test
public void testGeoPointUrlDecode() {
// bug in get scheme getSchemeSpecificPart()
// equal results for : URI.create("geo:0,0?q=86HJV99P+29") && URI.create("geo:0,0?q=86HJV99P%2B29");
GeoParsedPoint test = GeoPointParserUtil.parse("geo:0,0?q=86HJV99P%2B29");
Assert.assertEquals(test.getQuery(), "86HJV99P+29");
}
@Test
public void testGeoPoint() {

View file

@ -6,18 +6,13 @@ APP_SHORT_COMMANDS := true
# Specify least supported Android platform version
APP_PLATFORM := android-14
# ifeq ($(wildcard $(ANDROID_NDK)/toolchains/*-4.7),)
# ifeq ($(wildcard $(ANDROID_NDK)/toolchains/*-4.8),)
# NDK_TOOLCHAIN_VERSION := 4.9
# else
# NDK_TOOLCHAIN_VERSION := 4.8
# endif
# else
# NDK_TOOLCHAIN_VERSION := 4.7
# endif
# NDK_TOOLCHAIN_VERSION := 4.7
# NDK_TOOLCHAIN_VERSION := 4.9
# NDK_TOOLCHAIN_VERSION := 4.8
NDK_TOOLCHAIN_VERSION := clang
APP_ABI := x86 armeabi-v7a arm64-v8a
# APP_ABI := armeabi-v7a
ifndef OSMAND_DEBUG_NATIVE
# Force release compilation in release optimizations, even if application is debuggable by manifest
APP_OPTIM := release