For case 3, I have set some encodings at project "Configure" > "Post-build Actions" > "Scan for compiler warnings" > "Advanced" > "Default Encoding".
encodings tried are as follows:

  • blank (default)
  • "windows-31j"
  • "UTF-8"
  • "UTF-16"
  • "euc-jp-linux"

Results are same, 0 warnings.

note) "windows-31j" and "MS932" are same. IANA registration name is "Windows-31J".

Expected to succeed in my environment(Windows OS, platform encoding Windows-31J):

  • blank
  • "windows-31j"

note)blank is explained to mean platform default encoding.

I tried to run jenkins with debugger attachable command-line option, then attached NetBeans debugger to the jenkins and analyzed the situation.

  • jenkins commandline
    > java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8086,suspend=n -jar jenkins-1.579.war
  • put break point at AntJavacParser.isLineInteresting.
    In this point, argument "line" is invalid in any encoding like this.
    "\ufffd\ufffd\ufffd[\ufffdU\ufffd[anonymous\ufffd\ufffd\ufffd\ufffd\ufffds"
    Non ascii character is misconverted.

So, I looked for where reading console output and what encoding specified, from
stack trace from AntJavacParser.isLineInteresting.

The place is at ParserRegistory.createReader

protected Reader createReader(final InputStream inputStream) { return new InputStreamReader(new BOMInputStream(inputStream), defaultCharset); }

The specified encoding is a instance field "defaultCharset".
This field is set in constructor.

public ParserRegistry(final List<? extends AbstractWarningsParser> parsers, final String defaultEncoding,
final String includePattern, final String excludePattern) {
defaultCharset = EncodingValidator.defaultCharset(defaultEncoding);

This ParserRegistry constructor is called from WarningsPublisher.parseConsoleLog method.

Collection<FileAnnotation> warnings = new ParserRegistry(
ParserRegistry.getParsers(parserName),
CONSOLE_LOG_ENCODING, getIncludePattern(), getExcludePattern()).parse(build.getLogFile());

Above code, encoding is specified by WarningsPublisher class final field CONSOLE_LOG_ENCODING.

private static final String CONSOLE_LOG_ENCODING = "UTF-8";

This looks like causing miss detections on non UTF-8 encoding platform.

Possible fix is

Collection<FileAnnotation> warnings = new ParserRegistry(
ParserRegistry.getParsers(parserName),
getDefaultEncoding(), getIncludePattern(),
getExcludePattern()).parse(build.getLogFile());

I changed the 2nd argument from CONSOLE_LOG_ENCODING to getDefaultEncoding().
Then the default encoding specified in configuration is applied, and
warnings can detected on Windows OS windows-31j(MS932) encoding.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to