Repository: googleapis/google-http-java-client
Pull request #1228 (2021-01-15 16:44:00)

unused logger
@chingor13 


Patch:
diff --git a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
index 0b9b2abb..7a28ec51 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
@@ -1012,6 +1012,7 @@ public final class HttpRequest {
         LowLevelHttpResponse lowLevelHttpResponse = lowLevelHttpRequest.execute();
         if (lowLevelHttpResponse != null) {
           OpenCensusUtils.recordReceivedMessageEvent(span, lowLevelHttpResponse.getContentLength());
+          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;
diff --git a/google-http-client/src/main/java/com/google/api/client/util/store/FileDataStoreFactory.java b/google-http-client/src/main/java/com/google/api/client/util/store/FileDataStoreFactory.java
index 5bcab867..98c5003e 100644
--- a/google-http-client/src/main/java/com/google/api/client/util/store/FileDataStoreFactory.java
+++ b/google-http-client/src/main/java/com/google/api/client/util/store/FileDataStoreFactory.java
@@ -37,7 +37,6 @@ import java.nio.file.attribute.UserPrincipal;
 import java.util.HashSet;
 import java.util.Locale;
 import java.util.Set;
-import java.util.logging.Logger;
 
 /**
  * Thread-safe file implementation of a credential store.
@@ -55,8 +54,6 @@ import java.util.logging.Logger;
  */
 public class FileDataStoreFactory extends AbstractDataStoreFactory {
 
-  private static final Logger LOGGER = Logger.getLogger(FileDataStoreFactory.class.getName());
-
   private static final boolean IS_WINDOWS =
       StandardSystemProperty.OS_NAME.value().toLowerCase(Locale.ENGLISH).startsWith("windows");
 
diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml
index 9aa97cc5..ac040ab3 100644
--- a/samples/snippets/pom.xml
+++ b/samples/snippets/pom.xml
@@ -30,7 +30,7 @@
       <dependency>
         <groupId>com.google.cloud</groupId>
         <artifactId>libraries-bom</artifactId>
-        <version>16.2.1</version>
+        <version>16.3.0</version>
         <type>pom</type>
         <scope>import</scope>
       </dependency>
@@ -63,7 +63,7 @@
     <dependency>
       <groupId>com.google.http-client</groupId>
       <artifactId>google-http-client-gson</artifactId>
-      <version>1.38.0</version>
+      <version>1.38.1</version>
       <scope>test</scope>
     </dependency>
     <!-- END_EXCLUDE -->


Test patch:
diff --git a/google-http-client/src/test/java/com/google/api/client/http/HttpRequestTracingTest.java b/google-http-client/src/test/java/com/google/api/client/http/HttpRequestTracingTest.java
index d2d2df5d..6fc9cb37 100644
--- a/google-http-client/src/test/java/com/google/api/client/http/HttpRequestTracingTest.java
+++ b/google-http-client/src/test/java/com/google/api/client/http/HttpRequestTracingTest.java
@@ -80,6 +80,7 @@ public class HttpRequestTracingTest {
     assertAttributeEquals(span, "http.host", "google.com");
     assertAttributeEquals(span, "http.url", "https://google.com/");
     assertAttributeEquals(span, "http.method", "GET");
+    assertAttributeEquals(span, "http.status_code", "200");
 
     // Ensure we have a single annotation for starting the first attempt
     assertEquals(1, span.getAnnotations().getEvents().size());