Skip to content

fixes decimal format in createGPX for locales with comma as separator - #1209

Merged
karussell merged 1 commit into
graphhopper:masterfrom
ChristophKaser:locale_fix
Nov 2, 2017
Merged

karussell merged 1 commit into
graphhopper:masterfrom
ChristophKaser:locale_fix

Conversation

@ChristophKaser

Copy link
Copy Markdown
Contributor

When I try to build the current master on a system with German locale, I get the following test failures:

InstructionListTest.testCreateGPX:483->verifyGPX:517 Runtime org.xml.sax.SAXPa...
InstructionListTest.testCreateGPXIncludesRoundaboutExitNumber:409->verifyGPX:517 Runtime
InstructionListTest.testCreateGPXWithEle:443->verifyGPX:517 Runtime org.xml.sa...
InstructionListTest.testInstructionsWithTimeAndPlace:319->verifyGPX:517 Runtime

They are caused by this exception:

java.lang.RuntimeException: org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 30; cvc-datatype-valid.1.2.1: '12,0' ist kein gültiger Wert für 'decimal'.
	at com.graphhopper.util.InstructionListTest.verifyGPX(InstructionListTest.java:517)
	at com.graphhopper.util.InstructionListTest.testCreateGPXWithEle(InstructionListTest.java:443)
Caused by: org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1: '12,0' ist kein gültiger Wert für 'decimal'.
	at com.graphhopper.util.InstructionListTest.verifyGPX(InstructionListTest.java:515)
	at com.graphhopper.util.InstructionListTest.testCreateGPXWithEle(InstructionListTest.java:443)

..., which is thrown because the generated gpx contains attributes like this:
<rtept lat="0,000852" lon="0,000852">

This PR fixes the problem by setting the decimal symbols used by the NumberFormat to Locale.US.

@karussell karussell added this to the 0.10 milestone Nov 2, 2017
@karussell

Copy link
Copy Markdown
Member

Thanks!

Using the platform/default locale is always ugly. I think there was a tool used in lucene detecting such usage

@karussell
karussell merged commit fb1feab into graphhopper:master Nov 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants