Skip to content

Commit

Permalink
fix: deprecate obsolete utility methods (#1231)
Browse files Browse the repository at this point in the history
* unused logger

* first batch if deprecations fior superseded utility methods

* format
  • Loading branch information
elharo committed Jan 22, 2021
1 parent e1fb4bb commit 8f95371
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 9 deletions.
Expand Up @@ -1012,7 +1012,9 @@ public HttpResponse execute() throws IOException {
LowLevelHttpResponse lowLevelHttpResponse = lowLevelHttpRequest.execute();
if (lowLevelHttpResponse != null) {
OpenCensusUtils.recordReceivedMessageEvent(span, lowLevelHttpResponse.getContentLength());
span.putAttribute(HttpTraceAttributeConstants.HTTP_STATUS_CODE, AttributeValue.longAttributeValue(lowLevelHttpResponse.getStatusCode()));
span.putAttribute(
HttpTraceAttributeConstants.HTTP_STATUS_CODE,
AttributeValue.longAttributeValue(lowLevelHttpResponse.getStatusCode()));
}
// Flag used to indicate if an exception is thrown before the response is constructed.
boolean responseConstructed = false;
Expand Down
Expand Up @@ -22,7 +22,9 @@
*
* @since 1.8
* @author Yaniv Inbar
* @deprecated use com.google.common.io.BaseEncoding#base64
*/
@Deprecated
public class Base64 {

/**
Expand Down
Expand Up @@ -41,6 +41,7 @@
*
* @since 1.15
* @author Eyal Peled
* @deprecated use com.google.common.annotations.Beta
*/
@Target(
value = {
Expand All @@ -52,4 +53,5 @@
ElementType.PACKAGE
})
@Documented
@Deprecated
public @interface Beta {}
Expand Up @@ -24,7 +24,9 @@
*
* @since 1.14
* @author Yaniv Inbar
* @deprecated use com.google.common.io.ByteSource
*/
@Deprecated
public class ByteArrayStreamingContent implements StreamingContent {

/** Byte array content. */
Expand Down
Expand Up @@ -22,12 +22,11 @@
/**
* Provides utility methods for working with byte arrays and I/O streams.
*
* <p>NOTE: this is a copy of a subset of Guava's {@link com.google.common.io.ByteStreams}. The
* implementation must match as closely as possible to Guava's implementation.
*
* @since 1.14
* @author Yaniv Inbar
* @deprecated use Guava's com.google.common.io.ByteStreams
*/
@Deprecated
public final class ByteStreams {

private static final int BUF_SIZE = 0x1000; // 4K
Expand Down
Expand Up @@ -15,6 +15,7 @@
package com.google.api.client.util;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

/**
* Contains constant definitions for some standard {@link Charset} instances that are guaranteed to
Expand All @@ -25,14 +26,16 @@
*
* @since 1.14
* @author Yaniv Inbar
* @deprecated use java.nio.charset.StandardCharsets
*/
@Deprecated
public final class Charsets {

/** UTF-8 charset. */
public static final Charset UTF_8 = Charset.forName("UTF-8");
public static final Charset UTF_8 = StandardCharsets.UTF_8;

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

private Charsets() {}
}
Expand Up @@ -19,12 +19,11 @@
/**
* Static utility methods pertaining to {@link Collection} instances.
*
* <p>NOTE: this is a copy of a subset of Guava's {@link com.google.common.collect.Collections2}.
* The implementation must match as closely as possible to Guava's implementation.
*
* @since 1.14
* @author Yaniv Inbar
* @deprecated use Guava's {@link com.google.common.collect.Collections2}
*/
@Deprecated
public final class Collections2 {

/** Used to avoid http://bugs.sun.com/view_bug.do?bug_id=6558557. */
Expand Down
Expand Up @@ -54,7 +54,9 @@ public class IOUtils {
*
* @param inputStream source input stream
* @param outputStream destination output stream
* @deprecated use {@link com.google.common.io.ByteStreams#copy(InputStream, OutputStream)}
*/
@Deprecated
public static void copy(InputStream inputStream, OutputStream outputStream) throws IOException {
copy(inputStream, outputStream, true);
}
Expand All @@ -79,7 +81,9 @@ public static void copy(InputStream inputStream, OutputStream outputStream) thro
* @param inputStream source input stream
* @param outputStream destination output stream
* @param closeInputStream whether the input stream should be closed at the end of this method
* @deprecated use {@link com.google.common.io.ByteStreams#copy(InputStream, OutputStream)}
*/
@Deprecated
public static void copy(
InputStream inputStream, OutputStream outputStream, boolean closeInputStream)
throws IOException {
Expand Down Expand Up @@ -173,6 +177,7 @@ public static <S extends Serializable> S deserialize(InputStream inputStream) th
* Returns whether the given file is a symbolic link.
*
* @since 1.16
* @deprecated use java.nio.file.Path#isSymbolicLink
*/
public static boolean isSymbolicLink(File file) throws IOException {
// first try using Java 7
Expand Down
Expand Up @@ -24,7 +24,9 @@
*
* @since 1.14
* @author Yaniv Inbar
* @deprecated use com.google.common.io.ByteSink
*/
@Deprecated
public interface StreamingContent {

/**
Expand Down

0 comments on commit 8f95371

Please sign in to comment.