Repository: googleapis/google-http-java-client
Pull request #1001 (2020-03-13 21:34:21)

chore: update common templates
This PR was generated using Autosynth. :rainbow:


<details><summary>Log from Synthtool</summary>

```
2020-03-13 14:34:17,284 synthtool > Executing /tmpfs/src/git/autosynth/working_repo/synth.py.
.github/ISSUE_TEMPLATE/bug_report.md
.github/ISSUE_TEMPLATE/feature_request.md
.github/ISSUE_TEMPLATE/support_request.md
.github/PULL_REQUEST_TEMPLATE.md
.github/release-please.yml
.github/trusted-contribution.yml
.kokoro/build.bat
.kokoro/build.sh
.kokoro/coerce_logs.sh
.kokoro/common.cfg
.kokoro/continuous/common.cfg
.kokoro/continuous/dependencies.cfg
.kokoro/continuous/integration.cfg
.kokoro/continuous/java11.cfg
.kokoro/continuous/java7.cfg
.kokoro/continuous/java8-osx.cfg
.kokoro/continuous/java8-win.cfg
.kokoro/continuous/java8.cfg
.kokoro/continuous/lint.cfg
.kokoro/continuous/propose_release.cfg
.kokoro/continuous/samples.cfg
.kokoro/dependencies.sh
.kokoro/linkage-monitor.sh
.kokoro/nightly/common.cfg
.kokoro/nightly/dependencies.cfg
.kokoro/nightly/integration.cfg
.kokoro/nightly/java11.cfg
.kokoro/nightly/java7.cfg
.kokoro/nightly/java8-osx.cfg
.kokoro/nightly/java8-win.cfg
.kokoro/nightly/java8.cfg
.kokoro/nightly/lint.cfg
.kokoro/nightly/samples.cfg
.kokoro/presubmit/clirr.cfg
.kokoro/presubmit/common.cfg
.kokoro/presubmit/dependencies.cfg
.kokoro/presubmit/integration.cfg
.kokoro/presubmit/java11.cfg
.kokoro/presubmit/java7.cfg
.kokoro/presubmit/java8-osx.cfg
.kokoro/presubmit/java8-win.cfg
.kokoro/presubmit/java8.cfg
.kokoro/presubmit/linkage-monitor.cfg
.kokoro/presubmit/lint.cfg
.kokoro/presubmit/samples.cfg
.kokoro/release/bump_snapshot.cfg
.kokoro/release/common.cfg
.kokoro/release/common.sh
.kokoro/release/drop.cfg
.kokoro/release/drop.sh
.kokoro/release/promote.cfg
.kokoro/release/promote.sh
.kokoro/release/publish_javadoc.cfg
.kokoro/release/publish_javadoc.sh
.kokoro/release/snapshot.cfg
.kokoro/release/snapshot.sh
.kokoro/release/stage.cfg
.kokoro/release/stage.sh
.kokoro/trampoline.sh
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
README.md
codecov.yaml
java.header
license-checks.xml
renovate.json
2020-03-13 14:34:17,479 synthtool > Wrote metadata to synth.metadata.

```
</details>


Patch:
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 0bd0ee06..f36e6e57 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,1 +1,7 @@
-Fixes #<issue_number_goes_here> (it's a good idea to open an issue first for context and/or discussion)
\ No newline at end of file
+Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
+- [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/google-http-java-client/issues/new/choose) before writing your code!  That way we can discuss the change, evaluate designs, and agree on the general idea
+- [ ] Ensure the tests and linter pass
+- [ ] Code coverage does not decrease (if any source code was changed)
+- [ ] Appropriate docs were updated (if necessary)
+
+Fixes #<issue_number_goes_here> ☕️
diff --git a/.github/trusted-contribution.yml b/.github/trusted-contribution.yml
new file mode 100644
index 00000000..f247d5c7
--- /dev/null
+++ b/.github/trusted-contribution.yml
@@ -0,0 +1,2 @@
+trustedContributors:
+- renovate-bot
\ No newline at end of file
diff --git a/README.md b/README.md
index 5b5d4f1c..de94456a 100644
--- a/README.md
+++ b/README.md
@@ -13,8 +13,8 @@ content. The JSON and XML libraries are also fully pluggable, and they include s
 
 The library supports the following Java environments:
 
-- Java 7 (or higher)
-- Android 4.0 (Ice Cream Sandwich) (or higher)
+- Java 7 or higher
+- Android 4.4 (Kit Kat)
 - GoogleAppEngine Google App Engine
 
 The following related projects are built on the Google HTTP Client Library for Java:
diff --git a/docs/index.md b/docs/index.md
index 5eb9ff04..e6162bd8 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -18,8 +18,8 @@ content. The JSON and XML libraries are also fully pluggable, and they include s
 
 The library supports the following Java environments:
 
-- Java 7 (or higher)
-- Android 4.0 (Ice Cream Sandwich) (or higher)
+- Java 7 or higher
+- Android 4.4 (Kit Kat) or higher
 - Google App Engine
 
 The following related projects are built on the Google HTTP Client Library for Java:
diff --git a/docs/setup.md b/docs/setup.md
index 9736859e..5ad1f01b 100644
--- a/docs/setup.md
+++ b/docs/setup.md
@@ -23,7 +23,7 @@ the `dependencyManagement` section of your `pom.xml`:
     <dependency>
       <groupId>com.google.cloud</groupId>
       <artifactId>libraries-bom</artifactId>
-      <version>4.2.0</version>
+      <version>4.3.0</version>
       <type>pom</type>
       <scope>import</scope>
      </dependency>
diff --git a/google-http-client-android/AndroidManifest.xml b/google-http-client-android/AndroidManifest.xml
index 9dc775d4..32d176f2 100644
--- a/google-http-client-android/AndroidManifest.xml
+++ b/google-http-client-android/AndroidManifest.xml
@@ -5,7 +5,7 @@
     android:versionName="1.0" >
 
     <uses-sdk
-        android:minSdkVersion="4"
-        android:targetSdkVersion="4" />
+        android:minSdkVersion="19"
+        android:targetSdkVersion="19" />
 
-</manifest>
\ No newline at end of file
+</manifest>
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/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 230af26e..838dcb5d 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
@@ -32,18 +32,19 @@ import java.nio.file.attribute.AclEntry;
 import java.nio.file.attribute.AclEntryPermission;
 import java.nio.file.attribute.AclEntryType;
 import java.nio.file.attribute.AclFileAttributeView;
+import java.nio.file.attribute.FileOwnerAttributeView;
 import java.nio.file.attribute.PosixFilePermission;
 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.
  *
- * <p>For security purposes, the file's permissions are set to be accessible only by the file's
- * owner. Note that Java 1.5 does not support manipulating file permissions, and must be done
- * manually or using the JNI.
+ * <p>For security purposes, the file's permissions are set such that the
+ * file is only accessible by the file's owner.
  *
  * @since 1.16
  * @author Yaniv Inbar
@@ -53,7 +54,7 @@ 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()
-      .startsWith("WINDOWS");
+      .toLowerCase(Locale.ENGLISH).startsWith("windows");
 
   /** Directory to store data. */
   private final File dataDirectory;
@@ -134,29 +135,24 @@ public class FileDataStoreFactory extends AbstractDataStoreFactory {
    * executed by the file's owner.
    *
    * @param file the file's permissions to modify
-   * @throws IOException
+   * @throws IOException if the permissions can't be set
    */
-  static void setPermissionsToOwnerOnly(File file) throws IOException {
+  private static void setPermissionsToOwnerOnly(File file) throws IOException {
     Set permissions = new HashSet<PosixFilePermission>();
     permissions.add(PosixFilePermission.OWNER_READ);
     permissions.add(PosixFilePermission.OWNER_WRITE);
     permissions.add(PosixFilePermission.OWNER_EXECUTE);
     try {
       Files.setPosixFilePermissions(Paths.get(file.getAbsolutePath()), permissions);
-    } catch (UnsupportedOperationException exception) {
-      LOGGER.warning("Unable to set permissions for " + file
-          + ", because you are running on a non-POSIX file system.");
-    } catch (SecurityException exception) {
-      // ignored
-    } catch (IllegalArgumentException exception) {
-      // ignored
+    } catch (RuntimeException exception) {
+      throw new IOException("Unable to set permissions for " + file, exception);
     }
   }
 
-  static void setPermissionsToOwnerOnlyWindows(File file) throws IOException {
+  private static void setPermissionsToOwnerOnlyWindows(File file) throws IOException {
     Path path = Paths.get(file.getAbsolutePath());
-    UserPrincipal owner = path.getFileSystem().getUserPrincipalLookupService()
-        .lookupPrincipalByName("OWNER@");
+    FileOwnerAttributeView fileAttributeView = Files.getFileAttributeView(path, FileOwnerAttributeView.class);
+    UserPrincipal owner = fileAttributeView.getOwner();
 
     // get view
     AclFileAttributeView view = Files.getFileAttributeView(path, AclFileAttributeView.class);
@@ -186,6 +182,11 @@ public class FileDataStoreFactory extends AbstractDataStoreFactory {
         .build();
 
     // Overwrite the ACL with only this permission
-    view.setAcl(ImmutableList.of(entry));
+    try {
+      view.setAcl(ImmutableList.of(entry));
+    } catch (SecurityException ex) {
+      throw new IOException("Unable to set permissions for " + file, ex);
+    }
+
   }
 }
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>
diff --git a/synth.metadata b/synth.metadata
index 508084b0..a8671a64 100644
--- a/synth.metadata
+++ b/synth.metadata
@@ -1,5 +1,5 @@
 {
-  "updateTime": "2020-03-02T22:34:09.877226Z",
+  "updateTime": "2020-03-13T21:34:17.479284Z",
   "sources": [
     {
       "template": {


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());
   }
 }