[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elevation serialization for values > 1000m is incompatible with deserialization #162

Closed
raynigon opened this issue Apr 7, 2022 · 0 comments · Fixed by #163
Closed

Elevation serialization for values > 1000m is incompatible with deserialization #162

raynigon opened this issue Apr 7, 2022 · 0 comments · Fixed by #163
Assignees
Labels
Milestone

Comments

@raynigon
Copy link
Contributor
raynigon commented Apr 7, 2022

Issue description

I currently use the library to serialize and deserialize GPX for analysis.
Some files contain elevation values greater than 1000m.
For these files the elevation is serialized with a comma as "thousand separator".
When the serialized GPX data is deserialized, Double.parseDouble is used,
which does not support the given Syntax.

Steps to reproduce the issue

  1. Generate a GPX object with at least one waypoint which has an elevation greater 1000m
  2. Serialze the object with the GPX.Writer#write method
  3. Deserialize the object with the GPX.Reader#read method

What's the expected result?

  • No exception is thrown
  • The deserialized object contains exactly the same data

What's the actual result?

  • A java.io.InvalidObjectException Exception is thrown

Additional details

Code
GPX gpx = GPX.builder()
        .addWayPoint { wp ->
            wp.ele(1234.5).build(1.2, 3.4)
        }
        .build()
String gpxString = GPX.Writer.DEFAULT.toString(gpx)
GPX result = GPX.Reader.DEFAULT.fromString(gpxString)
Stacktrace
java.io.InvalidObjectException: Invalid GPX: Invalid value for 'ele': For input string: "1,234.5"
	at io.jenetics.jpx.GPX$Reader.read(GPX.java:1183)
	at io.jenetics.jpx.GPX$Reader.read(GPX.java:1209)
	at io.jenetics.jpx.GPX$Reader.fromString(GPX.java:1271)
@raynigon raynigon changed the title Elevation serialization for values > 1000m generates incompatible values Elevation serialization for values > 1000m is incompatible with deseriallization Apr 7, 2022
@raynigon raynigon changed the title Elevation serialization for values > 1000m is incompatible with deseriallization Elevation serialization for values > 1000m is incompatible with deserialization Apr 7, 2022
@jenetics jenetics added this to the v3.0.1 milestone Apr 11, 2022
@jenetics jenetics self-assigned this Apr 11, 2022
@jenetics jenetics added the bug label Apr 11, 2022
jenetics added a commit that referenced this issue Apr 11, 2022
jenetics added a commit that referenced this issue Apr 11, 2022
jenetics added a commit that referenced this issue Apr 11, 2022
jenetics added a commit that referenced this issue Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants