OneBusAway / onebusaway-gtfs-modules

A Java-based library for reading, writing, and transforming public transit data in the GTFS format, including database support.
Other
126 stars 105 forks source link

Ignore locale specific formatting of numbers when writing GTFS #33

Open bdferris opened 10 years ago

bdferris commented 10 years ago

I got a bug report from a user where there lat-lon values where being output with commas (47,3) instead of decimals (47.3) when they were in a European locale.

tvainika commented 3 years ago

This looks very much duplicate of #29, which @bdferris fixed in b81e5c2aff2e7b7371094519fc7ac520c81f80f2.

Based on timing, and opening this issue without details of version in use, could this be simply same issue but the original bug report was against older version?

hbruch commented 2 days ago

Just trying to build current 3.2.3-SNAPSHOT and running into an issue which let's me think it's not solved:

[ERROR] Failures:
[ERROR]   IndividualCsvEntityWriterTest.testDefaultValues:117 expected:<...e,double_value
1234,[2345.80]
,
> but was:<...e,double_value
1234,["2345,80"]
,
>
[INFO]
[ERROR] Tests run: 18, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for onebusaway-gtfs-modules 3.2.3-SNAPSHOT:
[INFO]
[INFO] onebusaway-gtfs-modules ............................ SUCCESS [  5.341 s]
[INFO] onebusaway-csv-entities ............................ FAILURE [  5.589 s]
leonardehrenfried commented 2 days ago

Can you try the v3.1.0 tag and check if it works there?

leonardehrenfried commented 1 day ago

I took a look and I believe I know what is going on: it's not the test of the GTFS libraries that fails but the test of the underlying library csv-entities. This lib used to be here https://github.com/OneBusAway/onebusaway-csv-entities/ but I put the code into this repo for easier maintenance.

This test, which assumes a specific locale, started failing after being copied into this repo when run in a different locale.

Can you confirm this running the tests of the module onebusaway-gtfs only?

You can follow along my progress here: https://github.com/OneBusAway/onebusaway-gtfs-modules/pull/279

leonardehrenfried commented 1 day ago

Now, whether writing decimal values should really be locale-specific is a completely different question.

leonardehrenfried commented 1 day ago

To solve this problem I need to change the default locale in the underlying library: https://github.com/OneBusAway/onebusaway-gtfs-modules/pull/279/commits/a2370173e51db6e65c35028a84d9a8ad29414b11

I can't imagine a use case where that would be wrong and I'm just going to risk some breakage. This would only happen when you use the library csv-entities outside of onebusaway-gtfs as there the locale is already hard-coded.

leonardehrenfried commented 1 day ago

@hbruch Please try again with the latest code and close this issue when it's resolved.