Skip to content

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

@rnveach

Description

@rnveach
$ 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions