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

"Locale" issues when compiling log-synth #35

Open
assis opened this issue Aug 24, 2019 · 3 comments
Open

"Locale" issues when compiling log-synth #35

assis opened this issue Aug 24, 2019 · 3 comments

Comments

@assis
Copy link

assis commented Aug 24, 2019

Hi, there! While compiling log-synth, maven reported failures when performing tests, which prevented it from completing the building process. For example, when testing ZipSampler, an error was produced when trying to convert a string like "99,9999" to double by using Java's Double.parseDouble(). I realized it was happening because of "locale issues". I am in Brazil, using Xubuntu 18.04. In my terminals, the default locale is "pt_BR.UTF-8". Here, a comma (",") is used as decimal separator (instead of "."). In ZipSampler, for example, an Exception was being raised because of line 262:

return accept(Double.parseDouble(latitude), Double.parseDouble(longitude));

Lines 256 and 257 are as follows:

String longitude = location.get("longitude").asText();
String latitude = location.get("latitude").asText();

Due to my locale, asText() method produces floating point strings using "," as decimal separator. In order to get the code compiled, I executed

export LC_ALL=en_US.utf8
export LANG=en_US.utf8 (just in case)

on a terminal, ran

mvn clean
mvn package

and compilation was successfully finished.

If there is an easier way to solve this issue, please let me know. If not, I'd suggest to set locale to "en_US-UTF-8" on testing classes.

Also, if anything more than "mvn package" is required for compilation, please let me know. I could not find compilation instructions on log-synth documentation.

Thanks!

@assis assis changed the title Locale issues when compiling log-synth "Locale" issues when compiling log-synth Aug 24, 2019
@tdunning
Copy link
Owner

tdunning commented Aug 24, 2019 via email

@assis
Copy link
Author

assis commented Aug 25, 2019

You're welcome! Thank you for sharing log-synth!

I never used Jackson. I believe it is "locale-aware". Maybe, this could help: it seems the ObjectMapper class has a method called setLocale() that may be useful:

https://www.tutorialspoint.com/jackson/jackson_quick_guide.htm

I didn't find any way to set it globally, but, as I said, I never used this suite before.
I wish I could help more. If you find a solution, please let me know.

Best Regards!

@tdunning
Copy link
Owner

tdunning commented Aug 25, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants