Skip to content

Commit a05787b

Browse files
committed
merge
2 parents 5dd83f9 + fe08702 commit a05787b

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ public final class HttpRequest {
5555
*/
5656
public static final String USER_AGENT_SUFFIX = "Google-HTTP-Java-Client/" + VERSION + " (gzip)";
5757

58+
/** Whether we've warned about {@link #setAllowEmptyContent} being deprecated. */
59+
private static volatile boolean warnedDeprecatedSetAllowEmptyContent;
60+
61+
/** Whether we've warned about {@link #isAllowEmptyContent} being deprecated. */
62+
private static volatile boolean warnedDeprecatedIsAllowEmptyContent;
63+
5864
/**
5965
* HTTP request execute interceptor to intercept the start of {@link #execute()} (before executing
6066
* the HTTP request) or {@code null} for none.
@@ -585,8 +591,11 @@ public HttpRequest setUnsuccessfulResponseHandler(
585591
@Deprecated
586592
public HttpRequest setAllowEmptyContent(boolean allowEmptyContent) {
587593
this.allowEmptyContent = allowEmptyContent;
588-
HttpTransport.LOGGER.warning("setAllowEmptyContent is deprecated and will be removed in 1.12;"
589-
+ " use setEmptyContent instead (if needed)");
594+
if (!warnedDeprecatedSetAllowEmptyContent) {
595+
HttpTransport.LOGGER.warning("setAllowEmptyContent is deprecated and will be removed in 1.12;"
596+
+ " use setEmptyContent instead (if needed)");
597+
warnedDeprecatedSetAllowEmptyContent = true;
598+
}
590599
return this;
591600
}
592601

@@ -600,7 +609,10 @@ public HttpRequest setAllowEmptyContent(boolean allowEmptyContent) {
600609
*/
601610
@Deprecated
602611
public boolean isAllowEmptyContent() {
603-
HttpTransport.LOGGER.warning("isAllowEmptyContent is deprecated and will be removed in 1.12");
612+
if (!warnedDeprecatedIsAllowEmptyContent) {
613+
HttpTransport.LOGGER.warning("isAllowEmptyContent is deprecated and will be removed in 1.12");
614+
warnedDeprecatedIsAllowEmptyContent = true;
615+
}
604616
return allowEmptyContent;
605617
}
606618

0 commit comments

Comments
 (0)