On Mon, 11 Apr 2022 05:26:29 GMT, Tejesh R <d...@openjdk.java.net> wrote:

> > I guess in that case "else" part in l359 will be executed...I was talking 
> > about requirement of "else" part in l345
> 
> I did a sample test for this case, it did entered l345, I added \n manually 
> at the end of string, since it passes `if (array[counter] == '\n') {` (l340) 
> condition and fails `if (array[counter - 1] == '\r')` (l342), it executes the 
> else part in l345.....

If you manually add \n to end of string, then as per your previous statements, 
this code block should have `\n\r\n` and then `\n` , right?
Then, I guess user would expect one new line because he manually added \n, 
but as per your observation, the "else" part is executed so wouldn't 
`out.write(array, last, counter - last);`
write the full \n\r\n\n again, ie 3 new lines?

-------------

PR: https://git.openjdk.java.net/jdk/pull/8122

Reply via email to