[ 
https://issues.apache.org/jira/browse/RAT-273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17513062#comment-17513062
 ] 

Philipp Ottlinger edited comment on RAT-273 at 3/27/22, 9:51 PM:
-----------------------------------------------------------------

The usage of StringReader seems to have changed from JDK8 to >JDK16
* https://docs.oracle.com/javase/8/docs/api/java/io/StringReader.html
* 
https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/io/StringReader.html

Lines without explicit line endings were not read in JDK8 while JDK16 pays 
attention to these strings. The underlying class used from within RAT is:
* https://docs.oracle.com/javase/8/docs/api/java/io/LineNumberReader.html
* 
https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/io/LineNumberReader.html

Taken from the Javadocs:
JDK16:
A line is considered to be terminated by any one of a line feed ('\n'), a 
carriage return ('\r'), or a carriage return followed immediately by a 
linefeed, or any of the previous terminators followed by end of stream, or end 
of stream not preceded by another terminator.

JDK8:
A line is considered to be terminated by any one of a line feed ('\n'), a 
carriage return ('\r'), or a carriage return followed immediately by a linefeed.

-> API change: end of streams counts as line ending!


was (Author: hugo.hirsch):
The usage of StringReader seems to have changed from JDK8 to >JDK16
* https://docs.oracle.com/javase/8/docs/api/java/io/StringReader.html
* 
https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/io/StringReader.html

Lines without explicit line endings were not read in JDK8 while JDK16 pays 
attention to these strings. The underlying class used from within RAT is:
* https://docs.oracle.com/javase/8/docs/api/java/io/LineNumberReader.html
* 
https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/io/LineNumberReader.html

> Build failures with >=JDK16 - analyze test behaviour or rewrite tests
> ---------------------------------------------------------------------
>
>                 Key: RAT-273
>                 URL: https://issues.apache.org/jira/browse/RAT-273
>             Project: Apache Rat
>          Issue Type: Bug
>    Affects Versions: 0.14
>            Reporter: Philipp Ottlinger
>            Priority: Major
>
> A Travis build running against
>  DOCKER_IMAGE=maven:3.6.3-openjdk-16  
>  revealed the following test failures:
>  {{Tests run: 5, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.028 sec 
> <<< FAILURE! - in org.apache.rat.header.HeaderMatcherTest
> lines(org.apache.rat.header.HeaderMatcherTest) Time elapsed: 0.01 sec <<< 
> FAILURE!
> java.lang.AssertionError: One line read expected:<1> but was:<2>
> at org.apache.rat.header.HeaderMatcherTest.lines(HeaderMatcherTest.java:84)
> noLines(org.apache.rat.header.HeaderMatcherTest) Time elapsed: 0.002 sec <<< 
> FAILURE!
> java.lang.AssertionError: No lines read expected:<0> but was:<1>
> at 
> org.apache.rat.header.HeaderMatcherTest.noLines(HeaderMatcherTest.java:74)}}
> SUMMARY:
> {{ HeaderMatcherTest.lines:84 One line read expected:<1> but was:<2>
>  HeaderMatcherTest.noLines:74 No lines read expected:<0> but was:<1>}}
> [https://travis-ci.org/github/apache/creadur-rat/jobs/726998247]
> After fixing the bug 
> * Github Action and
> * Travis matrix builds should be changed to at least contain  8, 11, 17, and 
> maybe 18-ea/19-ea (as of 2022-02-10)
>   



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to