Skip to content
Permalink
Browse files
8274894: Use Optional.empty() instead of ofNullable(null) in HttpResp…
…onse.BodySubscribers.discarding

Reviewed-by: dfuchs
  • Loading branch information
turbanoff authored and dfuch committed Oct 12, 2021
1 parent 33050f8 commit d04d4ee2c193baf4339ee3025e3fbcd31d62f484
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/java.net.http/share/classes/java/net/http/HttpResponse.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1273,7 +1273,7 @@ public static <U> BodySubscriber<U> replacing(U value) {
* @return a response body subscriber
*/
public static BodySubscriber<Void> discarding() {
return new ResponseSubscribers.NullSubscriber<>(Optional.ofNullable(null));
return new ResponseSubscribers.NullSubscriber<>(Optional.empty());
}

/**

1 comment on commit d04d4ee

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on d04d4ee Oct 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.