On Fri, 22 Nov 2024 12:58:11 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:

> Some further cleaning in the legacy HTTP implementation. 
> Usual removal of doPrivileged, GetPropertyAction, checkPermission, etc...
> 
> I also took the opportunity to also remove some constructors that were never 
> called in the legacy HttpClient, and to fix some throws signatures.

src/java.base/share/classes/sun/net/NetProperties.java line 43:

> 41:     private static Properties props = new Properties();
> 42:     static {
> 43:         loadDefaultProperties();

Just an idea: `props = loadDefaultProperties()`, so the method doesn't need to 
mutate a global variable.

src/java.base/share/classes/sun/net/www/http/KeepAliveStreamCleaner.java line 
65:

> 63:     static {
> 64:         final String maxDataKey = "http.KeepAlive.remainingData";
> 65:         MAX_DATA_REMAINING = NetProperties.getInteger(maxDataKey, 512) * 
> 1024;

I don't know the context, but `Math.multiplyExact()` can be a safer alternative.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22321#discussion_r1853899868
PR Review Comment: https://git.openjdk.org/jdk/pull/22321#discussion_r1853972768

Reply via email to