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

Translation doesn't obey no halt on exception and doesn't show path to bad file #6340

Closed
rnveach opened this issue Jan 2, 2019 · 2 comments
Milestone

Comments

@rnveach
Copy link
Member

rnveach commented Jan 2, 2019

$ cat TestConfig.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
          "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
          "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">

<module name="Checker">
    <property name="charset" value="UTF-8"/>
    <property name="severity" value="warning"/>
    <property name="haltOnException" value="false"/>

<module name="Translation">
  <property name="id" value="Translation1" />
</module>
<module name="Translation">
  <property name="baseName" value="^.*$"/>
  <property name="id" value="Translation2" />
  <property name="requiredTranslations" value="es"/>
</module>
<module name="Translation">
  <property name="baseName" value="^.*$"/>
  <property name="id" value="Translation3" />
  <property name="requiredTranslations" value="es, fr"/>
</module>

</module>

$ java -Xmx3024m -jar /home/ricky/opensource/checkstyle/target/checkstyle-8.17-SNAPSHOT-all.jar -c TestConfig.xml -f xml -o results.xml /home/ricky/regression_repositories/openjdk7 -e /home/ricky/regression_repositories/openjdk7/.git
Exception in thread "main" java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
    at java.util.Properties.loadConvert(Properties.java:574)
    at java.util.Properties.load0(Properties.java:391)
    at java.util.Properties.load(Properties.java:341)
    at com.puppycrawl.tools.checkstyle.checks.TranslationCheck.getTranslationKeys(TranslationCheck.java:481)
    at com.puppycrawl.tools.checkstyle.checks.TranslationCheck.checkTranslationKeys(TranslationCheck.java:442)
    at com.puppycrawl.tools.checkstyle.checks.TranslationCheck.finishProcessing(TranslationCheck.java:255)
    at java.util.ArrayList.forEach(ArrayList.java:1255)
    at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:221)
    at com.puppycrawl.tools.checkstyle.Main.runCheckstyle(Main.java:390)
    at com.puppycrawl.tools.checkstyle.Main.runCli(Main.java:313)
    at com.puppycrawl.tools.checkstyle.Main.execute(Main.java:180)
    at com.puppycrawl.tools.checkstyle.Main.main(Main.java:119)

I am expecting the exception not to stop Checkstyle execution and it to run to completion.
I am also expecting Checkstyle to tell me which file caused the exception.

@rnveach rnveach changed the title Translation doesn't obey no halt on exception Translation doesn't obey no halt on exception and doesn't show path to bad file Jan 2, 2019
@rnveach
Copy link
Member Author

rnveach commented Jan 2, 2019

CheckstyleException can't be thrown because finishProcessing doesn't allow it.
We would have to print a violation like we do for IO Exceptions. We will have to do this regardless of halt on exception or not.

@rnveach
Copy link
Member Author

rnveach commented Jan 6, 2019

Fix was merged

@rnveach rnveach closed this as completed Jan 6, 2019
@rnveach rnveach added this to the 8.17 milestone Jan 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants