Repository: googleapis/google-http-java-client
Pull request #2037 (2024-11-19 20:52:05)

deps: update dependency com.google.errorprone:error_prone_annotations to v2.36.0
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.errorprone:error_prone_annotations](https://errorprone.info) ([source](https://redirect.github.com/google/error-prone)) | `2.30.0` -> `2.36.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/com.google.errorprone:error_prone_annotations/2.36.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.google.errorprone:error_prone_annotations/2.36.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.google.errorprone:error_prone_annotations/2.30.0/2.36.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.google.errorprone:error_prone_annotations/2.30.0/2.36.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>google/error-prone (com.google.errorprone:error_prone_annotations)</summary>

### [`v2.36.0`](https://redirect.github.com/google/error-prone/releases/tag/v2.36.0): Error Prone 2.36.0

[Compare Source](https://redirect.github.com/google/error-prone/compare/v2.35.1...v2.36.0)

Changes:

-   Add new matcher interfaces to `ErrorProneScanner` for AST nodes introduced after Java 11 ([`e5fd194`](https://redirect.github.com/google/error-prone/commit/e5fd194fa21ef9a01e8d4c72489906247aad81c8))
-   Fix compatibility with latest JDK 24 EA builds (https://github.com/google/error-prone/commit/d67bc156b737d13ac693d73a403a11a97804423f)
-   Check that `--should-stop=ifError=FLOW` is set when using the `-Xplugin` integration ([`e71db1f`](https://redirect.github.com/google/error-prone/commit/e71db1f369a9367f6f2db34c4fbd006b6d6238fd))

New checks:

-   [`DuplicateBranches`](https://errorprone.info/bugpattern/DuplicateBranches): Discourage conditional expressions and if statements where both branches are the same
-   [`RedundantControlFlow`](https://errorprone.info/bugpattern/RedundantControlFlow): Reports redundant `continue` statements.

Closed issues: [#&#8203;4633](https://redirect.github.com/google/error-prone/issues/4633), [#&#8203;4646](https://redirect.github.com/google/error-prone/issues/4646)

### [`v2.35.1`](https://redirect.github.com/google/error-prone/releases/tag/v2.35.1): Error Prone 2.35.1

[Compare Source](https://redirect.github.com/google/error-prone/compare/v2.35.0...v2.35.1)

Error Prone's dependency on protobuf has been downgraded to 3.25.5 for this release.

Version 3.25.5 of protobuf still fixes CVE-2024-7254. This release is provided for users who aren't ready to update to 4.x, see also [#&#8203;4584](https://redirect.github.com/google/error-prone/issues/4584) and [#&#8203;4634](https://redirect.github.com/google/error-prone/issues/4634). Future versions of Error Prone will upgrade back to protobuf 4.x.

Full changelog: https://github.com/google/error-prone/compare/v2.35.0...v2.35.1

### [`v2.35.0`](https://redirect.github.com/google/error-prone/releases/tag/v2.35.0): Error Prone  2.35.0

[Compare Source](https://redirect.github.com/google/error-prone/compare/v2.34.0...v2.35.0)

Changes:

-   Fix handling of `\s` before the trailing delimiter in [`MisleadingEscapedSpace`](https://errorprone.info/bugpattern/MisleadingEscapedSpace)
-   [`TimeUnitMismatch`](https://errorprone.info/bugpattern/TimeUnitMismatch) improvements: handle binary trees, consider trees like `fooSeconds * 1000` to have units of millis

New checks:

-   [`JavaDurationGetSecondsToToSeconds`](https://errorprone.info/bugpattern/JavaDurationGetSecondsToToSeconds): Prefer `duration.toSeconds()` over `duration.getSeconds()`

Full changelog: https://github.com/google/error-prone/compare/v2.34.0...v2.35.0

### [`v2.34.0`](https://redirect.github.com/google/error-prone/releases/tag/v2.34.0): Error Prone 2.34.0

[Compare Source](https://redirect.github.com/google/error-prone/compare/v2.33.0...v2.34.0)

Changes:

-   Passing the javac flag `--should-stop=ifError=FLOW` is now required when running Error Prone ([#&#8203;4595](https://redirect.github.com/google/error-prone/issues/4595))
-   The `MemberName` check was renamed to [`IdentifierName`](https://errorprone.info/bugpattern/IdentifierName)

New checks:

-   [`FutureTransformAsync`](https://errorprone.info/bugpattern/FutureTransformAsync): The usage of transformAsync is not necessary when all the return values of the transformation function are immediate futures.
-   [`MisformattedTestData`](https://errorprone.info/bugpattern/MisformattedTestData): Reformats Java source code inside Error Prone test cases.
-   [`MisleadingEscapedSpace`](https://errorprone.info/bugpattern/MisleadingEscapedSpace): Using `\s` anywhere except at the end of a line in a text block is potentially misleading.
-   [`ThrowIfUncheckedKnownUnchecked`](https://errorprone.info/bugpattern/ThrowIfUncheckedKnownUnchecked): `throwIfUnchecked(knownUnchecked)` is equivalent to `throw knownUnchecked`.

Closed issues: [#&#8203;4595](https://redirect.github.com/google/error-prone/issues/4595), [#&#8203;4598](https://redirect.github.com/google/error-prone/issues/4598), [#&#8203;4620](https://redirect.github.com/google/error-prone/issues/4620)

Full changelog: https://github.com/google/error-prone/compare/v2.33.0...v2.34.0

### [`v2.33.0`](https://redirect.github.com/google/error-prone/releases/tag/v2.33.0): Error Prone 2.33.0

[Compare Source](https://redirect.github.com/google/error-prone/compare/v2.32.0...v2.33.0)

Similar to release [2.32.0](https://redirect.github.com/google/error-prone/releases/v2.32.0), the minimum supported JDK version to run Error Prone is JDK 17 ([#&#8203;3803](https://redirect.github.com/google/error-prone/issues/3803)). Using Error Prone to compile code that is deployed to earlier versions is still fully supported, but will require using JDK 17 or newer for compilation and setting `--release` or `-source`/`-target`/`-bootclasspath`.

Changes:

-   Update protobuf version for CVE-2024-7254

New checks:

-   [`ArrayRecordComponent`](https://errorprone.info/bugpattern/ArrayRecordComponent): Record components should not be arrays.

Full changelog: https://github.com/google/error-prone/compare/v2.32.0...v2.33.0

### [`v2.32.0`](https://redirect.github.com/google/error-prone/releases/tag/v2.32.0): Error Prone 2.32.0

[Compare Source](https://redirect.github.com/google/error-prone/compare/v2.31.0...v2.32.0)

The minimum support JDK version to run Error Prone is now JDK 17 ([#&#8203;3803](https://redirect.github.com/google/error-prone/issues/3803)).

Using Error Prone to compile code that is deployed to earlier versions is still fully supported, but will requires using JDK 17 or newer for compilation and setting `--release` or `-source`/`-target`/`-bootclasspath`.

Full changelog: https://github.com/google/error-prone/compare/v2.31.0...v2.32.0

### [`v2.31.0`](https://redirect.github.com/google/error-prone/releases/tag/v2.31.0): Error Prone 2.31.0

[Compare Source](https://redirect.github.com/google/error-prone/compare/v2.30.0...v2.31.0)

This is the last planned minor release of Error Prone that will support running on JDK 11, see [#&#8203;3803](https://redirect.github.com/google/error-prone/issues/3803). Using Error Prone to compile code that is deployed to earlier versions will continue to be fully supported, but will require using JDK 17 or newer for compilation and setting `--release` or `-source`/`-target`/`-bootclasspath`.

Changes:

-   Introduce [`@ThreadSafeTypeParameter`](https://redirect.github.com/google/error-prone/blob/2656f48902f6723f3147caa117372309dbc6c15f/type_annotations/src/main/java/com/google/errorprone/annotations/ThreadSafeTypeParameter.java) with enforcement by [ThreadSafe](https://errorprone.info/bugpattern/ThreadSafe)
-   Improved support for latest JDK 24 EA builds
-   Error Prone is now distributed as a Multi-Release jar ([#&#8203;3756](https://redirect.github.com/google/error-prone/issues/3756))

New checks:

-   [`AutoValueBoxedValues`](https://errorprone.info/bugpattern/AutoValueBoxedValues): AutoValue instances should not usually contain boxed types that are not Nullable. We recommend removing the unnecessary boxing.

Full changelog: https://github.com/google/error-prone/compare/v2.30.0...v2.31.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/googleapis/google-http-java-client).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xOS4wIiwidXBkYXRlZEluVmVyIjoiMzkuNDIuNCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->


dpebot: /gcbrun
dpebot: /gcbrun

Patch:
diff --git a/.github/workflows/renovate_config_check.yaml b/.github/workflows/renovate_config_check.yaml
index 7c5ec786..36da117b 100644
--- a/.github/workflows/renovate_config_check.yaml
+++ b/.github/workflows/renovate_config_check.yaml
@@ -7,7 +7,7 @@ on:
 
 jobs:
   renovate_bot_config_validation:
-    runs-on: ubuntu-22.04
+    runs-on: ubuntu-24.04
 
     steps:
     - name: Checkout code
diff --git a/google-http-client-apache-v5/src/main/java/com/google/api/client/http/apache/v5/Apache5HttpResponse.java b/google-http-client-apache-v5/src/main/java/com/google/api/client/http/apache/v5/Apache5HttpResponse.java
index 1574c8c8..ae3c2ffb 100644
--- a/google-http-client-apache-v5/src/main/java/com/google/api/client/http/apache/v5/Apache5HttpResponse.java
+++ b/google-http-client-apache-v5/src/main/java/com/google/api/client/http/apache/v5/Apache5HttpResponse.java
@@ -46,7 +46,8 @@ final class Apache5HttpResponse extends LowLevelHttpResponse {
 
   @Override
   public InputStream getContent() throws IOException {
-    return new Apache5ResponseContent(entity.getContent(), response);
+    InputStream content = entity == null ? null : entity.getContent();
+    return new Apache5ResponseContent(content, response);
   }
 
   @Override
diff --git a/google-http-client-apache-v5/src/main/java/com/google/api/client/http/apache/v5/Apache5ResponseContent.java b/google-http-client-apache-v5/src/main/java/com/google/api/client/http/apache/v5/Apache5ResponseContent.java
index c2d3091d..dfb6da8a 100644
--- a/google-http-client-apache-v5/src/main/java/com/google/api/client/http/apache/v5/Apache5ResponseContent.java
+++ b/google-http-client-apache-v5/src/main/java/com/google/api/client/http/apache/v5/Apache5ResponseContent.java
@@ -59,8 +59,12 @@ public class Apache5ResponseContent extends InputStream {
 
   @Override
   public void close() throws IOException {
-    wrappedStream.close();
-    response.close();
+    if (wrappedStream != null) {
+      wrappedStream.close();
+    }
+    if (response != null) {
+      response.close();
+    }
   }
 
   @Override
diff --git a/google-http-client-bom/pom.xml b/google-http-client-bom/pom.xml
index 64100950..345d15b4 100644
--- a/google-http-client-bom/pom.xml
+++ b/google-http-client-bom/pom.xml
@@ -133,7 +133,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-javadoc-plugin</artifactId>
-        <version>3.8.0</version>
+        <version>3.11.1</version>
         <configuration>
           <skip>true</skip>
         </configuration>
diff --git a/pom.xml b/pom.xml
index eb087eca..ea76ef66 100644
--- a/pom.xml
+++ b/pom.xml
@@ -138,7 +138,7 @@
       <dependency>
         <groupId>com.google.errorprone</groupId>
         <artifactId>error_prone_annotations</artifactId>
-        <version>2.30.0</version>
+        <version>2.36.0</version>
       </dependency>
       <dependency>
         <groupId>com.google.appengine</groupId>
@@ -258,7 +258,7 @@
       <dependency>
         <groupId>io.grpc</groupId>
         <artifactId>grpc-context</artifactId>
-        <version>1.66.0</version>
+        <version>1.68.2</version>
       </dependency>
       <dependency>
         <groupId>io.opencensus</groupId>
@@ -330,7 +330,7 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-javadoc-plugin</artifactId>
-          <version>3.8.0</version>
+          <version>3.11.1</version>
           <executions>
             <execution>
               <id>attach-javadocs</id>
@@ -610,11 +610,11 @@
       - Internally, update the default features.json file
     -->
     <project.http-client.version>1.45.1</project.http-client.version><!-- {x-version-update:google-http-client-parent:current} -->
-    <project.appengine.version>2.0.29</project.appengine.version>
+    <project.appengine.version>2.0.31</project.appengine.version>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.jsr305.version>3.0.2</project.jsr305.version>
     <project.gson.version>2.11.0</project.gson.version>
-    <project.jackson-core2.version>2.17.2</project.jackson-core2.version>
+    <project.jackson-core2.version>2.18.2</project.jackson-core2.version>
     <project.protobuf-java.version>3.21.12</project.protobuf-java.version>
     <project.guava.version>30.1.1-android</project.guava.version>
     <project.xpp3.version>1.1.4c</project.xpp3.version>
@@ -648,7 +648,7 @@
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-javadoc-plugin</artifactId>
-            <version>3.8.0</version>
+            <version>3.11.1</version>
             <configuration>
               <source>1.8</source>
               <failOnError>false</failOnError>
@@ -806,7 +806,7 @@
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-javadoc-plugin</artifactId>
-            <version>3.8.0</version>
+            <version>3.11.1</version>
             <configuration>
               <doclet>com.microsoft.doclet.DocFxDoclet</doclet>
               <useStandardDocletOptions>false</useStandardDocletOptions>
diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml
index 9730678a..c50e894d 100644
--- a/samples/snippets/pom.xml
+++ b/samples/snippets/pom.xml
@@ -31,7 +31,7 @@
       <dependency>
         <groupId>com.google.cloud</groupId>
         <artifactId>libraries-bom</artifactId>
-        <version>26.44.0</version>
+        <version>26.51.0</version>
         <type>pom</type>
         <scope>import</scope>
       </dependency>


Test patch:
diff --git a/google-http-client-apache-v5/src/test/java/com/google/api/client/http/apache/v5/Apache5HttpResponseTest.java b/google-http-client-apache-v5/src/test/java/com/google/api/client/http/apache/v5/Apache5HttpResponseTest.java
new file mode 100644
index 00000000..d2712b35
--- /dev/null
+++ b/google-http-client-apache-v5/src/test/java/com/google/api/client/http/apache/v5/Apache5HttpResponseTest.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.api.client.http.apache.v5;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.io.InputStream;
+import org.apache.hc.client5.http.classic.methods.HttpPost;
+import org.apache.hc.client5.http.classic.methods.HttpUriRequestBase;
+import org.junit.Test;
+
+public class Apache5HttpResponseTest {
+  @Test
+  public void testNullContent() throws Exception {
+    HttpUriRequestBase base = new HttpPost("http://www.google.com");
+    MockClassicHttpResponse mockResponse = new MockClassicHttpResponse();
+    mockResponse.setEntity(null);
+    Apache5HttpResponse response = new Apache5HttpResponse(base, mockResponse);
+
+    InputStream content = response.getContent();
+
+    assertNotNull(content);
+  }
+}
diff --git a/google-http-client-apache-v5/src/test/java/com/google/api/client/http/apache/v5/Apache5ResponseContentTest.java b/google-http-client-apache-v5/src/test/java/com/google/api/client/http/apache/v5/Apache5ResponseContentTest.java
new file mode 100644
index 00000000..ddbda0dd
--- /dev/null
+++ b/google-http-client-apache-v5/src/test/java/com/google/api/client/http/apache/v5/Apache5ResponseContentTest.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.api.client.http.apache.v5;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.junit.Test;
+
+public class Apache5ResponseContentTest {
+  @Test
+  public void testNullResponseContent_doesNotThrowExceptionOnClose() throws Exception {
+    Apache5ResponseContent response =
+        new Apache5ResponseContent(
+            new InputStream() {
+              @Override
+              public int read() throws IOException {
+                return 0;
+              }
+            },
+            null);
+
+    response.close();
+  }
+
+  @Test
+  public void testNullWrappedContent_doesNotThrowExceptionOnClose() throws Exception {
+    MockClassicHttpResponse mockResponse = new MockClassicHttpResponse();
+    Apache5ResponseContent response = new Apache5ResponseContent(null, mockResponse);
+
+    response.close();
+  }
+}