diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index 5f013f14b..6afe2d1bc 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -37,10 +37,6 @@ branchProtectionRules: - "linkage-monitor" - "lint" - "clirr" - - "Kokoro - Test: Binary Compatibility" - - "Kokoro - Test: Java 11" - - "Kokoro - Test: Java 7" - - "Kokoro - Test: Java 8" - "cla/google" # List of explicit permissions to add (additive only) diff --git a/.github/workflows/auto-release.yaml b/.github/workflows/auto-release.yaml index 7c8816a7d..9b4fd4d83 100644 --- a/.github/workflows/auto-release.yaml +++ b/.github/workflows/auto-release.yaml @@ -16,8 +16,8 @@ jobs: return; } - // only approve PRs like "chore(master): release " - if ( !context.payload.pull_request.title.startsWith("chore(master): release") ) { + // only approve PRs like "chore: release " + if ( !context.payload.pull_request.title.startsWith("chore: release") ) { return; } diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 144780874..7a00a52fa 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -79,6 +79,11 @@ samples) if [[ -f ${SAMPLES_DIR}/pom.xml ]] then + for FILE in ${KOKORO_GFILE_DIR}/secret_manager/*-samples-secrets; do + [[ -f "$FILE" ]] || continue + source "$FILE" + done + pushd ${SAMPLES_DIR} mvn -B \ -Penable-samples \ diff --git a/.kokoro/dependencies.sh b/.kokoro/dependencies.sh index 0fb8c8436..59d2aafc7 100755 --- a/.kokoro/dependencies.sh +++ b/.kokoro/dependencies.sh @@ -33,6 +33,7 @@ export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m" retry_with_backoff 3 10 \ mvn install -B -V -ntp \ -DskipTests=true \ + -Dmaven.javadoc.skip=true \ -Dclirr.skip=true mvn -B dependency:analyze -DfailOnWarning=true diff --git a/.kokoro/release/publish_javadoc.cfg b/.kokoro/release/publish_javadoc.cfg index b9d08f976..512780c53 100644 --- a/.kokoro/release/publish_javadoc.cfg +++ b/.kokoro/release/publish_javadoc.cfg @@ -7,12 +7,6 @@ env_vars: { value: "docs-staging" } -# cloud-rad staging -env_vars: { - key: "STAGING_BUCKET_V2" - value: "docs-staging-v2-staging" -} - env_vars: { key: "TRAMPOLINE_BUILD_FILE" value: "github/google-api-java-client/.kokoro/release/publish_javadoc.sh" @@ -26,4 +20,4 @@ before_action { keyname: "docuploader_service_account" } } -} \ No newline at end of file +} diff --git a/.kokoro/release/publish_javadoc.sh b/.kokoro/release/publish_javadoc.sh index 187fa02f9..dd4d56ade 100755 --- a/.kokoro/release/publish_javadoc.sh +++ b/.kokoro/release/publish_javadoc.sh @@ -24,11 +24,6 @@ if [[ -z "${STAGING_BUCKET}" ]]; then exit 1 fi -if [[ -z "${STAGING_BUCKET_V2}" ]]; then - echo "Need to set STAGING_BUCKET_V2 environment variable" - exit 1 -fi - # work from the git root directory pushd $(dirname "$0")/../../ @@ -56,22 +51,3 @@ python3 -m docuploader create-metadata \ python3 -m docuploader upload . \ --credentials ${CREDENTIALS} \ --staging-bucket ${STAGING_BUCKET} - -popd - -# V2 due to problems w/ the released javadoc plugin doclava, Java 8 is required. Beware of accidental updates. - -mvn clean site -B -q -Ddevsite.template="${KOKORO_GFILE_DIR}/java/" - -pushd target/devsite/reference - -# create metadata -python3 -m docuploader create-metadata \ - --name ${NAME} \ - --version ${VERSION} \ - --language java - -# upload docs to staging bucket -python3 -m docuploader upload . \ - --credentials ${CREDENTIALS} \ - --staging-bucket ${STAGING_BUCKET_V2} diff --git a/.kokoro/release/publish_javadoc11.sh b/.kokoro/release/publish_javadoc11.sh index 06f80e9f2..7690b4f45 100755 --- a/.kokoro/release/publish_javadoc11.sh +++ b/.kokoro/release/publish_javadoc11.sh @@ -40,6 +40,9 @@ export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) # generate yml mvn clean site -B -q -P docFX +# copy README to docfx-yml dir and rename index.md +cp README.md target/docfx-yml/index.md + pushd target/docfx-yml # create metadata @@ -52,4 +55,4 @@ python3 -m docuploader create-metadata \ python3 -m docuploader upload . \ --credentials ${CREDENTIALS} \ --staging-bucket ${STAGING_BUCKET_V2} \ - --destination-prefix docfx- + --destination-prefix docfx diff --git a/CHANGELOG.md b/CHANGELOG.md index 52c99ce44..b315f2ec3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +### [1.31.4](https://www.github.com/googleapis/google-api-java-client/compare/v1.31.3...v1.31.4) (2021-04-09) + + +### Bug Fixes + +* re-encode public keys from google.jks into p12 format for android ([#1738](https://www.github.com/googleapis/google-api-java-client/issues/1738)) ([83f3702](https://www.github.com/googleapis/google-api-java-client/commit/83f37023ea50a643a76eb6e5230072e5c829a205)) +* wrap BatchRequest InputStream with BufferedInputStream ([#1749](https://www.github.com/googleapis/google-api-java-client/issues/1749)) ([07346d8](https://www.github.com/googleapis/google-api-java-client/commit/07346d8dfa955a40daf01b8fb17fe1d75dc2a998)) + + +### Dependencies + +* update guava ([#1762](https://www.github.com/googleapis/google-api-java-client/issues/1762)) ([2197258](https://www.github.com/googleapis/google-api-java-client/commit/219725878e9954e724a1832ee615553319771c54)) +* update project.http.version to v1.39.2 ([#1748](https://www.github.com/googleapis/google-api-java-client/issues/1748)) ([5f62a41](https://www.github.com/googleapis/google-api-java-client/commit/5f62a412dcaabe8cb17783b9add6366dde7d96be)) + ### [1.31.3](https://www.github.com/googleapis/google-api-java-client/compare/v1.31.2...v1.31.3) (2021-03-01) diff --git a/README.md b/README.md index 51bfa4dee..7265bb1b1 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ To use Maven, add the following lines to your pom.xml file: com.google.api-client google-api-client - 1.31.3 + 1.31.4 @@ -48,7 +48,7 @@ repositories { google() } dependencies { - compile 'com.google.api-client:google-api-client:1.31.3' + compile 'com.google.api-client:google-api-client:1.31.4' } ``` [//]: # ({x-version-update-end}) diff --git a/google-api-client-android/pom.xml b/google-api-client-android/pom.xml index b3ec4bf4a..adda360b6 100644 --- a/google-api-client-android/pom.xml +++ b/google-api-client-android/pom.xml @@ -4,7 +4,7 @@ com.google.api-client google-api-client-parent - 1.31.3 + 1.31.4 ../pom.xml google-api-client-android diff --git a/google-api-client-appengine/pom.xml b/google-api-client-appengine/pom.xml index 6cd208dee..a03e9427c 100644 --- a/google-api-client-appengine/pom.xml +++ b/google-api-client-appengine/pom.xml @@ -4,7 +4,7 @@ com.google.api-client google-api-client-parent - 1.31.3 + 1.31.4 ../pom.xml google-api-client-appengine diff --git a/google-api-client-assembly/pom.xml b/google-api-client-assembly/pom.xml index 99d34a56f..d66894b17 100644 --- a/google-api-client-assembly/pom.xml +++ b/google-api-client-assembly/pom.xml @@ -4,7 +4,7 @@ com.google.api-client google-api-client-parent - 1.31.3 + 1.31.4 ../pom.xml com.google.api-client diff --git a/google-api-client-bom/pom.xml b/google-api-client-bom/pom.xml index a5a33eb24..f44a285ca 100644 --- a/google-api-client-bom/pom.xml +++ b/google-api-client-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.api-client google-api-client-bom - 1.31.3 + 1.31.4 pom Google API Client Library for Java BOM @@ -63,53 +63,53 @@ com.google.api-client google-api-client - 1.31.3 + 1.31.4 com.google.api-client google-api-client-android - 1.31.3 + 1.31.4 com.google.api-client google-api-client-appengine - 1.31.3 + 1.31.4 com.google.api-client google-api-client-assembly - 1.31.3 + 1.31.4 pom com.google.api-client google-api-client-gson - 1.31.3 + 1.31.4 com.google.api-client google-api-client-jackson2 - 1.31.3 + 1.31.4 com.google.api-client google-api-client-java6 - 1.31.3 + 1.31.4 com.google.api-client google-api-client-protobuf - 1.31.3 + 1.31.4 com.google.api-client google-api-client-servlet - 1.31.3 + 1.31.4 com.google.api-client google-api-client-xml - 1.31.3 + 1.31.4 diff --git a/google-api-client-gson/pom.xml b/google-api-client-gson/pom.xml index 0203dcd74..714cb5e62 100644 --- a/google-api-client-gson/pom.xml +++ b/google-api-client-gson/pom.xml @@ -4,7 +4,7 @@ com.google.api-client google-api-client-parent - 1.31.3 + 1.31.4 ../pom.xml google-api-client-gson diff --git a/google-api-client-jackson2/pom.xml b/google-api-client-jackson2/pom.xml index b56e9c80b..43f55a2ac 100644 --- a/google-api-client-jackson2/pom.xml +++ b/google-api-client-jackson2/pom.xml @@ -4,7 +4,7 @@ com.google.api-client google-api-client-parent - 1.31.3 + 1.31.4 ../pom.xml google-api-client-jackson2 diff --git a/google-api-client-java6/pom.xml b/google-api-client-java6/pom.xml index ef4bfe924..7792bcf3b 100644 --- a/google-api-client-java6/pom.xml +++ b/google-api-client-java6/pom.xml @@ -4,7 +4,7 @@ com.google.api-client google-api-client-parent - 1.31.3 + 1.31.4 ../pom.xml google-api-client-java6 diff --git a/google-api-client-protobuf/pom.xml b/google-api-client-protobuf/pom.xml index c933af29e..5680bcbf3 100644 --- a/google-api-client-protobuf/pom.xml +++ b/google-api-client-protobuf/pom.xml @@ -4,7 +4,7 @@ com.google.api-client google-api-client-parent - 1.31.3 + 1.31.4 ../pom.xml google-api-client-protobuf diff --git a/google-api-client-servlet/pom.xml b/google-api-client-servlet/pom.xml index b4f920751..5b405359e 100644 --- a/google-api-client-servlet/pom.xml +++ b/google-api-client-servlet/pom.xml @@ -4,7 +4,7 @@ com.google.api-client google-api-client-parent - 1.31.3 + 1.31.4 ../pom.xml google-api-client-servlet diff --git a/google-api-client-xml/pom.xml b/google-api-client-xml/pom.xml index 5d326dcdb..a7fba8348 100644 --- a/google-api-client-xml/pom.xml +++ b/google-api-client-xml/pom.xml @@ -4,7 +4,7 @@ com.google.api-client google-api-client-parent - 1.31.3 + 1.31.4 ../pom.xml google-api-client-xml diff --git a/google-api-client/pom.xml b/google-api-client/pom.xml index 1beafce52..03f3d67a5 100644 --- a/google-api-client/pom.xml +++ b/google-api-client/pom.xml @@ -4,7 +4,7 @@ com.google.api-client google-api-client-parent - 1.31.3 + 1.31.4 ../pom.xml google-api-client diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/GoogleUtils.java b/google-api-client/src/main/java/com/google/api/client/googleapis/GoogleUtils.java index b4eca557f..19c7f30c9 100644 --- a/google-api-client/src/main/java/com/google/api/client/googleapis/GoogleUtils.java +++ b/google-api-client/src/main/java/com/google/api/client/googleapis/GoogleUtils.java @@ -81,8 +81,8 @@ public final class GoogleUtils { public static synchronized KeyStore getCertificateTrustStore() throws IOException, GeneralSecurityException { if (certTrustStore == null) { - certTrustStore = SecurityUtils.getJavaKeyStore(); - InputStream keyStoreStream = GoogleUtils.class.getResourceAsStream("google.jks"); + certTrustStore = SecurityUtils.getPkcs12KeyStore(); + InputStream keyStoreStream = GoogleUtils.class.getResourceAsStream("google.p12"); SecurityUtils.loadKeyStore(certTrustStore, keyStoreStream, "notasecret"); } return certTrustStore; diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/batch/BatchRequest.java b/google-api-client/src/main/java/com/google/api/client/googleapis/batch/BatchRequest.java index bd953c1e0..a814a5eec 100644 --- a/google-api-client/src/main/java/com/google/api/client/googleapis/batch/BatchRequest.java +++ b/google-api-client/src/main/java/com/google/api/client/googleapis/batch/BatchRequest.java @@ -27,6 +27,7 @@ import com.google.api.client.http.MultipartContent; import com.google.api.client.util.Preconditions; import com.google.api.client.util.Sleeper; +import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; @@ -259,7 +260,7 @@ public void execute() throws IOException { String boundary = "--" + response.getMediaType().getParameter("boundary"); // Parse the content stream. - InputStream contentStream = response.getContent(); + InputStream contentStream = new BufferedInputStream(response.getContent()); batchResponse = new BatchUnparsedResponse(contentStream, boundary, requestInfos, retryAllowed); diff --git a/google-api-client/src/main/resources/com/google/api/client/googleapis/google.p12 b/google-api-client/src/main/resources/com/google/api/client/googleapis/google.p12 new file mode 100644 index 000000000..9f7953100 Binary files /dev/null and b/google-api-client/src/main/resources/com/google/api/client/googleapis/google.p12 differ diff --git a/google-api-client/src/test/java/com/google/api/client/googleapis/batch/BatchRequestStressTest.java b/google-api-client/src/test/java/com/google/api/client/googleapis/batch/BatchRequestStressTest.java new file mode 100644 index 000000000..d1b316edc --- /dev/null +++ b/google-api-client/src/test/java/com/google/api/client/googleapis/batch/BatchRequestStressTest.java @@ -0,0 +1,121 @@ +/* + * Copyright 2021 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.googleapis.batch; + +import static org.junit.Assert.assertEquals; + +import com.google.api.client.http.ByteArrayContent; +import com.google.api.client.http.GenericUrl; +import com.google.api.client.http.HttpHeaders; +import com.google.api.client.http.HttpMediaType; +import com.google.api.client.http.HttpRequest; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.http.LowLevelHttpRequest; +import com.google.api.client.http.LowLevelHttpResponse; +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.Charsets; +import java.io.IOException; +import java.io.PipedInputStream; +import java.io.PipedOutputStream; +import java.util.Arrays; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.zip.GZIPOutputStream; +import org.junit.BeforeClass; +import org.junit.Test; + +/** Tests {@link BatchRequest}. */ +public class BatchRequestStressTest { + + private static final int BATCH_SIZE = 100; + public static BatchRequest batchRequest; + private static AtomicInteger parseCount = new AtomicInteger(0); + private static AtomicInteger errorCount = new AtomicInteger(0); + + @BeforeClass + public static void setup() throws IOException { + HttpTransport transport = + new MockHttpTransport() { + @Override + public LowLevelHttpRequest buildRequest(String method, String url) throws IOException { + return new MockLowLevelHttpRequest() { + @Override + public LowLevelHttpResponse execute() throws IOException { + MockLowLevelHttpResponse response = new MockLowLevelHttpResponse(); + response.setStatusCode(200); + response.addHeader("Content-Type", "multipart/mixed; boundary=__END_OF_PART__"); + response.setContentEncoding("gzip"); + StringBuilder responseContent = new StringBuilder(); + for (int i = 0; i < BATCH_SIZE; i++) { + responseContent + .append("--" + "__END_OF_PART__" + "\n") + .append("Content-Type: application/http\n") + .append("Content-ID: response-" + i + "\n\n") + .append("HTTP/1.1 200 OK\n") + .append("Content-Type: application/json\n\n") + .append("{}\n\n"); + } + responseContent.append("--" + "__END_OF_PART__--" + "\n\n"); + + // gzip this content + PipedInputStream is = new PipedInputStream(); + PipedOutputStream os = new PipedOutputStream(is); + GZIPOutputStream gzip = new GZIPOutputStream(os); + gzip.write(responseContent.toString().getBytes("UTF-8")); + gzip.close(); + response.setContent(is); + return response; + } + }; + } + }; + + BatchCallback callback = + new BatchCallback() { + @Override + public void onSuccess(Void t, HttpHeaders responseHeaders) { + parseCount.incrementAndGet(); + } + + @Override + public void onFailure(Void e, HttpHeaders responseHeaders) { + errorCount.incrementAndGet(); + } + }; + batchRequest = new BatchRequest(transport, null); + byte[] content = new byte[300]; + Arrays.fill(content, (byte) ' '); + HttpRequest request1 = + transport + .createRequestFactory() + .buildRequest( + "POST", + new GenericUrl("http://www.google.com/"), + new ByteArrayContent( + new HttpMediaType("text/plain").setCharsetParameter(Charsets.UTF_8).build(), + content)); + for (int i = 0; i < BATCH_SIZE; i++) { + batchRequest.queue(request1, Void.class, Void.class, callback); + } + } + + @Test(timeout = 4000) + public void testResponse() throws IOException { + batchRequest.execute(); + assertEquals(BATCH_SIZE, parseCount.get()); + assertEquals(0, errorCount.get()); + } +} diff --git a/pom.xml b/pom.xml index 2c80fa596..d0655dcdf 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ com.google.api-client google-api-client-parent - 1.31.3 + 1.31.4 pom Parent for the Google API Client Library for Java @@ -480,14 +480,14 @@ UTF-8 - 1.39.0 + 1.39.2 4.4.14 4.5.13 - 1.31.4 + 1.31.5 3.0.2 2.8.6 - 3.15.1 - 30.1-android + 3.15.8 + 30.1.1-android 1.9.84 1.1.4c 2.3-eb diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index c2c0d9844..258d785c1 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -14,7 +14,7 @@ com.google.cloud.samples shared-configuration - 1.0.21 + 1.0.22 @@ -29,7 +29,7 @@ com.google.api-client google-api-client - 1.31.2 + 1.31.3 diff --git a/samples/pom.xml b/samples/pom.xml index c245563d1..609633ce7 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -18,7 +18,7 @@ com.google.cloud.samples shared-configuration - 1.0.21 + 1.0.22 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 8ef2602dc..c5f321e2e 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -14,7 +14,7 @@ com.google.cloud.samples shared-configuration - 1.0.21 + 1.0.22 @@ -28,7 +28,7 @@ com.google.api-client google-api-client - 1.31.2 + 1.31.3 diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index d7ef7a853..dd79f51fa 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -14,7 +14,7 @@ com.google.cloud.samples shared-configuration - 1.0.21 + 1.0.22 @@ -30,7 +30,7 @@ com.google.cloud libraries-bom - 18.0.0 + 19.2.1 pom import diff --git a/synth.metadata b/synth.metadata index 413d8bdaf..aa254be12 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/google-api-java-client.git", - "sha": "9c1b449d369b4e09230ff459be42a9145901dcea" + "sha": "d4c821d5217de0f56b9afcdfcd9901d70e027c92" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "6946fd71ae9215b0e7ae188f5057df765ee6d7d2" + "sha": "572ef8f70edd9041f5bcfa71511aed6aecfc2098" } } ], diff --git a/versions.txt b/versions.txt index 8b61cc75f..2158b5f35 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-api-client:1.31.3:1.31.3 +google-api-client:1.31.4:1.31.4