Repository: googleapis/google-http-java-client
Pull request #1003 (2020-03-16 03:12:40)

chore(deps): update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.2.0
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| org.apache.maven.plugins:maven-javadoc-plugin | minor | `3.1.1` -> `3.2.0` |

---

### Renovate configuration

:date: **Schedule**: At any time (no schedule defined).

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

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

:no_bell: **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 has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/google-http-java-client).


Patch:
diff --git a/google-http-client-bom/pom.xml b/google-http-client-bom/pom.xml
index 5be5b86f..0401a353 100644
--- a/google-http-client-bom/pom.xml
+++ b/google-http-client-bom/pom.xml
@@ -128,7 +128,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-javadoc-plugin</artifactId>
-        <version>3.1.1</version>
+        <version>3.2.0</version>
         <configuration>
           <skip>true</skip>
         </configuration>
diff --git a/google-http-client/src/main/java/com/google/api/client/http/HttpResponseException.java b/google-http-client/src/main/java/com/google/api/client/http/HttpResponseException.java
index 6e5349e1..a9d80a4f 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/HttpResponseException.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/HttpResponseException.java
@@ -284,6 +284,17 @@ public class HttpResponseException extends IOException {
       }
       builder.append(statusMessage);
     }
+    HttpRequest request = response.getRequest();
+    if (request != null) {
+      if (builder.length() > 0) {
+        builder.append('\n');
+      }
+      String requestMethod = request.getRequestMethod();
+      if (requestMethod != null) {
+        builder.append(requestMethod).append(' ');
+      }
+      builder.append(request.getUrl());
+    }
     return builder;
   }
 }
diff --git a/pom.xml b/pom.xml
index 400da2d5..8fac9b17 100644
--- a/pom.xml
+++ b/pom.xml
@@ -306,7 +306,7 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-javadoc-plugin</artifactId>
-          <version>3.1.1</version>
+          <version>3.2.0</version>
           <executions>
             <execution>
               <id>attach-javadocs</id>


Test patch:
diff --git a/google-http-client/src/test/java/com/google/api/client/http/HttpResponseExceptionTest.java b/google-http-client/src/test/java/com/google/api/client/http/HttpResponseExceptionTest.java
index 4d651aec..9066e9d7 100644
--- a/google-http-client/src/test/java/com/google/api/client/http/HttpResponseExceptionTest.java
+++ b/google-http-client/src/test/java/com/google/api/client/http/HttpResponseExceptionTest.java
@@ -14,12 +14,15 @@
 
 package com.google.api.client.http;
 
+import static com.google.api.client.testing.http.HttpTesting.SIMPLE_GENERIC_URL;
+import static com.google.api.client.util.StringUtils.LINE_SEPARATOR;
+import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assert.assertThrows;
+
 import com.google.api.client.http.HttpResponseException.Builder;
-import com.google.api.client.testing.http.HttpTesting;
 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 com.google.api.client.util.StringUtils;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -27,6 +30,7 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutput;
 import java.io.ObjectOutputStream;
 import junit.framework.TestCase;
+import org.junit.function.ThrowingRunnable;
 
 /**
  * Tests {@link HttpResponseException}.
@@ -37,16 +41,15 @@ public class HttpResponseExceptionTest extends TestCase {
 
   public void testConstructor() throws Exception {
     HttpTransport transport = new MockHttpTransport();
-    HttpRequest request =
-        transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
+    HttpRequest request = transport.createRequestFactory().buildGetRequest(SIMPLE_GENERIC_URL);
     HttpResponse response = request.execute();
     HttpHeaders headers = response.getHeaders();
-    HttpResponseException e = new HttpResponseException(response);
-    assertEquals("200", e.getMessage());
-    assertNull(e.getContent());
-    assertEquals(200, e.getStatusCode());
-    assertNull(e.getStatusMessage());
-    assertTrue(headers == e.getHeaders());
+    HttpResponseException responseException = new HttpResponseException(response);
+    assertThat(responseException).hasMessageThat().isEqualTo("200\nGET " + SIMPLE_GENERIC_URL);
+    assertNull(responseException.getContent());
+    assertEquals(200, responseException.getStatusCode());
+    assertNull(responseException.getStatusMessage());
+    assertTrue(headers == responseException.getHeaders());
   }
 
   public void testBuilder() throws Exception {
@@ -83,11 +86,10 @@ public class HttpResponseExceptionTest extends TestCase {
             };
           }
         };
-    HttpRequest request =
-        transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
+    HttpRequest request = transport.createRequestFactory().buildGetRequest(SIMPLE_GENERIC_URL);
     HttpResponse response = request.execute();
-    HttpResponseException e = new HttpResponseException(response);
-    assertEquals("OK", e.getStatusMessage());
+    HttpResponseException responseException = new HttpResponseException(response);
+    assertEquals("OK", responseException.getStatusMessage());
   }
 
   public void testConstructor_noStatusCode() throws Exception {
@@ -105,14 +107,18 @@ public class HttpResponseExceptionTest extends TestCase {
             };
           }
         };
-    HttpRequest request =
-        transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
-    try {
-      request.execute();
-      fail();
-    } catch (HttpResponseException e) {
-      assertEquals("", e.getMessage());
-    }
+    final HttpRequest request =
+        transport.createRequestFactory().buildGetRequest(SIMPLE_GENERIC_URL);
+    HttpResponseException responseException =
+        assertThrows(
+            HttpResponseException.class,
+            new ThrowingRunnable() {
+              @Override
+              public void run() throws Throwable {
+                request.execute();
+              }
+            });
+    assertThat(responseException).hasMessageThat().isEqualTo("GET " + SIMPLE_GENERIC_URL);
   }
 
   public void testConstructor_messageButNoStatusCode() throws Exception {
@@ -131,14 +137,18 @@ public class HttpResponseExceptionTest extends TestCase {
             };
           }
         };
-    HttpRequest request =
-        transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
-    try {
-      request.execute();
-      fail();
-    } catch (HttpResponseException e) {
-      assertEquals("Foo", e.getMessage());
-    }
+    final HttpRequest request =
+        transport.createRequestFactory().buildGetRequest(SIMPLE_GENERIC_URL);
+    HttpResponseException responseException =
+        assertThrows(
+            HttpResponseException.class,
+            new ThrowingRunnable() {
+              @Override
+              public void run() throws Throwable {
+                request.execute();
+              }
+            });
+    assertThat(responseException).hasMessageThat().isEqualTo("Foo\nGET " + SIMPLE_GENERIC_URL);
   }
 
   public void testComputeMessage() throws Exception {
@@ -156,10 +166,10 @@ public class HttpResponseExceptionTest extends TestCase {
             };
           }
         };
-    HttpRequest request =
-        transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
+    HttpRequest request = transport.createRequestFactory().buildGetRequest(SIMPLE_GENERIC_URL);
     HttpResponse response = request.execute();
-    assertEquals("200 Foo", HttpResponseException.computeMessageBuffer(response).toString());
+    assertThat(HttpResponseException.computeMessageBuffer(response).toString())
+        .isEqualTo("200 Foo\nGET " + SIMPLE_GENERIC_URL);
   }
 
   public void testThrown() throws Exception {
@@ -179,15 +189,25 @@ public class HttpResponseExceptionTest extends TestCase {
             };
           }
         };
-    HttpRequest request =
-        transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
-    try {
-      request.execute();
-      fail();
-    } catch (HttpResponseException e) {
-      assertEquals(
-          "404 Not Found" + StringUtils.LINE_SEPARATOR + "Unable to find resource", e.getMessage());
-    }
+    final HttpRequest request =
+        transport.createRequestFactory().buildGetRequest(SIMPLE_GENERIC_URL);
+    HttpResponseException responseException =
+        assertThrows(
+            HttpResponseException.class,
+            new ThrowingRunnable() {
+              @Override
+              public void run() throws Throwable {
+                request.execute();
+              }
+            });
+
+    assertThat(responseException)
+        .hasMessageThat()
+        .isEqualTo(
+            "404 Not Found\nGET "
+                + SIMPLE_GENERIC_URL
+                + LINE_SEPARATOR
+                + "Unable to find resource");
   }
 
   public void testInvalidCharset() throws Exception {
@@ -208,14 +228,21 @@ public class HttpResponseExceptionTest extends TestCase {
             };
           }
         };
-    HttpRequest request =
-        transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
-    try {
-      request.execute();
-      fail();
-    } catch (HttpResponseException e) {
-      assertEquals("404 Not Found", e.getMessage());
-    }
+    final HttpRequest request =
+        transport.createRequestFactory().buildGetRequest(SIMPLE_GENERIC_URL);
+    HttpResponseException responseException =
+        assertThrows(
+            HttpResponseException.class,
+            new ThrowingRunnable() {
+              @Override
+              public void run() throws Throwable {
+                request.execute();
+              }
+            });
+
+    assertThat(responseException)
+        .hasMessageThat()
+        .isEqualTo("404 Not Found\nGET " + SIMPLE_GENERIC_URL);
   }
 
   public void testUnsupportedCharset() throws Exception {
@@ -236,30 +263,35 @@ public class HttpResponseExceptionTest extends TestCase {
             };
           }
         };
-    HttpRequest request =
-        transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
-    try {
-      request.execute();
-      fail();
-    } catch (HttpResponseException e) {
-      assertEquals("404 Not Found", e.getMessage());
-    }
+    final HttpRequest request =
+        transport.createRequestFactory().buildGetRequest(SIMPLE_GENERIC_URL);
+    HttpResponseException responseException =
+        assertThrows(
+            HttpResponseException.class,
+            new ThrowingRunnable() {
+              @Override
+              public void run() throws Throwable {
+                request.execute();
+              }
+            });
+    assertThat(responseException)
+        .hasMessageThat()
+        .isEqualTo("404 Not Found\nGET " + SIMPLE_GENERIC_URL);
   }
 
   public void testSerialization() throws Exception {
     HttpTransport transport = new MockHttpTransport();
-    HttpRequest request =
-        transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
+    HttpRequest request = transport.createRequestFactory().buildGetRequest(SIMPLE_GENERIC_URL);
     HttpResponse response = request.execute();
-    HttpResponseException e = new HttpResponseException(response);
+    HttpResponseException responseException = new HttpResponseException(response);
     ByteArrayOutputStream out = new ByteArrayOutputStream();
     ObjectOutput s = new ObjectOutputStream(out);
-    s.writeObject(e);
+    s.writeObject(responseException);
     ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
     ObjectInputStream objectInput = new ObjectInputStream(in);
     HttpResponseException e2 = (HttpResponseException) objectInput.readObject();
-    assertEquals(e.getMessage(), e2.getMessage());
-    assertEquals(e.getStatusCode(), e2.getStatusCode());
+    assertEquals(responseException.getMessage(), e2.getMessage());
+    assertEquals(responseException.getStatusCode(), e2.getStatusCode());
     assertNull(e2.getHeaders());
   }
 }