RFR: 8372746: Some httpserver files could benefit from some formatting cleanup [v2]

Jaikiran Pai jpai at openjdk.org
Mon Dec 8 06:58:05 UTC 2025


On Fri, 5 Dec 2025 10:32:14 GMT, Daisuke Yamazaki <dyama at openjdk.org> wrote:

>> Hello mainteners,
>> 
>> I cleaned up inconsistent spacing across the httpserver codebase.  
>> 
>> 1. Removed extra spaces before parentheses in function and constructor declarations to make them consistent.
>> 2. Applied the same rule to function and constructor calls.
>> 3. Normalised other spacing based on the majority style already used in the codebase.
>> 4. Left spots untouched where keeping the spacing improves readability.
>> 
>> **This PR only adds or removes spaces. No functional changes.**
>> 
>> If you think it would have been better to update only the documentation part and leave the logic untouched, please let me know.
>> I split the commits, so I can easily revert the one that touches the logic.
>
> Daisuke Yamazaki has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix wrong indentation in package-info.java

src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java line 77:

> 75:     }
> 76: 
> 77:     public void write(byte[]b, int off, int len) throws IOException {

Hello @PeyaPeyaPeyang, this is pre-existing but it will be good to leave a space between `byte[]` and `b`. I'm slightly surprised that `byte[]b` compiles without any error.

src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java line 87:

> 85:         int remain = CHUNK_SIZE - count;
> 86:         if (len > remain) {
> 87:             System.arraycopy(b,off,buf,pos,remain);

And here too.

src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java line 93:

> 91:             off += remain;
> 92:             while (len >= CHUNK_SIZE) {
> 93:                 System.arraycopy(b,off,buf,OFFSET,CHUNK_SIZE);

Same here, please add a space after each of those commas.

src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java line 101:

> 99:         }
> 100:         if (len > 0) {
> 101:             System.arraycopy(b,off,buf,pos,len);

Since we are touching this code, adding a space after each of those commas will be good.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28660#discussion_r2597249161
PR Review Comment: https://git.openjdk.org/jdk/pull/28660#discussion_r2597253131
PR Review Comment: https://git.openjdk.org/jdk/pull/28660#discussion_r2597252203
PR Review Comment: https://git.openjdk.org/jdk/pull/28660#discussion_r2597251071


More information about the net-dev mailing list