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

Loading Categories or Confusables json files might fail if not using UTF-8 #1

Closed
sharon-rozinsky opened this issue Dec 22, 2021 · 3 comments

Comments

@sharon-rozinsky
Copy link

First off, great library 😀 I'm using it for one of my projects but I encountered a problem.

I have unit tests that instantiate the Categories and Confusbles objects as required (I tried both fromInternal and fromJson).
When running from my local machine everything works as expected but when I try to build my project from my Jenkins machine the tests fail due to the following error:
com.google.gson.JsonSyntaxException: duplicate key: ???

I tried to investigate and came to the conclusion that the categories.json and confusables.json files are not read properly on my Jenkins machine, causing some symbols to be read the same, as '???', and therefore when these files are loaded to their internal data structure in code we get this error.

I looked at the code and noticed that the method that loads these json files is:
UsesJsonData -> boolean loadJson(InputStream stream)
In this method if I change the line: try (Reader reader = new InputStreamReader(stream))
and specify UTF-8 like this: try (Reader reader = new InputStreamReader(stream, StandardCharsets.UTF_8))
my tests are working and I'm not getting this exception anymore.

Would it be possible to add this fix?

@sharon-rozinsky
Copy link
Author

Thanks for fixing this issue.
Will this version also be uploaded to mvnrepository.com so it can be consumed from maven?

@SpaceFox
Copy link
Owner

Hi,

I expected to release v1.1.0 with the fix and up-to-date dependencies, but I am stuck with new Maven release plugin and PGP-signin hell.

I’ll try to release this version, but I’m not at home and I’m not sure it will work. If it will require a release from my home computer, this will not be before the 3rd of January 2022.

@SpaceFox
Copy link
Owner

SpaceFox commented Mar 2, 2022

Hi,

v1.1.1 has been released (it’s v1.1.0 with release process fix…) and should be available at maven-central in few hours.

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