dhananjay6561 opened a new pull request, #3643: URL: https://github.com/apache/maven-surefire/pull/3643
`RunEntryStatisticsMap.serialize` writes one line per entry and adds the line break before the next entry at the end of the loop. When an entry has no method name, the loop hit `continue` before that line break, so the entry and the next one ended up on the same line: ``` 1,10,abc,1,42,def,test ``` Reading the file back, `fromStream` treats this as class `abc` with method `1,42,def,test`, and the real `def#test` entry is lost. This is the statistics file used by `runOrder=balanced` and `runOrder=failedfirst`, so their data gets corrupted whenever a class-level entry (null method name) is not the last one written. The fix only writes the method lines when there is a method name, and always reaches the line break between entries. Nothing changes for entries that have a method name, or for a class-level entry that happens to be last. Test: `RunEntryStatisticsMapTest.testSerializeClassFollowedByMethod` serializes a class-level entry followed by a method entry, checks that the file has two lines (`1,10,abc,` and `1,42,def,test`), and checks that reading it back gives both entries with the right run time. Before the fix the file had a single line. --- To make clear that you license your contribution under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) check one of the following: - [x] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) - [ ] I hereby declare that I have filed an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
