RFR: 8294361: Cleanup usages of StringBuffer in SQLOutputImpl

Roger Riggs rriggs at openjdk.org
Mon Sep 26 18:45:37 UTC 2022


On Mon, 26 Sep 2022 16:08:23 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

>> src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java line 328:
>> 
>>> 326:         try {
>>> 327:             int i;
>>> 328:             while ((i = bufReader.read()) != -1) {
>> 
>> Is the single character read really necessary?
>> BufferedReader.readLine() returns null on EOF.
>> It seems plausable that only the readLine and writeString are needed in the loop.
>> 
>> Similarly, for the read loops below for InputStreams and binary stream.
>> The BufferedReader and readline can be used for the binary streams by constructing with the ASCII Charset.
>
> If this single character is `\n`, then direct replacing with `readLine` would change behavior of the method.

I see your point and this PR isn't the place to figure out why a single newline in the attributes Vector would be significant vs an empty string or no entry.

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

PR: https://git.openjdk.org/jdk/pull/10320


More information about the core-libs-dev mailing list