Skip to content

Commit b60ff7b

Browse files
author
Yaniv Inbar
committed
[http issue 131] Removed deprecated classes/methods/fields from version 1.9 and 1.10
http://codereview.appspot.com/6454174/
1 parent 1de2a8c commit b60ff7b

22 files changed

+48
-273
lines changed

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@
3636
* </p>
3737
*
3838
* <p>
39-
* Warning: in prior version 1.9 the maximum amount of content read from the input stream was
40-
* limited by the {@link #getLength()}, but now instead all content is read. You may use
41-
* {@link LimitInputStream} if that functionality is needed.
39+
* By default, all content is read from the input stream. If instead you want to limit the maximum
40+
* amount of content read from the input stream, you may use {@link LimitInputStream}.
4241
* </p>
4342
*
4443
* @since 1.4
@@ -72,10 +71,6 @@ public AbstractInputStreamContent(String type) {
7271
* {@link #retrySupported()} this should be a factory function which will create a new
7372
* {@link InputStream} from the source data whenever invoked.
7473
*
75-
* <p>
76-
* Upgrade warning: in prior version 1.6 {@link #getInputStream} was protected, it is now public.
77-
* </p>
78-
*
7974
* @since 1.7
8075
*/
8176
public abstract InputStream getInputStream() throws IOException;
@@ -191,8 +186,9 @@ static void downloadMedia(HttpResponse response, File file)
191186
* @param closeInputStream whether the input stream should be closed at the end of this method
192187
* @since 1.7
193188
*/
194-
public static void copy(InputStream inputStream, OutputStream outputStream,
195-
boolean closeInputStream) throws IOException {
189+
public static void copy(
190+
InputStream inputStream, OutputStream outputStream, boolean closeInputStream)
191+
throws IOException {
196192
try {
197193
ByteStreams.copy(inputStream, outputStream);
198194
} finally {

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@ public interface BackOffPolicy {
6060
* }
6161
* </pre>
6262
*
63-
* <p>
64-
* Upgrade warning: {@link #getNextBackOffMillis} now throws an {@link IOException}, it was not
65-
* thrown prior to 1.9.
66-
* </p>
67-
*
6863
* @return the number of milliseconds to wait when backing off requests, or {@link #STOP} if no
6964
* more retries should be made
7065
*/

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@
2929
* implemented using {@link HttpHeaders#setBasicAuthentication(String, String)}.
3030
* </p>
3131
*
32-
* <p>
33-
* Warning: for backwards-compatibility {@link #initialize} also calls
34-
* {@link #intercept(HttpRequest)}, but this call will be removed in version 1.8.
35-
* </p>
36-
*
3732
* @since 1.7
3833
* @author Yaniv Inbar
3934
*/
@@ -50,7 +45,6 @@ public BasicAuthentication(String username, String password) {
5045

5146
public void initialize(HttpRequest request) throws IOException {
5247
request.setInterceptor(this);
53-
intercept(request);
5448
}
5549

5650
public void intercept(HttpRequest request) throws IOException {

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,6 @@ public final void reset() {
233233
* Subclasses may override if a different algorithm is required.
234234
* </p>
235235
*
236-
* <p>
237-
* Upgrade warning: {@link #getNextBackOffMillis} now throws an {@link IOException}, it was not
238-
* thrown prior to 1.9.
239-
* </p>
240-
*
241236
* @return the number of milliseconds to wait when backing off requests, or {@link #STOP} if no
242237
* more retries should be made
243238
*/

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,6 @@ public final void setContentEncoding(String contentEncoding) {
257257
/**
258258
* Returns the {@code "Content-Length"} header or {@code null} for none.
259259
*
260-
* <p>
261-
* Upgrade warning: in prior version content length was represented as a String, but now it is
262-
* represented as a Long.
263-
* </p>
264-
*
265260
* @since 1.5
266261
*/
267262
public final Long getContentLength() {
@@ -271,11 +266,6 @@ public final Long getContentLength() {
271266
/**
272267
* Sets the {@code "Content-Length"} header or {@code null} for none.
273268
*
274-
* <p>
275-
* Upgrade warning: in prior version content length was represented as a String, but now it is
276-
* represented as a Long.
277-
* </p>
278-
*
279269
* @since 1.5
280270
*/
281271
public final void setContentLength(Long contentLength) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*
2828
* @since 1.0
2929
* @author Yaniv Inbar
30-
* @deprecated (scheduled to be removed in 1.11) Use {@link ObjectParser} instead.
30+
* @deprecated (scheduled to be removed in 1.12) Use {@link ObjectParser} instead.
3131
*/
3232
@Deprecated
3333
public interface HttpParser {

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

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,6 @@ static String executeAndGetValueOfSomeCustomHeader(HttpRequest request) {
117117
* <p>
118118
* Defaults to 16KB.
119119
* </p>
120-
*
121-
* <p>
122-
* Upgrade warning: prior to version 1.9, the default was {@code 100,000} bytes, but now it is
123-
* 16KB.
124-
* </p>
125120
*/
126121
private int contentLoggingLimit = 0x4000;
127122

@@ -341,11 +336,6 @@ public HttpRequest setBackOffPolicy(BackOffPolicy backOffPolicy) {
341336
* Defaults to 16KB.
342337
* </p>
343338
*
344-
* <p>
345-
* Upgrade warning: prior to version 1.9, the default was {@code 100,000} bytes, but now it is
346-
* 16KB.
347-
* </p>
348-
*
349339
* @since 1.7
350340
*/
351341
public int getContentLoggingLimit() {
@@ -372,11 +362,6 @@ public int getContentLoggingLimit() {
372362
* Defaults to 16KB.
373363
* </p>
374364
*
375-
* <p>
376-
* Upgrade warning: prior to version 1.9, the default was {@code 100,000} bytes, but now it is
377-
* 16KB.
378-
* </p>
379-
*
380365
* @since 1.7
381366
*/
382367
public HttpRequest setContentLoggingLimit(int contentLoggingLimit) {
@@ -659,7 +644,7 @@ public HttpRequest setNumberOfRetries(int numRetries) {
659644
* </p>
660645
*
661646
* @since 1.4
662-
* @deprecated (scheduled to be removed in 1.11) Use {@link #setParser(ObjectParser)} instead.
647+
* @deprecated (scheduled to be removed in 1.12) Use {@link #setParser(ObjectParser)} instead.
663648
*/
664649
@Deprecated
665650
public void addParser(HttpParser parser) {
@@ -689,7 +674,7 @@ public HttpRequest setParser(ObjectParser parser) {
689674
* @param contentType content type or {@code null} for {@code null} result
690675
* @return HTTP response content parser or {@code null} for {@code null} input
691676
* @since 1.4
692-
* @deprecated (scheduled to be removed in 1.11) Use {@link #getParser()} instead.
677+
* @deprecated (scheduled to be removed in 1.12) Use {@link #getParser()} instead.
693678
*/
694679
@Deprecated
695680
public final HttpParser getParser(String contentType) {
@@ -1129,7 +1114,7 @@ private void sleep(long millis) {
11291114
* {@code null} result
11301115
* @return normalized media type without parameters or {@code null} for {@code null} input
11311116
* @since 1.4
1132-
* @deprecated (scheduled to be removed in 1.11) Use
1117+
* @deprecated (scheduled to be removed in 1.12) Use
11331118
* {@link HttpMediaType#equalsIgnoreParameters(HttpMediaType)} instead
11341119
*/
11351120
@Deprecated

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

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,6 @@ public final class HttpResponse {
189189
* Defaults to {@link HttpRequest#getContentLoggingLimit()}.
190190
* </p>
191191
*
192-
* <p>
193-
* Upgrade warning: prior to version 1.9, the default was {@code 100,000} bytes, but now it is
194-
* {@link HttpRequest#getContentLoggingLimit()}.
195-
* </p>
196-
*
197192
* @since 1.7
198193
*/
199194
public int getContentLoggingLimit() {
@@ -220,11 +215,6 @@ public int getContentLoggingLimit() {
220215
* Defaults to {@link HttpRequest#getContentLoggingLimit()}.
221216
* </p>
222217
*
223-
* <p>
224-
* Upgrade warning: prior to version 1.9, the default was {@code 100,000} bytes, but now it is
225-
* {@link HttpRequest#getContentLoggingLimit()}.
226-
* </p>
227-
*
228218
* @since 1.7
229219
*/
230220
public HttpResponse setContentLoggingLimit(int contentLoggingLimit) {
@@ -446,12 +436,8 @@ public void ignore() throws IOException {
446436
}
447437

448438
/**
449-
* Close the HTTP response content and disconnect using {@link LowLevelHttpResponse#disconnect()}.
450-
*
451-
* <p>
452-
* Upgrade warning: since version 1.10 {@link #disconnect} now closes the HTTP response content
453-
* input stream. This was not done by this method prior to version 1.10.
454-
* </p>
439+
* Close the HTTP response content using {@link #ignore}, and disconnect using
440+
* {@link LowLevelHttpResponse#disconnect()}.
455441
*
456442
* @since 1.4
457443
*/
@@ -464,7 +450,7 @@ public void disconnect() throws IOException {
464450
* Returns the HTTP response content parser to use for the content type of this HTTP response or
465451
* {@code null} for none.
466452
*
467-
* @deprecated (scheduled to be removed in 1.11) Use {@link #getRequest()}.
453+
* @deprecated (scheduled to be removed in 1.12) Use {@link #getRequest()}.
468454
* {@link HttpRequest#getParser()} instead
469455
*/
470456
@Deprecated
@@ -479,9 +465,9 @@ public HttpParser getParser() {
479465
* <p>
480466
* <b>Upgrade Warning:</b> Prior to version 1.11 this method would throw an
481467
* {@link IllegalArgumentException} when no Content-Type is present in the response and the
482-
* deprecated HttpParsers were used. Since 1.11 this method will return {@code null} as
483-
* documented when the server responds with a status code indicating that there is no content,
484-
* or when a HEAD request was made to the server.
468+
* deprecated HttpParsers were used. Since 1.11 this method will return {@code null} as documented
469+
* when the server responds with a status code indicating that there is no content, or when a HEAD
470+
* request was made to the server.
485471
* </p>
486472
*
487473
* <p>
@@ -516,8 +502,8 @@ public <T> T parseAs(Class<T> dataClass) throws IOException {
516502
}
517503

518504
/**
519-
* Returns {@code true} if this response contains a message body. Implemented according to
520-
* {@href http://tools.ietf.org/html/rfc2616#section-4.3}.
505+
* Returns {@code true} if this response contains a message body. Implemented according to {@href
506+
* http://tools.ietf.org/html/rfc2616#section-4.3}.
521507
*/
522508
private boolean hasMessageBody() {
523509
if (getRequest().getMethod() == HttpMethod.HEAD) {
@@ -528,8 +514,8 @@ private boolean hasMessageBody() {
528514
if (statusCode / 100 == 1) { // 1xx
529515
return false;
530516
}
531-
if (statusCode == HttpStatusCodes.STATUS_CODE_NO_CONTENT ||
532-
statusCode == HttpStatusCodes.STATUS_CODE_NOT_MODIFIED) {
517+
if (statusCode == HttpStatusCodes.STATUS_CODE_NO_CONTENT
518+
|| statusCode == HttpStatusCodes.STATUS_CODE_NOT_MODIFIED) {
533519
return false;
534520
}
535521

@@ -561,10 +547,10 @@ public Object parseAs(Type dataType) throws IOException {
561547
* </p>
562548
*
563549
* <p>
564-
* Warning: in prior version 1.9 the maximum amount of content parsed for un-GZipped content was
565-
* set by the Content-Length header, but now instead all content is read. Also, prior version
566-
* assumed the charset was {@code "UTF-8"}, but now it follows the specification by parsing the
567-
* "charset" parameter of the Content-Type header or {@code "ISO-8859-1"} if missing.
550+
* All content is read from the input content stream rather than being limited by the
551+
* Content-Length. For the character set, it follows the specification by parsing the "charset"
552+
* parameter of the Content-Type header or by default {@code "ISO-8859-1"} if the parameter is
553+
* missing.
568554
* </p>
569555
*
570556
* @return parsed string or {@code ""} for no content

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

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,29 +91,18 @@ public HttpResponseException(HttpResponse response, String message) {
9191
* Returns whether received a successful HTTP status code {@code >= 200 && < 300} (see
9292
* {@link #getStatusCode()}).
9393
*
94-
* <p>
95-
* Upgrade warning: Overriding this method is no longer supported, and will be made final in
96-
* 1.10.
97-
* </p>
98-
*
99-
*
10094
* @since 1.7
10195
*/
102-
public boolean isSuccessStatusCode() {
96+
public final boolean isSuccessStatusCode() {
10397
return HttpStatusCodes.isSuccess(statusCode);
10498
}
10599

106100
/**
107101
* Returns the HTTP status code or {@code 0} for none.
108102
*
109-
* <p>
110-
* Upgrade warning: Overriding this method is no longer supported, and will be made final in
111-
* 1.10.
112-
* </p>
113-
*
114103
* @since 1.7
115104
*/
116-
public int getStatusCode() {
105+
public final int getStatusCode() {
117106
return statusCode;
118107
}
119108

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,12 @@ public abstract class LowLevelHttpRequest {
4242
* {@link #addHeader} will be called for each instance of the header.
4343
* </p>
4444
*
45-
* <p>
46-
* Warning: in prior version 1.9 there was no IOException declared as thrown, but
47-
* in version 1.10 an IOException may be thrown.
48-
* </p>
49-
*
5045
* @param name header name
5146
* @param value header value
5247
*/
5348
public abstract void addHeader(String name, String value) throws IOException;
5449

55-
/**
56-
* Sets the HTTP request content.
57-
*
58-
* @throws IOException I/O exception
59-
*/
50+
/** Sets the HTTP request content. */
6051
public abstract void setContent(HttpContent content) throws IOException;
6152

6253
/**

0 commit comments

Comments
 (0)