Merge branch 'release/1.10.3'
This commit is contained in:
commit
fa8da81778
@ -10,6 +10,10 @@ Official GPX format is on [topografix](https://www.topografix.com/GPX/1/1/) site
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
### 2023-03-26
|
||||||
|
|
||||||
|
1) Fixed signature reading
|
||||||
|
|
||||||
### 2023-02-13
|
### 2023-02-13
|
||||||
|
|
||||||
1) Fixed missed extensions
|
1) Fixed missed extensions
|
||||||
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<artifactId>GpxAndroidSdk</artifactId>
|
<artifactId>GpxAndroidSdk</artifactId>
|
||||||
<groupId>me.bvn13.sdk.android.gpx</groupId>
|
<groupId>me.bvn13.sdk.android.gpx</groupId>
|
||||||
<version>1.10.2</version>
|
<version>1.10.3</version>
|
||||||
|
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
@ -33,9 +33,7 @@ class GpxReader {
|
|||||||
.trim()
|
.trim()
|
||||||
.replace("'", "\"")
|
.replace("'", "\"")
|
||||||
.replace(" ?", "?")
|
.replace(" ?", "?")
|
||||||
if (GpxConstant.HEADER != signaturePrepared
|
if (!signaturePrepared.startsWith("<?xml") || !signaturePrepared.endsWith("?>")) {
|
||||||
&& GpxConstant.HEADER_EXTENDED != signaturePrepared
|
|
||||||
) {
|
|
||||||
throw IllegalArgumentException("Wrong xml signature!")
|
throw IllegalArgumentException("Wrong xml signature!")
|
||||||
}
|
}
|
||||||
return readBeginning(dis, Container.empty(container.position))
|
return readBeginning(dis, Container.empty(container.position))
|
||||||
|
@ -430,4 +430,84 @@ class GpxReaderTest {
|
|||||||
Assertions.assertEquals(20, gpxType.trk?.get(0)?.trkseg?.get(0)?.trkpt?.size ?: 0)
|
Assertions.assertEquals(20, gpxType.trk?.get(0)?.trkseg?.get(0)?.trkpt?.size ?: 0)
|
||||||
Assertions.assertEquals(4, gpxType.trk?.get(0)?.trkseg?.get(0)?.trkpt?.get(0)?.extensions?.size ?: 0)
|
Assertions.assertEquals(4, gpxType.trk?.get(0)?.trkseg?.get(0)?.trkpt?.get(0)?.extensions?.size ?: 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DisplayName("Read track-2023-03-09--21-10-54.gpx")
|
||||||
|
@Test
|
||||||
|
fun readTestGpx_v_1_10_3() {
|
||||||
|
val gpxType = GpxType.read(javaClass.classLoader.getResource("track-2023-03-09--21-10-54.gpx").openStream())
|
||||||
|
Assertions.assertEquals(4, gpxType.trk?.get(0)?.trkseg?.get(0)?.trkpt?.get(0)?.extensions?.size ?: 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
@DisplayName("test xml signature")
|
||||||
|
@Test
|
||||||
|
fun testXmlSignature() {
|
||||||
|
val gpx = """<gpx
|
||||||
|
xmlns="http://www.topografix.com/GPX/1/1"
|
||||||
|
version="1.1"
|
||||||
|
creator="me.bvn13.sdk.android.gpx"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
|
||||||
|
<time>2022-09-24T15:04:00+03:00</time>
|
||||||
|
<metadata>
|
||||||
|
<name>test name</name>
|
||||||
|
<desc></desc>
|
||||||
|
<author>
|
||||||
|
<name></name>
|
||||||
|
</author>
|
||||||
|
</metadata>
|
||||||
|
<trk>
|
||||||
|
<name>track1</name>
|
||||||
|
<trkseg>
|
||||||
|
<trkpt lat="123.0" lon="321.0">
|
||||||
|
</trkpt>
|
||||||
|
</trkseg>
|
||||||
|
</trk>
|
||||||
|
</gpx>"""
|
||||||
|
GpxType.read("""
|
||||||
|
<?xml version="1.0" standalone="yes" encoding="UTF-8"?>
|
||||||
|
$gpx
|
||||||
|
""".trim()
|
||||||
|
.lineSequence()
|
||||||
|
.map {
|
||||||
|
it.trim()
|
||||||
|
}
|
||||||
|
.joinToString("\n")
|
||||||
|
.byteInputStream()
|
||||||
|
)
|
||||||
|
GpxType.read("""
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
$gpx
|
||||||
|
""".trim()
|
||||||
|
.lineSequence()
|
||||||
|
.map {
|
||||||
|
it.trim()
|
||||||
|
}
|
||||||
|
.joinToString("\n")
|
||||||
|
.byteInputStream()
|
||||||
|
)
|
||||||
|
GpxType.read(
|
||||||
|
"""
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
$gpx
|
||||||
|
""".trim()
|
||||||
|
.lineSequence()
|
||||||
|
.map {
|
||||||
|
it.trim()
|
||||||
|
}
|
||||||
|
.joinToString("\n")
|
||||||
|
.byteInputStream()
|
||||||
|
)
|
||||||
|
GpxType.read(
|
||||||
|
"""
|
||||||
|
<?xml?>
|
||||||
|
$gpx
|
||||||
|
""".trim()
|
||||||
|
.lineSequence()
|
||||||
|
.map {
|
||||||
|
it.trim()
|
||||||
|
}
|
||||||
|
.joinToString("\n")
|
||||||
|
.byteInputStream()
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
28731
src/test/resources/track-2023-03-09--21-10-54.gpx
Normal file
28731
src/test/resources/track-2023-03-09--21-10-54.gpx
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user