RFR: 8267262: com/sun/net/httpserver/Filter improve API documentation of static methods

Daniel Fuchs dfuchs at openjdk.java.net
Wed May 19 09:10:52 UTC 2021

On Tue, 18 May 2021 09:34:25 GMT, Julia Boes <jboes at openjdk.org> wrote:

> The filter operation `Consumer` that is passed to the factory methods can throw an unchecked exception. This change adds a note on the exception handling in that case. It also adds a clarification to `Filter::afterHandler` on the relation of the filter operation and the client receiving the response.

Marked as reviewed by dfuchs (Reviewer).

src/jdk.httpserver/share/classes/com/sun/net/httpserver/Filter.java line 213:

> 211:      * Doing so is likely to fail, since the exchange has commonly been handled
> 212:      * before the {@code operation} is invoked. Correspondingly, the client
> 213:      * commonly receives the response before the filter operation is executed.

I'd rather replace `commonly` with `may`: this is essentially racy and you cannot assume that any of the outcome is more likely than the other.

     * [...]  Correspondingly, the client
     * may receive the response before the filter operation is executed.


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

More information about the net-dev mailing list