Skip to content

Commit 8f95371

Browse files
authored
fix: deprecate obsolete utility methods (#1231)
* unused logger * first batch if deprecations fior superseded utility methods * format
1 parent e1fb4bb commit 8f95371

File tree

9 files changed

+25
-9
lines changed

9 files changed

+25
-9
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,9 @@ public HttpResponse execute() throws IOException {
10121012
LowLevelHttpResponse lowLevelHttpResponse = lowLevelHttpRequest.execute();
10131013
if (lowLevelHttpResponse != null) {
10141014
OpenCensusUtils.recordReceivedMessageEvent(span, lowLevelHttpResponse.getContentLength());
1015-
span.putAttribute(HttpTraceAttributeConstants.HTTP_STATUS_CODE, AttributeValue.longAttributeValue(lowLevelHttpResponse.getStatusCode()));
1015+
span.putAttribute(
1016+
HttpTraceAttributeConstants.HTTP_STATUS_CODE,
1017+
AttributeValue.longAttributeValue(lowLevelHttpResponse.getStatusCode()));
10161018
}
10171019
// Flag used to indicate if an exception is thrown before the response is constructed.
10181020
boolean responseConstructed = false;

google-http-client/src/main/java/com/google/api/client/util/Base64.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
*
2323
* @since 1.8
2424
* @author Yaniv Inbar
25+
* @deprecated use com.google.common.io.BaseEncoding#base64
2526
*/
27+
@Deprecated
2628
public class Base64 {
2729

2830
/**

google-http-client/src/main/java/com/google/api/client/util/Beta.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
*
4242
* @since 1.15
4343
* @author Eyal Peled
44+
* @deprecated use com.google.common.annotations.Beta
4445
*/
4546
@Target(
4647
value = {
@@ -52,4 +53,5 @@
5253
ElementType.PACKAGE
5354
})
5455
@Documented
56+
@Deprecated
5557
public @interface Beta {}

google-http-client/src/main/java/com/google/api/client/util/ByteArrayStreamingContent.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
*
2525
* @since 1.14
2626
* @author Yaniv Inbar
27+
* @deprecated use com.google.common.io.ByteSource
2728
*/
29+
@Deprecated
2830
public class ByteArrayStreamingContent implements StreamingContent {
2931

3032
/** Byte array content. */

google-http-client/src/main/java/com/google/api/client/util/ByteStreams.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@
2222
/**
2323
* Provides utility methods for working with byte arrays and I/O streams.
2424
*
25-
* <p>NOTE: this is a copy of a subset of Guava's {@link com.google.common.io.ByteStreams}. The
26-
* implementation must match as closely as possible to Guava's implementation.
27-
*
2825
* @since 1.14
2926
* @author Yaniv Inbar
27+
* @deprecated use Guava's com.google.common.io.ByteStreams
3028
*/
29+
@Deprecated
3130
public final class ByteStreams {
3231

3332
private static final int BUF_SIZE = 0x1000; // 4K

google-http-client/src/main/java/com/google/api/client/util/Charsets.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package com.google.api.client.util;
1616

1717
import java.nio.charset.Charset;
18+
import java.nio.charset.StandardCharsets;
1819

1920
/**
2021
* Contains constant definitions for some standard {@link Charset} instances that are guaranteed to
@@ -25,14 +26,16 @@
2526
*
2627
* @since 1.14
2728
* @author Yaniv Inbar
29+
* @deprecated use java.nio.charset.StandardCharsets
2830
*/
31+
@Deprecated
2932
public final class Charsets {
3033

3134
/** UTF-8 charset. */
32-
public static final Charset UTF_8 = Charset.forName("UTF-8");
35+
public static final Charset UTF_8 = StandardCharsets.UTF_8;
3336

3437
/** ISO-8859-1 charset. */
35-
public static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1");
38+
public static final Charset ISO_8859_1 = StandardCharsets.ISO_8859_1;
3639

3740
private Charsets() {}
3841
}

google-http-client/src/main/java/com/google/api/client/util/Collections2.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@
1919
/**
2020
* Static utility methods pertaining to {@link Collection} instances.
2121
*
22-
* <p>NOTE: this is a copy of a subset of Guava's {@link com.google.common.collect.Collections2}.
23-
* The implementation must match as closely as possible to Guava's implementation.
24-
*
2522
* @since 1.14
2623
* @author Yaniv Inbar
24+
* @deprecated use Guava's {@link com.google.common.collect.Collections2}
2725
*/
26+
@Deprecated
2827
public final class Collections2 {
2928

3029
/** Used to avoid http://bugs.sun.com/view_bug.do?bug_id=6558557. */

google-http-client/src/main/java/com/google/api/client/util/IOUtils.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ public class IOUtils {
5454
*
5555
* @param inputStream source input stream
5656
* @param outputStream destination output stream
57+
* @deprecated use {@link com.google.common.io.ByteStreams#copy(InputStream, OutputStream)}
5758
*/
59+
@Deprecated
5860
public static void copy(InputStream inputStream, OutputStream outputStream) throws IOException {
5961
copy(inputStream, outputStream, true);
6062
}
@@ -79,7 +81,9 @@ public static void copy(InputStream inputStream, OutputStream outputStream) thro
7981
* @param inputStream source input stream
8082
* @param outputStream destination output stream
8183
* @param closeInputStream whether the input stream should be closed at the end of this method
84+
* @deprecated use {@link com.google.common.io.ByteStreams#copy(InputStream, OutputStream)}
8285
*/
86+
@Deprecated
8387
public static void copy(
8488
InputStream inputStream, OutputStream outputStream, boolean closeInputStream)
8589
throws IOException {
@@ -173,6 +177,7 @@ public static <S extends Serializable> S deserialize(InputStream inputStream) th
173177
* Returns whether the given file is a symbolic link.
174178
*
175179
* @since 1.16
180+
* @deprecated use java.nio.file.Path#isSymbolicLink
176181
*/
177182
public static boolean isSymbolicLink(File file) throws IOException {
178183
// first try using Java 7

google-http-client/src/main/java/com/google/api/client/util/StreamingContent.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
*
2525
* @since 1.14
2626
* @author Yaniv Inbar
27+
* @deprecated use com.google.common.io.ByteSink
2728
*/
29+
@Deprecated
2830
public interface StreamingContent {
2931

3032
/**

0 commit comments

Comments
 (0)