Repository: googleapis/google-api-java-client
Pull request #2207 (2022-12-09 08:52:46)

chore(deps): bump certifi from 2022.9.24 to 2022.12.7 in /.kokoro
Bumps [certifi](https://github.com/certifi/python-certifi) from 2022.9.24 to 2022.12.7.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/certifi/python-certifi/commit/9e9e840925d7b8e76c76fdac1fab7e6e88c1c3b8"><code>9e9e840</code></a> 2022.12.07</li>
<li>See full diff in <a href="https://github.com/certifi/python-certifi/compare/2022.09.24...2022.12.07">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=certifi&package-manager=pip&previous-version=2022.9.24&new-version=2022.12.7)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/googleapis/google-api-java-client/network/alerts).

</details>


Patch:
diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml
index c1e4d2da..288e3948 100644
--- a/.github/.OwlBot.lock.yaml
+++ b/.github/.OwlBot.lock.yaml
@@ -13,4 +13,4 @@
 # limitations under the License.
 docker:
   image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest
-  digest: sha256:a57d2ea6d1a77aa96c17ad0850b779ec6295f88b6c1da3d214b2095d140a2066
+  digest: sha256:9de537d592b60e5eac73b374a28263969bae91ecdb29b445e894576fbf54851c
diff --git a/.kokoro/presubmit/graalvm-native-17.cfg b/.kokoro/presubmit/graalvm-native-17.cfg
index a3f7fb9d..e20330c3 100644
--- a/.kokoro/presubmit/graalvm-native-17.cfg
+++ b/.kokoro/presubmit/graalvm-native-17.cfg
@@ -3,7 +3,7 @@
 # Configure the docker image for kokoro-trampoline.
 env_vars: {
   key: "TRAMPOLINE_IMAGE"
-  value: "gcr.io/cloud-devrel-kokoro-resources/graalvm17"
+  value: "gcr.io/cloud-devrel-kokoro-resources/graalvm17:22.3.0"
 }
 
 env_vars: {
diff --git a/.kokoro/presubmit/graalvm-native.cfg b/.kokoro/presubmit/graalvm-native.cfg
index 4c7225ec..0fd6ba2f 100644
--- a/.kokoro/presubmit/graalvm-native.cfg
+++ b/.kokoro/presubmit/graalvm-native.cfg
@@ -3,7 +3,7 @@
 # Configure the docker image for kokoro-trampoline.
 env_vars: {
   key: "TRAMPOLINE_IMAGE"
-  value: "gcr.io/cloud-devrel-kokoro-resources/graalvm"
+  value: "gcr.io/cloud-devrel-kokoro-resources/graalvm:22.3.0"
 }
 
 env_vars: {
diff --git a/.kokoro/requirements.in b/.kokoro/requirements.in
index 924f94ae..a5010f77 100644
--- a/.kokoro/requirements.in
+++ b/.kokoro/requirements.in
@@ -17,7 +17,7 @@ pycparser==2.21
 pyperclip==1.8.2
 python-dateutil==2.8.2
 requests==2.27.1
-certifi==2022.9.24
+certifi==2022.12.7
 importlib-metadata==4.8.3
 zipp==3.6.0
 google_api_core==2.8.2
diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt
index 71fcafc7..15c404aa 100644
--- a/.kokoro/requirements.txt
+++ b/.kokoro/requirements.txt
@@ -16,9 +16,9 @@ cachetools==4.2.4 \
     # via
     #   -r requirements.in
     #   google-auth
-certifi==2022.9.24 \
-    --hash=sha256:0d9c601124e5a6ba9712dbc60d9c53c21e34f5f641fe83002317394311bdce14 \
-    --hash=sha256:90c1a32f1d68f940488354e36370f6cca89f0f106db09518524c88d6ed83f382
+certifi==2022.12.7 \
+    --hash=sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3 \
+    --hash=sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18
     # via
     #   -r requirements.in
     #   requests
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f58b8a82..d8965cc0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
 # Changelog
 
+## [2.1.2](https://github.com/googleapis/google-api-java-client/compare/v2.1.1...v2.1.2) (2023-01-03)
+
+
+### Bug Fixes
+
+* Make Details field extends GenericJson so that GoogleJsonError should include any arbitrary error info from services ([#2210](https://github.com/googleapis/google-api-java-client/issues/2210)) ([60939b1](https://github.com/googleapis/google-api-java-client/commit/60939b19a8ab267846a7ec070e469d4b32c3c201))
+
 ## [2.1.1](https://github.com/googleapis/google-api-java-client/compare/v2.1.0...v2.1.1) (2022-12-02)
 
 
diff --git a/google-api-client-android/pom.xml b/google-api-client-android/pom.xml
index a56c4f23..801b0eb0 100644
--- a/google-api-client-android/pom.xml
+++ b/google-api-client-android/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.api-client</groupId>
     <artifactId>google-api-client-parent</artifactId>
-    <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+    <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
     <relativePath>../pom.xml</relativePath>
   </parent>
   <artifactId>google-api-client-android</artifactId>
diff --git a/google-api-client-appengine/pom.xml b/google-api-client-appengine/pom.xml
index f54757a4..7e8967d9 100644
--- a/google-api-client-appengine/pom.xml
+++ b/google-api-client-appengine/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.api-client</groupId>
     <artifactId>google-api-client-parent</artifactId>
-    <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+    <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
     <relativePath>../pom.xml</relativePath>
   </parent>
   <artifactId>google-api-client-appengine</artifactId>
diff --git a/google-api-client-assembly/pom.xml b/google-api-client-assembly/pom.xml
index 46094e03..8cc4800b 100644
--- a/google-api-client-assembly/pom.xml
+++ b/google-api-client-assembly/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.api-client</groupId>
     <artifactId>google-api-client-parent</artifactId>
-    <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+    <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
     <relativePath>../pom.xml</relativePath>
   </parent>
   <groupId>com.google.api-client</groupId>
diff --git a/google-api-client-bom/pom.xml b/google-api-client-bom/pom.xml
index 3f5290ef..29573562 100644
--- a/google-api-client-bom/pom.xml
+++ b/google-api-client-bom/pom.xml
@@ -3,7 +3,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>com.google.api-client</groupId>
   <artifactId>google-api-client-bom</artifactId>
-  <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+  <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
   <packaging>pom</packaging>
 
   <name>Google API Client Library for Java BOM</name>
@@ -63,53 +63,53 @@
       <dependency>
         <groupId>com.google.api-client</groupId>
         <artifactId>google-api-client</artifactId>
-        <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+        <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
       </dependency>
       <dependency>
         <groupId>com.google.api-client</groupId>
         <artifactId>google-api-client-android</artifactId>
-        <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+        <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
       </dependency>
       <dependency>
         <groupId>com.google.api-client</groupId>
         <artifactId>google-api-client-appengine</artifactId>
-        <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+        <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
       </dependency>
       <dependency>
         <groupId>com.google.api-client</groupId>
         <artifactId>google-api-client-assembly</artifactId>
-        <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+        <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
         <type>pom</type>
       </dependency>
       <dependency>
         <groupId>com.google.api-client</groupId>
         <artifactId>google-api-client-gson</artifactId>
-        <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+        <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
       </dependency>
       <dependency>
         <groupId>com.google.api-client</groupId>
         <artifactId>google-api-client-jackson2</artifactId>
-        <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+        <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
       </dependency>
       <dependency>
         <groupId>com.google.api-client</groupId>
         <artifactId>google-api-client-java6</artifactId>
-        <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+        <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
       </dependency>
       <dependency>
         <groupId>com.google.api-client</groupId>
         <artifactId>google-api-client-protobuf</artifactId>
-        <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+        <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
       </dependency>
       <dependency>
         <groupId>com.google.api-client</groupId>
         <artifactId>google-api-client-servlet</artifactId>
-        <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+        <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
       </dependency>
       <dependency>
         <groupId>com.google.api-client</groupId>
         <artifactId>google-api-client-xml</artifactId>
-        <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+        <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
       </dependency>
     </dependencies>
   </dependencyManagement>
diff --git a/google-api-client-gson/pom.xml b/google-api-client-gson/pom.xml
index 1eab33c2..03089f59 100644
--- a/google-api-client-gson/pom.xml
+++ b/google-api-client-gson/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.api-client</groupId>
     <artifactId>google-api-client-parent</artifactId>
-    <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+    <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
     <relativePath>../pom.xml</relativePath>
   </parent>
   <artifactId>google-api-client-gson</artifactId>
diff --git a/google-api-client-jackson2/pom.xml b/google-api-client-jackson2/pom.xml
index eecccec5..1dd2d619 100644
--- a/google-api-client-jackson2/pom.xml
+++ b/google-api-client-jackson2/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.api-client</groupId>
     <artifactId>google-api-client-parent</artifactId>
-    <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+    <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
     <relativePath>../pom.xml</relativePath>
   </parent>
   <artifactId>google-api-client-jackson2</artifactId>
diff --git a/google-api-client-java6/pom.xml b/google-api-client-java6/pom.xml
index 4fdd85d5..d9e8514a 100644
--- a/google-api-client-java6/pom.xml
+++ b/google-api-client-java6/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.api-client</groupId>
     <artifactId>google-api-client-parent</artifactId>
-    <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+    <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
     <relativePath>../pom.xml</relativePath>
   </parent>
   <artifactId>google-api-client-java6</artifactId>
diff --git a/google-api-client-protobuf/pom.xml b/google-api-client-protobuf/pom.xml
index be0e69fd..e41f87bf 100644
--- a/google-api-client-protobuf/pom.xml
+++ b/google-api-client-protobuf/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.api-client</groupId>
     <artifactId>google-api-client-parent</artifactId>
-    <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+    <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
     <relativePath>../pom.xml</relativePath>
   </parent>
   <artifactId>google-api-client-protobuf</artifactId>
diff --git a/google-api-client-servlet/pom.xml b/google-api-client-servlet/pom.xml
index 4228b716..40af231c 100644
--- a/google-api-client-servlet/pom.xml
+++ b/google-api-client-servlet/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.api-client</groupId>
     <artifactId>google-api-client-parent</artifactId>
-    <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+    <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
     <relativePath>../pom.xml</relativePath>
   </parent>
   <artifactId>google-api-client-servlet</artifactId>
diff --git a/google-api-client-xml/pom.xml b/google-api-client-xml/pom.xml
index 4f85b10f..b37e51a9 100644
--- a/google-api-client-xml/pom.xml
+++ b/google-api-client-xml/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.api-client</groupId>
     <artifactId>google-api-client-parent</artifactId>
-    <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+    <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
     <relativePath>../pom.xml</relativePath>
   </parent>
   <artifactId>google-api-client-xml</artifactId>
diff --git a/google-api-client/pom.xml b/google-api-client/pom.xml
index c06f356f..e2dda465 100644
--- a/google-api-client/pom.xml
+++ b/google-api-client/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.api-client</groupId>
     <artifactId>google-api-client-parent</artifactId>
-    <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+    <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
     <relativePath>../pom.xml</relativePath>
   </parent>
   <artifactId>google-api-client</artifactId>
@@ -159,6 +159,11 @@
       <groupId>com.google.http-client</groupId>
       <artifactId>google-http-client</artifactId>
     </dependency>
+    <dependency>
+      <groupId>com.google.code.gson</groupId>
+      <artifactId>gson</artifactId>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>com.google.protobuf</groupId>
       <artifactId>protobuf-java</artifactId>
diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/json/GoogleJsonError.java b/google-api-client/src/main/java/com/google/api/client/googleapis/json/GoogleJsonError.java
index c0f0eb86..dadd172f 100644
--- a/google-api-client/src/main/java/com/google/api/client/googleapis/json/GoogleJsonError.java
+++ b/google-api-client/src/main/java/com/google/api/client/googleapis/json/GoogleJsonError.java
@@ -184,7 +184,7 @@ public class GoogleJsonError extends GenericJson {
     }
   }
 
-  public static class Details {
+  public static class Details extends GenericJson {
     @Key("@type")
     private String type;
 
diff --git a/pom.xml b/pom.xml
index 69a91082..f71d0fd4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>com.google.api-client</groupId>
   <artifactId>google-api-client-parent</artifactId>
-  <version>2.1.2-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
+  <version>2.1.3-SNAPSHOT</version><!-- {x-version-update:google-api-client:current} -->
   <packaging>pom</packaging>
   <name>Parent for the Google API Client Library for Java</name>
   <description>The Google APIs Client Library for Java is a Java client library
@@ -222,6 +222,12 @@
         <version>${project.protobuf-java.version}</version>
         <scope>test</scope>
       </dependency>
+      <dependency>
+        <groupId>com.google.code.gson</groupId>
+        <artifactId>gson</artifactId>
+        <version>${gson.version}</version>
+        <scope>test</scope>
+      </dependency>
     </dependencies>
   </dependencyManagement>
 
@@ -337,7 +343,7 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-dependency-plugin</artifactId>
-          <version>3.3.0</version>
+          <version>3.4.0</version>
         </plugin>
       </plugins>
     </pluginManagement>
@@ -515,6 +521,7 @@
     <project.datanucleus-maven-plugin.version>4.0.3</project.datanucleus-maven-plugin.version>
     <project.servlet-api.version>2.5</project.servlet-api.version>
     <deploy.autorelease>false</deploy.autorelease>
+    <gson.version>2.10</gson.version>
   </properties>
 
   <profiles>
diff --git a/versions.txt b/versions.txt
index 165ef8a9..523ae8a1 100644
--- a/versions.txt
+++ b/versions.txt
@@ -1,4 +1,4 @@
 # Format:
 # module:released-version:current-version
 
-google-api-client:2.1.1:2.1.2-SNAPSHOT
+google-api-client:2.1.2:2.1.3-SNAPSHOT


Test patch:
diff --git a/google-api-client/src/test/java/com/google/api/client/googleapis/json/GoogleJsonErrorTest.java b/google-api-client/src/test/java/com/google/api/client/googleapis/json/GoogleJsonErrorTest.java
index c988804a..380114ae 100644
--- a/google-api-client/src/test/java/com/google/api/client/googleapis/json/GoogleJsonErrorTest.java
+++ b/google-api-client/src/test/java/com/google/api/client/googleapis/json/GoogleJsonErrorTest.java
@@ -28,6 +28,7 @@ import com.google.api.client.testing.http.MockHttpTransport;
 import com.google.api.client.testing.http.MockLowLevelHttpRequest;
 import com.google.api.client.testing.http.MockLowLevelHttpResponse;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import junit.framework.TestCase;
 
 /**
@@ -37,6 +38,7 @@ import junit.framework.TestCase;
  */
 public class GoogleJsonErrorTest extends TestCase {
 
+  public static final com.google.gson.JsonParser JSON_PARSER = new com.google.gson.JsonParser();
   static final JsonFactory FACTORY = new GsonFactory();
   static final String ERROR =
       "{"
@@ -93,6 +95,32 @@ public class GoogleJsonErrorTest extends TestCase {
     assertEquals(ERROR, FACTORY.toString(errorResponse));
   }
 
+  public void testParse_withMultipleErrorTypesInDetails() throws Exception {
+    InputStream errorResponseStream =
+        GoogleJsonErrorTest.class.getResourceAsStream(
+            "errorResponseWithMultipleTypesInDetails.json");
+
+    InputStream expectedParsedErrorResponse =
+        GoogleJsonErrorTest.class.getResourceAsStream(
+            "expectedParsedErrorWithMultipleTypesInDetails.json");
+
+    HttpTransport transport =
+        new ErrorTransport(
+            new MockLowLevelHttpResponse()
+                .setContent(errorResponseStream)
+                .setContentType(Json.MEDIA_TYPE)
+                .setStatusCode(HttpStatusCodes.STATUS_CODE_FORBIDDEN));
+    HttpRequest request =
+        transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
+    request.setThrowExceptionOnExecuteError(false);
+    HttpResponse response = request.execute();
+    com.google.api.client.googleapis.json.GoogleJsonError actualParsedErrorResponse =
+        com.google.api.client.googleapis.json.GoogleJsonError.parse(FACTORY, response);
+    assertEquals(
+        JSON_PARSER.parse(new InputStreamReader(expectedParsedErrorResponse)),
+        JSON_PARSER.parse(FACTORY.toString(actualParsedErrorResponse)));
+  }
+
   public void testParse_withDetails() throws Exception {
     String DETAILS_ERROR =
         "{"
@@ -122,7 +150,8 @@ public class GoogleJsonErrorTest extends TestCase {
     com.google.api.client.googleapis.json.GoogleJsonError errorResponse =
         com.google.api.client.googleapis.json.GoogleJsonError.parse(FACTORY, response);
 
-    assertEquals(DETAILS_ERROR, FACTORY.toString(errorResponse));
+    assertEquals(
+        JSON_PARSER.parse(DETAILS_ERROR), JSON_PARSER.parse(FACTORY.toString(errorResponse)));
     assertNotNull(errorResponse.getDetails());
   }
 
@@ -166,7 +195,8 @@ public class GoogleJsonErrorTest extends TestCase {
     com.google.api.client.googleapis.json.GoogleJsonError errorResponse =
         com.google.api.client.googleapis.json.GoogleJsonError.parse(FACTORY, response);
 
-    assertEquals(DETAILS_ERROR, FACTORY.toString(errorResponse));
+    assertEquals(
+        JSON_PARSER.parse(DETAILS_ERROR), JSON_PARSER.parse(FACTORY.toString(errorResponse)));
     assertNotNull(errorResponse.getDetails().get(2).getReason());
   }
 }
diff --git a/google-api-client/src/test/resources/com/google/api/client/googleapis/json/errorResponseWithMultipleTypesInDetails.json b/google-api-client/src/test/resources/com/google/api/client/googleapis/json/errorResponseWithMultipleTypesInDetails.json
new file mode 100644
index 00000000..fc2826ac
--- /dev/null
+++ b/google-api-client/src/test/resources/com/google/api/client/googleapis/json/errorResponseWithMultipleTypesInDetails.json
@@ -0,0 +1,65 @@
+{
+  "error": {
+    "code": 400,
+    "message": "The template parameters are invalid.",
+    "status": "INVALID_ARGUMENT",
+    "details": [
+      {
+        "@type": "type.googleapis.com/google.dataflow.v1beta3.InvalidTemplateParameters",
+        "reason": "TEST REASON 1",
+        "parameterViolations": [
+          {
+            "parameter": "safeBrowsingApiKey",
+            "description": "Parameter didn't match regex '^[0-9a-zA-Z_]+$'"
+          }
+        ]
+      },
+      {
+        "@type": "type.googleapis.com/google.rpc.DebugInfo",
+        "detail": "test detail"
+      },
+      {
+        "@type": "type.googleapis.com/google.rpc.DebugInfo",
+        "reason": "test reason 2"
+      },
+      {
+        "@type": "type.googleapis.com/google.rpc.BadRequest",
+        "fieldViolations": [
+          {
+            "field": "language_code",
+            "description": "Field is required"
+          }
+        ]
+      },
+      {
+        "@type": "type.googleapis.com/google.chrome.policy.v1.PolicyModificationErrorDetails",
+        "modificationErrors": [
+          {
+            "policyTargetKey": {
+              "targetResource": "orgunits/03ph8a2z19ryqq8"
+            },
+            "policySchema": "chrome.users.BrowserThemeColor",
+            "fieldErrors": [
+              {
+                "field": "browserThemeColor",
+                "error": "Field is an invalid hex color. Only the numbers 0-9 and letters A-F are permitted."
+              }
+            ]
+          }
+        ]
+      },
+      {
+        "@type": "type.googleapis.com/google.mybusiness.v4.ValidationError",
+        "errorDetails": [
+          {
+            "code": 3,
+            "field": "regular_hours.periods.close_time",
+            "message": "Time field must follow hh:mm format.",
+            "value": "25:00"
+          }
+        ]
+      }
+    ]
+  }
+}
+
diff --git a/google-api-client/src/test/resources/com/google/api/client/googleapis/json/expectedParsedErrorWithMultipleTypesInDetails.json b/google-api-client/src/test/resources/com/google/api/client/googleapis/json/expectedParsedErrorWithMultipleTypesInDetails.json
new file mode 100644
index 00000000..7cbf42e7
--- /dev/null
+++ b/google-api-client/src/test/resources/com/google/api/client/googleapis/json/expectedParsedErrorWithMultipleTypesInDetails.json
@@ -0,0 +1,63 @@
+{
+  "code": 400,
+  "message": "The template parameters are invalid.",
+  "status": "INVALID_ARGUMENT",
+  "details": [
+    {
+      "@type": "type.googleapis.com/google.dataflow.v1beta3.InvalidTemplateParameters",
+      "reason": "TEST REASON 1",
+      "parameterViolations": [
+        {
+          "parameter": "safeBrowsingApiKey",
+          "description": "Parameter didn't match regex '^[0-9a-zA-Z_]+$'"
+        }
+      ]
+    },
+    {
+      "@type": "type.googleapis.com/google.rpc.DebugInfo",
+      "detail": "test detail"
+    },
+    {
+      "@type": "type.googleapis.com/google.rpc.DebugInfo",
+      "reason": "test reason 2"
+    },
+    {
+      "@type": "type.googleapis.com/google.rpc.BadRequest",
+      "fieldViolations": [
+        {
+          "field": "language_code",
+          "description": "Field is required"
+        }
+      ]
+    },
+    {
+      "@type": "type.googleapis.com/google.chrome.policy.v1.PolicyModificationErrorDetails",
+      "modificationErrors": [
+        {
+          "policyTargetKey": {
+            "targetResource": "orgunits/03ph8a2z19ryqq8"
+          },
+          "policySchema": "chrome.users.BrowserThemeColor",
+          "fieldErrors": [
+            {
+              "field": "browserThemeColor",
+              "error": "Field is an invalid hex color. Only the numbers 0-9 and letters A-F are permitted."
+            }
+          ]
+        }
+      ]
+    },
+    {
+      "@type": "type.googleapis.com/google.mybusiness.v4.ValidationError",
+      "errorDetails": [
+        {
+          "code": 3,
+          "field": "regular_hours.periods.close_time",
+          "message": "Time field must follow hh:mm format.",
+          "value": "25:00"
+        }
+      ]
+    }
+  ]
+}
+