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

diff.groovy throws IllegalStateException on not english locale #334

Open
kazachka opened this issue Sep 11, 2018 · 2 comments
Open

diff.groovy throws IllegalStateException on not english locale #334

kazachka opened this issue Sep 11, 2018 · 2 comments

Comments

@kazachka
Copy link

When executing on another (not english) locale, diff.groove throws IllegalStateException with message:
Caught: java.lang.IllegalStateException: Error: git repository /home/kazachka/checkstyle has unstaged changes!
Exception is throwing from here:
https://github.com/checkstyle/contribution/blob/master/checkstyle-tester/diff.groovy#L12
caused because localized git message doesn't contain english text "nothing to commit", so hasUnstagedChanges function returns true.
https://github.com/checkstyle/contribution/blob/master/checkstyle-tester/diff.groovy#L156

@kazachka
Copy link
Author

The command is:

groovy diff.groovy -r /home/zenigata/workspace/checkstyle/ -b upstream/master -p class-fan-out-complexity-check -c ./my_check.xml -l projects-to-test-on.properties

The output is:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/usr/share/groovy/lib/groovy-2.4.15.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Caught: java.lang.IllegalStateException: Error: git repository /home/zenigata/workspace/checkstyle has unstaged changes!
java.lang.IllegalStateException: Error: git repository /home/zenigata/workspace/checkstyle has unstaged changes!
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at diff.run(diff.groovy:12)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

appears on ru-Ru locale.
Adding -Duser.language=en -Duser.country=US parameters doesn't help.

@rnveach
Copy link
Member

rnveach commented Sep 23, 2018

Adding -Duser.language=en -Duser.country=US parameters doesn't help.

This is because groovy executes another command inside of it (checkstyle/git) and it only passes specific parameters to the other commands.

If you can help us with a fix, feel free to create a PR.
I currently don't know if we can tell git to report messages in other languages, or if there is a better way to check for unstaged files.

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