From d5effe81f5cb627d458929819914abf10086821a Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Fri, 2 Nov 2018 08:47:06 -0700
Subject: [PATCH 001/983] Remove deprecated BackOffPolicy interface (#506)
* Remove deprecated BackOffPolicy interface
It was scheduled to be removed in 1.18 (March 2014)
* Add builder to removed deprecated classes
---
clirr-ignored-differences.xml | 18 +
.../google/api/client/http/BackOffPolicy.java | 74 ---
.../client/http/ExponentialBackOffPolicy.java | 454 ------------------
.../google/api/client/http/HttpRequest.java | 57 +--
.../api/client/util/ExponentialBackOff.java | 4 +-
.../http/ExponentialBackOffPolicyTest.java | 145 ------
.../api/client/http/HttpRequestTest.java | 215 +--------
7 files changed, 23 insertions(+), 944 deletions(-)
delete mode 100644 google-http-client/src/main/java/com/google/api/client/http/BackOffPolicy.java
delete mode 100644 google-http-client/src/main/java/com/google/api/client/http/ExponentialBackOffPolicy.java
delete mode 100644 google-http-client/src/test/java/com/google/api/client/http/ExponentialBackOffPolicyTest.java
diff --git a/clirr-ignored-differences.xml b/clirr-ignored-differences.xml
index 898e94c20..775f12e7c 100644
--- a/clirr-ignored-differences.xml
+++ b/clirr-ignored-differences.xml
@@ -7,4 +7,22 @@
8001com/google/api/client/repackaged/**
+
+ 7002
+ com/google/api/client/http/HttpRequest
+ com.google.api.client.http.BackOffPolicy getBackOffPolicy()
+
+
+ 7002
+ com/google/api/client/http/HttpRequest
+ com.google.api.client.http.HttpRequest setBackOffPolicy(com.google.api.client.http.BackOffPolicy)
+
+
+ 8001
+ com/google/api/client/http/BackOffPolicy
+
+
+ 8001
+ com/google/api/client/http/ExponentialBackOffPolicy*
+
diff --git a/google-http-client/src/main/java/com/google/api/client/http/BackOffPolicy.java b/google-http-client/src/main/java/com/google/api/client/http/BackOffPolicy.java
deleted file mode 100644
index d06304011..000000000
--- a/google-http-client/src/main/java/com/google/api/client/http/BackOffPolicy.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2011 Google Inc.
- *
- * 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;
-
-import com.google.api.client.util.Beta;
-
-import java.io.IOException;
-
-/**
- * {@link Beta}
- * Strategy interface to control back off between retry attempts.
- *
- * @since 1.7
- * @author Ravi Mistry
- * @deprecated (scheduled to be removed in 1.18) Use {@link HttpBackOffUnsuccessfulResponseHandler}
- * instead.
- */
-@Deprecated
-@Beta
-public interface BackOffPolicy {
-
- /**
- * Value indicating that no more retries should be made, see {@link #getNextBackOffMillis()}.
- */
- public static final long STOP = -1L;
-
- /**
- * Determines if back off is required based on the specified status code.
- *
- *
- * Implementations may want to back off on server or product-specific errors.
- *
- *
- * @param statusCode HTTP status code
- */
- public boolean isBackOffRequired(int statusCode);
-
- /**
- * Reset Back off counters (if any) in an implementation-specific fashion.
- */
- public void reset();
-
- /**
- * Gets the number of milliseconds to wait before retrying an HTTP request. If {@link #STOP} is
- * returned, no retries should be made.
- *
- * This method should be used as follows:
- *
- *
- *
- * @return the number of milliseconds to wait when backing off requests, or {@link #STOP} if no
- * more retries should be made
- */
- public long getNextBackOffMillis() throws IOException;
-}
diff --git a/google-http-client/src/main/java/com/google/api/client/http/ExponentialBackOffPolicy.java b/google-http-client/src/main/java/com/google/api/client/http/ExponentialBackOffPolicy.java
deleted file mode 100644
index 90e8d0058..000000000
--- a/google-http-client/src/main/java/com/google/api/client/http/ExponentialBackOffPolicy.java
+++ /dev/null
@@ -1,454 +0,0 @@
-/*
- * Copyright (c) 2011 Google Inc.
- *
- * 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;
-
-import com.google.api.client.util.Beta;
-import com.google.api.client.util.ExponentialBackOff;
-import com.google.api.client.util.NanoClock;
-
-import java.io.IOException;
-
-/**
- * {@link Beta}
- * Implementation of {@link BackOffPolicy} that increases the back off period for each retry attempt
- * using a randomization function that grows exponentially.
- *
- *
- * {@link #getNextBackOffMillis()} is calculated using the following formula:
- *
- *
- * randomized_interval =
- * retry_interval * (random value in range [1 - randomization_factor, 1 + randomization_factor])
- *
- * In other words {@link #getNextBackOffMillis()} will range between the randomization factor
- * percentage below and above the retry interval. For example, using 2 seconds as the base retry
- * interval and 0.5 as the randomization factor, the actual back off period used in the next retry
- * attempt will be between 1 and 3 seconds.
- *
- *
- *
- * Note: max_interval caps the retry_interval and not the randomized_interval.
- *
- *
- *
- * If the time elapsed since an {@link ExponentialBackOffPolicy} instance is created goes past the
- * max_elapsed_time then the method {@link #getNextBackOffMillis()} starts returning
- * {@link BackOffPolicy#STOP}. The elapsed time can be reset by calling {@link #reset()}.
- *
- *
- *
- * Example: The default retry_interval is .5 seconds, default randomization_factor is 0.5, default
- * multiplier is 1.5 and the default max_interval is 1 minute. For 10 requests the sequence will be
- * (values in seconds) and assuming we go over the max_elapsed_time on the 10th request:
- *
- *
- *
- * @since 1.7
- * @author Ravi Mistry
- * @deprecated (scheduled to be removed in 1.18). Use {@link HttpBackOffUnsuccessfulResponseHandler}
- * with {@link ExponentialBackOff} instead.
- */
-@Beta
-@Deprecated
-public class ExponentialBackOffPolicy implements BackOffPolicy {
-
- /**
- * The default initial interval value in milliseconds (0.5 seconds).
- */
- public static final int DEFAULT_INITIAL_INTERVAL_MILLIS =
- ExponentialBackOff.DEFAULT_INITIAL_INTERVAL_MILLIS;
-
- /**
- * The default randomization factor (0.5 which results in a random period ranging between 50%
- * below and 50% above the retry interval).
- */
- public static final double DEFAULT_RANDOMIZATION_FACTOR =
- ExponentialBackOff.DEFAULT_RANDOMIZATION_FACTOR;
-
- /**
- * The default multiplier value (1.5 which is 50% increase per back off).
- */
- public static final double DEFAULT_MULTIPLIER = ExponentialBackOff.DEFAULT_MULTIPLIER;
-
- /**
- * The default maximum back off time in milliseconds (1 minute).
- */
- public static final int DEFAULT_MAX_INTERVAL_MILLIS =
- ExponentialBackOff.DEFAULT_MAX_INTERVAL_MILLIS;
-
- /**
- * The default maximum elapsed time in milliseconds (15 minutes).
- */
- public static final int DEFAULT_MAX_ELAPSED_TIME_MILLIS =
- ExponentialBackOff.DEFAULT_MAX_ELAPSED_TIME_MILLIS;
-
- /** Exponential backoff. */
- private final ExponentialBackOff exponentialBackOff;
-
- /**
- * Creates an instance of ExponentialBackOffPolicy using default values. To override the defaults
- * use {@link #builder}.
- *
- *
{@code initialIntervalMillis} is defaulted to {@link #DEFAULT_INITIAL_INTERVAL_MILLIS}
- *
{@code randomizationFactor} is defaulted to {@link #DEFAULT_RANDOMIZATION_FACTOR}
- *
{@code multiplier} is defaulted to {@link #DEFAULT_MULTIPLIER}
- *
{@code maxIntervalMillis} is defaulted to {@link #DEFAULT_MAX_INTERVAL_MILLIS}
- *
{@code maxElapsedTimeMillis} is defaulted in {@link #DEFAULT_MAX_ELAPSED_TIME_MILLIS}
- *
- */
- public ExponentialBackOffPolicy() {
- this(new Builder());
- }
-
- /**
- * @param builder builder
- *
- * @since 1.14
- */
- protected ExponentialBackOffPolicy(Builder builder) {
- exponentialBackOff = builder.exponentialBackOffBuilder.build();
- }
-
- /**
- * Determines if back off is required based on the specified status code.
- *
- *
- * The idea is that the servers are only temporarily unavailable, and they should not be
- * overwhelmed when they are trying to get back up.
- *
- *
- *
- * The default implementation requires back off for 500 and 503 status codes. Subclasses may
- * override if different status codes are required.
- *
- */
- public boolean isBackOffRequired(int statusCode) {
- switch (statusCode) {
- case HttpStatusCodes.STATUS_CODE_SERVER_ERROR: // 500
- case HttpStatusCodes.STATUS_CODE_SERVICE_UNAVAILABLE: // 503
- return true;
- default:
- return false;
- }
- }
-
- /**
- * Sets the interval back to the initial retry interval and restarts the timer.
- */
- public final void reset() {
- exponentialBackOff.reset();
- }
-
- /**
- * Gets the number of milliseconds to wait before retrying an HTTP request. If {@link #STOP} is
- * returned, no retries should be made.
- *
- *
- * This method calculates the next back off interval using the formula: randomized_interval =
- * retry_interval +/- (randomization_factor * retry_interval)
- *
- *
- *
- * Subclasses may override if a different algorithm is required.
- *
- *
- * @return the number of milliseconds to wait when backing off requests, or {@link #STOP} if no
- * more retries should be made
- */
- public long getNextBackOffMillis() throws IOException {
- return exponentialBackOff.nextBackOffMillis();
- }
-
- /**
- * Returns the initial retry interval in milliseconds.
- */
- public final int getInitialIntervalMillis() {
- return exponentialBackOff.getInitialIntervalMillis();
- }
-
- /**
- * Returns the randomization factor to use for creating a range around the retry interval.
- *
- *
- * A randomization factor of 0.5 results in a random period ranging between 50% below and 50%
- * above the retry interval.
- *
- */
- public final double getRandomizationFactor() {
- return exponentialBackOff.getRandomizationFactor();
- }
-
- /**
- * Returns the current retry interval in milliseconds.
- */
- public final int getCurrentIntervalMillis() {
- return exponentialBackOff.getCurrentIntervalMillis();
- }
-
- /**
- * Returns the value to multiply the current interval with for each retry attempt.
- */
- public final double getMultiplier() {
- return exponentialBackOff.getMultiplier();
- }
-
- /**
- * Returns the maximum value of the back off period in milliseconds. Once the current interval
- * reaches this value it stops increasing.
- */
- public final int getMaxIntervalMillis() {
- return exponentialBackOff.getMaxIntervalMillis();
- }
-
- /**
- * Returns the maximum elapsed time in milliseconds.
- *
- *
- * If the time elapsed since an {@link ExponentialBackOffPolicy} instance is created goes past the
- * max_elapsed_time then the method {@link #getNextBackOffMillis()} starts returning
- * {@link BackOffPolicy#STOP}. The elapsed time can be reset by calling {@link #reset()}.
- *
- */
- public final int getMaxElapsedTimeMillis() {
- return exponentialBackOff.getMaxElapsedTimeMillis();
- }
-
- /**
- * Returns the elapsed time in milliseconds since an {@link ExponentialBackOffPolicy} instance is
- * created and is reset when {@link #reset()} is called.
- *
- *
- * The elapsed time is computed using {@link System#nanoTime()}.
- *
- */
- public final long getElapsedTimeMillis() {
- return exponentialBackOff.getElapsedTimeMillis();
- }
-
- /**
- * Returns an instance of a new builder.
- */
- public static Builder builder() {
- return new Builder();
- }
-
- /**
- * {@link Beta}
- * Builder for {@link ExponentialBackOffPolicy}.
- *
- *
- * Implementation is not thread-safe.
- *
- *
- * @since 1.7
- */
- @Beta
- @Deprecated
- public static class Builder {
-
- /** Exponential back-off builder. */
- final ExponentialBackOff.Builder exponentialBackOffBuilder = new ExponentialBackOff.Builder();
-
- protected Builder() {
- }
-
- /** Builds a new instance of {@link ExponentialBackOffPolicy}. */
- public ExponentialBackOffPolicy build() {
- return new ExponentialBackOffPolicy(this);
- }
-
- /**
- * Returns the initial retry interval in milliseconds. The default value is
- * {@link #DEFAULT_INITIAL_INTERVAL_MILLIS}.
- */
- public final int getInitialIntervalMillis() {
- return exponentialBackOffBuilder.getInitialIntervalMillis();
- }
-
- /**
- * Sets the initial retry interval in milliseconds. The default value is
- * {@link #DEFAULT_INITIAL_INTERVAL_MILLIS}. Must be {@code > 0}.
- *
- *
- * Overriding is only supported for the purpose of calling the super implementation and changing
- * the return type, but nothing else.
- *
- */
- public Builder setInitialIntervalMillis(int initialIntervalMillis) {
- exponentialBackOffBuilder.setInitialIntervalMillis(initialIntervalMillis);
- return this;
- }
-
- /**
- * Returns the randomization factor to use for creating a range around the retry interval. The
- * default value is {@link #DEFAULT_RANDOMIZATION_FACTOR}.
- *
- *
- * A randomization factor of 0.5 results in a random period ranging between 50% below and 50%
- * above the retry interval.
- *
- *
- *
- * Overriding is only supported for the purpose of calling the super implementation and changing
- * the return type, but nothing else.
- *
- */
- public final double getRandomizationFactor() {
- return exponentialBackOffBuilder.getRandomizationFactor();
- }
-
- /**
- * Sets the randomization factor to use for creating a range around the retry interval. The
- * default value is {@link #DEFAULT_RANDOMIZATION_FACTOR}. Must fall in the range
- * {@code 0 <= randomizationFactor < 1}.
- *
- *
- * A randomization factor of 0.5 results in a random period ranging between 50% below and 50%
- * above the retry interval.
- *
- *
- *
- * Overriding is only supported for the purpose of calling the super implementation and changing
- * the return type, but nothing else.
- *
- */
- public Builder setRandomizationFactor(double randomizationFactor) {
- exponentialBackOffBuilder.setRandomizationFactor(randomizationFactor);
- return this;
- }
-
- /**
- * Returns the value to multiply the current interval with for each retry attempt. The default
- * value is {@link #DEFAULT_MULTIPLIER}.
- */
- public final double getMultiplier() {
- return exponentialBackOffBuilder.getMultiplier();
- }
-
- /**
- * Sets the value to multiply the current interval with for each retry attempt. The default
- * value is {@link #DEFAULT_MULTIPLIER}. Must be {@code >= 1}.
- *
- *
- * Overriding is only supported for the purpose of calling the super implementation and changing
- * the return type, but nothing else.
- *
- */
- public Builder setMultiplier(double multiplier) {
- exponentialBackOffBuilder.setMultiplier(multiplier);
- return this;
- }
-
- /**
- * Returns the maximum value of the back off period in milliseconds. Once the current interval
- * reaches this value it stops increasing. The default value is
- * {@link #DEFAULT_MAX_INTERVAL_MILLIS}. Must be {@code >= initialInterval}.
- */
- public final int getMaxIntervalMillis() {
- return exponentialBackOffBuilder.getMaxIntervalMillis();
- }
-
- /**
- * Sets the maximum value of the back off period in milliseconds. Once the current interval
- * reaches this value it stops increasing. The default value is
- * {@link #DEFAULT_MAX_INTERVAL_MILLIS}.
- *
- *
- * Overriding is only supported for the purpose of calling the super implementation and changing
- * the return type, but nothing else.
- *
- */
- public Builder setMaxIntervalMillis(int maxIntervalMillis) {
- exponentialBackOffBuilder.setMaxIntervalMillis(maxIntervalMillis);
- return this;
- }
-
- /**
- * Returns the maximum elapsed time in milliseconds. The default value is
- * {@link #DEFAULT_MAX_ELAPSED_TIME_MILLIS}.
- *
- *
- * If the time elapsed since an {@link ExponentialBackOffPolicy} instance is created goes past
- * the max_elapsed_time then the method {@link #getNextBackOffMillis()} starts returning
- * {@link BackOffPolicy#STOP}. The elapsed time can be reset by calling {@link #reset()}.
- *
- */
- public final int getMaxElapsedTimeMillis() {
- return exponentialBackOffBuilder.getMaxElapsedTimeMillis();
- }
-
- /**
- * Sets the maximum elapsed time in milliseconds. The default value is
- * {@link #DEFAULT_MAX_ELAPSED_TIME_MILLIS}. Must be {@code > 0}.
- *
- *
- * If the time elapsed since an {@link ExponentialBackOffPolicy} instance is created goes past
- * the max_elapsed_time then the method {@link #getNextBackOffMillis()} starts returning
- * {@link BackOffPolicy#STOP}. The elapsed time can be reset by calling {@link #reset()}.
- *
- *
- *
- * Overriding is only supported for the purpose of calling the super implementation and changing
- * the return type, but nothing else.
- *
- */
- public Builder setMaxElapsedTimeMillis(int maxElapsedTimeMillis) {
- exponentialBackOffBuilder.setMaxElapsedTimeMillis(maxElapsedTimeMillis);
- return this;
- }
-
- /**
- * Returns the nano clock.
- *
- * @since 1.14
- */
- public final NanoClock getNanoClock() {
- return exponentialBackOffBuilder.getNanoClock();
- }
-
- /**
- * Sets the nano clock ({@link NanoClock#SYSTEM} by default).
- *
- *
- * Overriding is only supported for the purpose of calling the super implementation and changing
- * the return type, but nothing else.
- *
- *
- * @since 1.14
- */
- public Builder setNanoClock(NanoClock nanoClock) {
- exponentialBackOffBuilder.setNanoClock(nanoClock);
- return this;
- }
- }
-}
diff --git a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
index d75b7fa2f..cb9e91e7e 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
@@ -174,13 +174,6 @@ static String executeAndGetValueOfSomeCustomHeader(HttpRequest request) {
/** HTTP content encoding or {@code null} for none. */
private HttpEncoding encoding;
- /**
- * The {@link BackOffPolicy} to use between retry attempts or {@code null} for none.
- */
- @Deprecated
- @Beta
- private BackOffPolicy backOffPolicy;
-
/** Whether to automatically follow redirects ({@code true} by default). */
private boolean followRedirects = true;
@@ -305,37 +298,6 @@ public HttpRequest setEncoding(HttpEncoding encoding) {
return this;
}
- /**
- * {@link Beta}
- * Returns the {@link BackOffPolicy} to use between retry attempts or {@code null} for none.
- *
- * @since 1.7
- * @deprecated (scheduled to be removed in 1.18).
- * {@link #setUnsuccessfulResponseHandler(HttpUnsuccessfulResponseHandler)} with a new
- * {@link HttpBackOffUnsuccessfulResponseHandler} instead.
- */
- @Deprecated
- @Beta
- public BackOffPolicy getBackOffPolicy() {
- return backOffPolicy;
- }
-
- /**
- * {@link Beta}
- * Sets the {@link BackOffPolicy} to use between retry attempts or {@code null} for none.
- *
- * @since 1.7
- * @deprecated (scheduled to be removed in 1.18). Use
- * {@link #setUnsuccessfulResponseHandler(HttpUnsuccessfulResponseHandler)} with a new
- * {@link HttpBackOffUnsuccessfulResponseHandler} instead.
- */
- @Deprecated
- @Beta
- public HttpRequest setBackOffPolicy(BackOffPolicy backOffPolicy) {
- this.backOffPolicy = backOffPolicy;
- return this;
- }
-
/**
* Returns the limit to the content size that will be logged during {@link #execute()}.
*
@@ -844,10 +806,8 @@ public HttpResponse execute() throws IOException {
boolean retryRequest = false;
Preconditions.checkArgument(numRetries >= 0);
int retriesRemaining = numRetries;
- if (backOffPolicy != null) {
- // Reset the BackOffPolicy at the start of each execute.
- backOffPolicy.reset();
- }
+ // TODO(chingor): notify error handlers that the request is about to start
+
HttpResponse response = null;
IOException executeException;
@@ -1020,19 +980,6 @@ public HttpResponse execute() throws IOException {
if (handleRedirect(response.getStatusCode(), response.getHeaders())) {
// The unsuccessful request's error could not be handled and it is a redirect request.
errorHandled = true;
- } else if (retryRequest && backOffPolicy != null
- && backOffPolicy.isBackOffRequired(response.getStatusCode())) {
- // The unsuccessful request's error could not be handled and should be backed off
- // before retrying
- long backOffTime = backOffPolicy.getNextBackOffMillis();
- if (backOffTime != BackOffPolicy.STOP) {
- try {
- sleeper.sleep(backOffTime);
- } catch (InterruptedException exception) {
- // ignore
- }
- errorHandled = true;
- }
}
}
// A retry is required if the error was successfully handled or if it is a redirect
diff --git a/google-http-client/src/main/java/com/google/api/client/util/ExponentialBackOff.java b/google-http-client/src/main/java/com/google/api/client/util/ExponentialBackOff.java
index c949b6f23..f132c6a2e 100644
--- a/google-http-client/src/main/java/com/google/api/client/util/ExponentialBackOff.java
+++ b/google-http-client/src/main/java/com/google/api/client/util/ExponentialBackOff.java
@@ -120,7 +120,7 @@ public class ExponentialBackOff implements BackOff {
private final int maxIntervalMillis;
/**
- * The system time in nanoseconds. It is calculated when an ExponentialBackOffPolicy instance is
+ * The system time in nanoseconds. It is calculated when an ExponentialBackOff instance is
* created and is reset when {@link #reset()} is called.
*/
long startTimeNanos;
@@ -135,7 +135,7 @@ public class ExponentialBackOff implements BackOff {
private final NanoClock nanoClock;
/**
- * Creates an instance of ExponentialBackOffPolicy using default values.
+ * Creates an instance of ExponentialBackOff using default values.
*
*
* To override the defaults use {@link Builder}.
diff --git a/google-http-client/src/test/java/com/google/api/client/http/ExponentialBackOffPolicyTest.java b/google-http-client/src/test/java/com/google/api/client/http/ExponentialBackOffPolicyTest.java
deleted file mode 100644
index fc9dc9bd1..000000000
--- a/google-http-client/src/test/java/com/google/api/client/http/ExponentialBackOffPolicyTest.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2011 Google Inc.
- *
- * 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;
-
-import com.google.api.client.util.NanoClock;
-
-import junit.framework.TestCase;
-
-/**
- * Tests {@link ExponentialBackOffPolicy}.
- *
- * @author Ravi Mistry
- */
-@Deprecated
-public class ExponentialBackOffPolicyTest extends TestCase {
-
- public ExponentialBackOffPolicyTest(String name) {
- super(name);
- }
-
- public void testConstructor() {
- ExponentialBackOffPolicy backOffPolicy = new ExponentialBackOffPolicy();
- assertEquals(ExponentialBackOffPolicy.DEFAULT_INITIAL_INTERVAL_MILLIS,
- backOffPolicy.getInitialIntervalMillis());
- assertEquals(ExponentialBackOffPolicy.DEFAULT_INITIAL_INTERVAL_MILLIS,
- backOffPolicy.getCurrentIntervalMillis());
- assertEquals(ExponentialBackOffPolicy.DEFAULT_RANDOMIZATION_FACTOR,
- backOffPolicy.getRandomizationFactor());
- assertEquals(ExponentialBackOffPolicy.DEFAULT_MULTIPLIER, backOffPolicy.getMultiplier());
- assertEquals(
- ExponentialBackOffPolicy.DEFAULT_MAX_INTERVAL_MILLIS, backOffPolicy.getMaxIntervalMillis());
- assertEquals(ExponentialBackOffPolicy.DEFAULT_MAX_ELAPSED_TIME_MILLIS,
- backOffPolicy.getMaxElapsedTimeMillis());
- }
-
- public void testBuilder() {
- ExponentialBackOffPolicy backOffPolicy = ExponentialBackOffPolicy.builder().build();
- assertEquals(ExponentialBackOffPolicy.DEFAULT_INITIAL_INTERVAL_MILLIS,
- backOffPolicy.getInitialIntervalMillis());
- assertEquals(ExponentialBackOffPolicy.DEFAULT_INITIAL_INTERVAL_MILLIS,
- backOffPolicy.getCurrentIntervalMillis());
- assertEquals(ExponentialBackOffPolicy.DEFAULT_RANDOMIZATION_FACTOR,
- backOffPolicy.getRandomizationFactor());
- assertEquals(ExponentialBackOffPolicy.DEFAULT_MULTIPLIER, backOffPolicy.getMultiplier());
- assertEquals(
- ExponentialBackOffPolicy.DEFAULT_MAX_INTERVAL_MILLIS, backOffPolicy.getMaxIntervalMillis());
- assertEquals(ExponentialBackOffPolicy.DEFAULT_MAX_ELAPSED_TIME_MILLIS,
- backOffPolicy.getMaxElapsedTimeMillis());
-
- int testInitialInterval = 1;
- double testRandomizationFactor = 0.1;
- double testMultiplier = 5.0;
- int testMaxInterval = 10;
- int testMaxElapsedTime = 900000;
-
- backOffPolicy = ExponentialBackOffPolicy.builder()
- .setInitialIntervalMillis(testInitialInterval)
- .setRandomizationFactor(testRandomizationFactor)
- .setMultiplier(testMultiplier)
- .setMaxIntervalMillis(testMaxInterval)
- .setMaxElapsedTimeMillis(testMaxElapsedTime)
- .build();
- assertEquals(testInitialInterval, backOffPolicy.getInitialIntervalMillis());
- assertEquals(testInitialInterval, backOffPolicy.getCurrentIntervalMillis());
- assertEquals(testRandomizationFactor, backOffPolicy.getRandomizationFactor());
- assertEquals(testMultiplier, backOffPolicy.getMultiplier());
- assertEquals(testMaxInterval, backOffPolicy.getMaxIntervalMillis());
- assertEquals(testMaxElapsedTime, backOffPolicy.getMaxElapsedTimeMillis());
- }
-
- public void testBackOff() throws Exception {
- int testInitialInterval = 500;
- double testRandomizationFactor = 0.1;
- double testMultiplier = 2.0;
- int testMaxInterval = 5000;
- int testMaxElapsedTime = 900000;
-
- ExponentialBackOffPolicy backOffPolicy = ExponentialBackOffPolicy.builder()
- .setInitialIntervalMillis(testInitialInterval)
- .setRandomizationFactor(testRandomizationFactor)
- .setMultiplier(testMultiplier)
- .setMaxIntervalMillis(testMaxInterval)
- .setMaxElapsedTimeMillis(testMaxElapsedTime)
- .build();
- int[] expectedResults = {500, 1000, 2000, 4000, 5000, 5000, 5000, 5000, 5000, 5000};
- for (int expected : expectedResults) {
- assertEquals(expected, backOffPolicy.getCurrentIntervalMillis());
- // Assert that the next back off falls in the expected range.
- int minInterval = (int) (expected - (testRandomizationFactor * expected));
- int maxInterval = (int) (expected + (testRandomizationFactor * expected));
- long actualInterval = backOffPolicy.getNextBackOffMillis();
- assertTrue(minInterval <= actualInterval && actualInterval <= maxInterval);
- }
- }
-
- static class MyNanoClock implements NanoClock {
-
- private int i = 0;
- private long startSeconds;
-
- MyNanoClock() {
- }
-
- MyNanoClock(long startSeconds) {
- this.startSeconds = startSeconds;
- }
-
- public long nanoTime() {
- return (startSeconds + i++) * 1000000000;
- }
- }
-
- public void testGetElapsedTimeMillis() {
- ExponentialBackOffPolicy backOffPolicy =
- new ExponentialBackOffPolicy.Builder().setNanoClock(new MyNanoClock()).build();
- long elapsedTimeMillis = backOffPolicy.getElapsedTimeMillis();
- assertEquals("elapsedTimeMillis=" + elapsedTimeMillis, 1000, elapsedTimeMillis);
- }
-
- public void testBackOffOverflow() throws Exception {
- int testInitialInterval = Integer.MAX_VALUE / 2;
- double testMultiplier = 2.1;
- int testMaxInterval = Integer.MAX_VALUE;
- ExponentialBackOffPolicy backOffPolicy = ExponentialBackOffPolicy.builder()
- .setInitialIntervalMillis(testInitialInterval)
- .setMultiplier(testMultiplier)
- .setMaxIntervalMillis(testMaxInterval)
- .build();
- backOffPolicy.getNextBackOffMillis();
- // Assert that when an overflow is possible the current interval is set to the max interval.
- assertEquals(testMaxInterval, backOffPolicy.getCurrentIntervalMillis());
- }
-}
diff --git a/google-http-client/src/test/java/com/google/api/client/http/HttpRequestTest.java b/google-http-client/src/test/java/com/google/api/client/http/HttpRequestTest.java
index 53a3d8842..f064b4802 100644
--- a/google-http-client/src/test/java/com/google/api/client/http/HttpRequestTest.java
+++ b/google-http-client/src/test/java/com/google/api/client/http/HttpRequestTest.java
@@ -100,6 +100,7 @@ public void testNotSupportedByDefault() throws Exception {
static class MockExecutor implements Executor {
private Runnable runnable;
+
public void actuallyRun() {
runnable.run();
}
@@ -109,39 +110,6 @@ public void execute(Runnable command) {
}
}
- @Deprecated
- static private class MockBackOffPolicy implements BackOffPolicy {
-
- int backOffCalls;
- int resetCalls;
- boolean returnBackOffStop;
-
- MockBackOffPolicy() {
- }
-
- public boolean isBackOffRequired(int statusCode) {
- switch (statusCode) {
- case HttpStatusCodes.STATUS_CODE_SERVER_ERROR: // 500
- case HttpStatusCodes.STATUS_CODE_SERVICE_UNAVAILABLE: // 503
- return true;
- default:
- return false;
- }
- }
-
- public void reset() {
- resetCalls++;
- }
-
- public long getNextBackOffMillis() {
- backOffCalls++;
- if (returnBackOffStop) {
- return BackOffPolicy.STOP;
- }
- return 0;
- }
- }
-
/**
* Transport used for testing the redirection logic in HttpRequest.
*/
@@ -210,29 +178,6 @@ public void test301Redirect() throws Exception {
Assert.assertEquals(2, fakeTransport.lowLevelExecCalls);
}
- @Deprecated
- public void test301RedirectWithUnsuccessfulResponseHandled() throws Exception {
- MockHttpUnsuccessfulResponseHandler handler = new MockHttpUnsuccessfulResponseHandler(true);
- MockBackOffPolicy backOffPolicy = new MockBackOffPolicy();
- // Set up RedirectTransport to redirect on the first request and then return success.
- RedirectTransport fakeTransport = new RedirectTransport();
- HttpRequest request =
- fakeTransport.createRequestFactory().buildGetRequest(new GenericUrl("http://gmail.com"));
- request.setUnsuccessfulResponseHandler(handler);
- request.setBackOffPolicy(backOffPolicy);
- HttpResponse resp = request.execute();
-
- Assert.assertEquals(200, resp.getStatusCode());
- Assert.assertEquals(2, fakeTransport.lowLevelExecCalls);
- // Assert that the redirect logic was not invoked because the response handler could handle the
- // request. The request url should be the original http://gmail.com
- Assert.assertEquals("http://gmail.com", request.getUrl().toString());
- // Assert that the backoff policy was not invoked because the response handler could handle the
- // request.
- Assert.assertEquals(1, backOffPolicy.resetCalls);
- Assert.assertEquals(0, backOffPolicy.backOffCalls);
- Assert.assertTrue(handler.isCalled());
- }
public void test301RedirectWithBackOffUnsuccessfulResponseHandled() throws Exception {
MockHttpUnsuccessfulResponseHandler handler = new MockHttpUnsuccessfulResponseHandler(true);
@@ -256,30 +201,6 @@ public void test301RedirectWithBackOffUnsuccessfulResponseHandled() throws Excep
Assert.assertTrue(handler.isCalled());
}
- @Deprecated
- public void test301RedirectWithUnsuccessfulResponseNotHandled() throws Exception {
- // Create an Unsuccessful response handler that always returns false.
- MockHttpUnsuccessfulResponseHandler handler = new MockHttpUnsuccessfulResponseHandler(false);
- MockBackOffPolicy backOffPolicy = new MockBackOffPolicy();
- // Set up RedirectTransport to redirect on the first request and then return success.
- RedirectTransport fakeTransport = new RedirectTransport();
- HttpRequest request =
- fakeTransport.createRequestFactory().buildGetRequest(new GenericUrl("http://gmail.com"));
- request.setUnsuccessfulResponseHandler(handler);
- request.setBackOffPolicy(backOffPolicy);
- HttpResponse resp = request.execute();
-
- Assert.assertEquals(200, resp.getStatusCode());
- // Assert that the redirect logic was invoked because the response handler could not handle the
- // request. The request url should have changed from http://gmail.com to http://google.com
- Assert.assertEquals(HttpTesting.SIMPLE_URL, request.getUrl().toString());
- Assert.assertEquals(2, fakeTransport.lowLevelExecCalls);
- // Assert that the backoff policy is never invoked (except to reset) because the response
- // handler returned false.
- Assert.assertEquals(1, backOffPolicy.resetCalls);
- Assert.assertEquals(0, backOffPolicy.backOffCalls);
- }
-
public void test301RedirectWithBackOffUnsuccessfulResponseNotHandled() throws Exception {
// Create an Unsuccessful response handler that always returns false.
MockHttpUnsuccessfulResponseHandler handler = new MockHttpUnsuccessfulResponseHandler(false);
@@ -647,26 +568,6 @@ public void testAbnormalResponseHandlerWithNoBackOff() throws Exception {
Assert.assertTrue(handler.isCalled());
}
- @Deprecated
- public void testAbnormalResponseHandlerWithBackOff() throws Exception {
- FailThenSuccessBackoffTransport fakeTransport =
- new FailThenSuccessBackoffTransport(HttpStatusCodes.STATUS_CODE_SERVER_ERROR, 1);
- MockHttpUnsuccessfulResponseHandler handler = new MockHttpUnsuccessfulResponseHandler(true);
- MockBackOffPolicy backOffPolicy = new MockBackOffPolicy();
-
- HttpRequest req =
- fakeTransport.createRequestFactory().buildGetRequest(new GenericUrl("http://not/used"));
- req.setUnsuccessfulResponseHandler(handler);
- req.setBackOffPolicy(backOffPolicy);
- HttpResponse resp = req.execute();
-
- Assert.assertEquals(200, resp.getStatusCode());
- Assert.assertEquals(2, fakeTransport.lowLevelExecCalls);
- Assert.assertEquals(1, backOffPolicy.resetCalls);
- Assert.assertEquals(0, backOffPolicy.backOffCalls);
- Assert.assertTrue(handler.isCalled());
- }
-
public void testAbnormalResponseHandlerWithBackOffUnsuccessfulResponseHandler() throws Exception {
FailThenSuccessBackoffTransport fakeTransport =
new FailThenSuccessBackoffTransport(HttpStatusCodes.STATUS_CODE_SERVER_ERROR, 1);
@@ -684,26 +585,6 @@ public void testAbnormalResponseHandlerWithBackOffUnsuccessfulResponseHandler()
Assert.assertTrue(handler.isCalled());
}
- @Deprecated
- public void testBackOffSingleCall() throws Exception {
- FailThenSuccessBackoffTransport fakeTransport =
- new FailThenSuccessBackoffTransport(HttpStatusCodes.STATUS_CODE_SERVER_ERROR, 1);
- MockHttpUnsuccessfulResponseHandler handler = new MockHttpUnsuccessfulResponseHandler(false);
- MockBackOffPolicy backOffPolicy = new MockBackOffPolicy();
-
- HttpRequest req =
- fakeTransport.createRequestFactory().buildGetRequest(new GenericUrl("http://not/used"));
- req.setUnsuccessfulResponseHandler(handler);
- req.setBackOffPolicy(backOffPolicy);
- HttpResponse resp = req.execute();
-
- Assert.assertEquals(200, resp.getStatusCode());
- Assert.assertEquals(2, fakeTransport.lowLevelExecCalls);
- Assert.assertEquals(1, backOffPolicy.resetCalls);
- Assert.assertEquals(1, backOffPolicy.backOffCalls);
- Assert.assertTrue(handler.isCalled());
- }
-
public void testBackOffUnsuccessfulResponseSingleCall() throws Exception {
FailThenSuccessBackoffTransport fakeTransport =
new FailThenSuccessBackoffTransport(HttpStatusCodes.STATUS_CODE_SERVER_ERROR, 1);
@@ -721,27 +602,6 @@ public void testBackOffUnsuccessfulResponseSingleCall() throws Exception {
Assert.assertTrue(handler.isCalled());
}
- @Deprecated
- public void testBackOffMultipleCalls() throws Exception {
- int callsBeforeSuccess = 5;
- FailThenSuccessBackoffTransport fakeTransport = new FailThenSuccessBackoffTransport(
- HttpStatusCodes.STATUS_CODE_SERVER_ERROR, callsBeforeSuccess);
- MockHttpUnsuccessfulResponseHandler handler = new MockHttpUnsuccessfulResponseHandler(false);
- MockBackOffPolicy backOffPolicy = new MockBackOffPolicy();
-
- HttpRequest req =
- fakeTransport.createRequestFactory().buildGetRequest(new GenericUrl("http://not/used"));
- req.setUnsuccessfulResponseHandler(handler);
- req.setBackOffPolicy(backOffPolicy);
- HttpResponse resp = req.execute();
-
- Assert.assertEquals(200, resp.getStatusCode());
- Assert.assertEquals(callsBeforeSuccess + 1, fakeTransport.lowLevelExecCalls);
- Assert.assertEquals(1, backOffPolicy.resetCalls);
- Assert.assertEquals(callsBeforeSuccess, backOffPolicy.backOffCalls);
- Assert.assertTrue(handler.isCalled());
- }
-
public void testBackOffUnsucessfulReponseMultipleCalls() throws Exception {
int callsBeforeSuccess = 5;
FailThenSuccessBackoffTransport fakeTransport = new FailThenSuccessBackoffTransport(
@@ -760,30 +620,6 @@ public void testBackOffUnsucessfulReponseMultipleCalls() throws Exception {
Assert.assertTrue(handler.isCalled());
}
- @Deprecated
- public void testBackOffCallsBeyondRetryLimit() throws Exception {
- int callsBeforeSuccess = 11;
- FailThenSuccessBackoffTransport fakeTransport = new FailThenSuccessBackoffTransport(
- HttpStatusCodes.STATUS_CODE_SERVER_ERROR, callsBeforeSuccess);
- MockHttpUnsuccessfulResponseHandler handler = new MockHttpUnsuccessfulResponseHandler(false);
- MockBackOffPolicy backOffPolicy = new MockBackOffPolicy();
-
- HttpRequest req =
- fakeTransport.createRequestFactory().buildGetRequest(new GenericUrl("http://not/used"));
- req.setNumberOfRetries(callsBeforeSuccess - 1);
- req.setUnsuccessfulResponseHandler(handler);
- req.setBackOffPolicy(backOffPolicy);
- try {
- req.execute();
- fail("expected HttpResponseException");
- } catch (HttpResponseException e) {
- }
- Assert.assertEquals(callsBeforeSuccess, fakeTransport.lowLevelExecCalls);
- Assert.assertEquals(1, backOffPolicy.resetCalls);
- Assert.assertEquals(callsBeforeSuccess - 1, backOffPolicy.backOffCalls);
- Assert.assertTrue(handler.isCalled());
- }
-
public void testBackOffUnsuccessfulReponseCallsBeyondRetryLimit() throws Exception {
int callsBeforeSuccess = 11;
FailThenSuccessBackoffTransport fakeTransport = new FailThenSuccessBackoffTransport(
@@ -805,29 +641,6 @@ public void testBackOffUnsuccessfulReponseCallsBeyondRetryLimit() throws Excepti
Assert.assertTrue(handler.isCalled());
}
- @Deprecated
- public void testBackOffUnRecognizedStatusCode() throws Exception {
- FailThenSuccessBackoffTransport fakeTransport =
- new FailThenSuccessBackoffTransport(HttpStatusCodes.STATUS_CODE_UNAUTHORIZED, 1);
- MockHttpUnsuccessfulResponseHandler handler = new MockHttpUnsuccessfulResponseHandler(false);
- MockBackOffPolicy backOffPolicy = new MockBackOffPolicy();
-
- HttpRequest req =
- fakeTransport.createRequestFactory().buildGetRequest(new GenericUrl("http://not/used"));
- req.setUnsuccessfulResponseHandler(handler);
- req.setBackOffPolicy(backOffPolicy);
- try {
- req.execute();
- } catch (HttpResponseException e) {
- }
-
- Assert.assertEquals(1, fakeTransport.lowLevelExecCalls);
- Assert.assertEquals(1, backOffPolicy.resetCalls);
- // The BackOffPolicy should not be called since it does not support 401 status codes.
- Assert.assertEquals(0, backOffPolicy.backOffCalls);
- Assert.assertTrue(handler.isCalled());
- }
-
public void testBackOffUnsuccessfulReponseUnRecognizedStatusCode() throws Exception {
FailThenSuccessBackoffTransport fakeTransport =
new FailThenSuccessBackoffTransport(HttpStatusCodes.STATUS_CODE_UNAUTHORIZED, 1);
@@ -848,32 +661,6 @@ public void testBackOffUnsuccessfulReponseUnRecognizedStatusCode() throws Except
Assert.assertTrue(handler.isCalled());
}
- @Deprecated
- public void testBackOffStop() throws Exception {
- int callsBeforeSuccess = 5;
- FailThenSuccessBackoffTransport fakeTransport = new FailThenSuccessBackoffTransport(
- HttpStatusCodes.STATUS_CODE_SERVER_ERROR, callsBeforeSuccess);
- MockHttpUnsuccessfulResponseHandler handler = new MockHttpUnsuccessfulResponseHandler(false);
- MockBackOffPolicy backOffPolicy = new MockBackOffPolicy();
- backOffPolicy.returnBackOffStop = true;
-
- HttpRequest req =
- fakeTransport.createRequestFactory().buildGetRequest(new GenericUrl("http://not/used"));
- req.setUnsuccessfulResponseHandler(handler);
- req.setBackOffPolicy(backOffPolicy);
- try {
- req.execute();
- } catch (HttpResponseException e) {
- }
-
- Assert.assertEquals(1, fakeTransport.lowLevelExecCalls);
- Assert.assertEquals(1, backOffPolicy.resetCalls);
- // The BackOffPolicy should be called only once and then it should return BackOffPolicy.STOP
- // should stop all back off retries.
- Assert.assertEquals(1, backOffPolicy.backOffCalls);
- Assert.assertTrue(handler.isCalled());
- }
-
public void testBackOffUnsucessfulResponseStop() throws Exception {
int callsBeforeSuccess = 5;
FailThenSuccessBackoffTransport fakeTransport = new FailThenSuccessBackoffTransport(
From b3aea0fa8ff815f349d8e36c7a313362a1e44f19 Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Fri, 2 Nov 2018 14:35:08 -0700
Subject: [PATCH 002/983] Set the version of the jarjar-maven-plugin in
pluginManagement (#515)
---
pom.xml | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 0b710eb0d..cb95ddfb9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -297,7 +297,11 @@
1.6
-
+
+ org.sonatype.plugins
+ jarjar-maven-plugin
+ 1.9
+ org.apache.maven.pluginsmaven-source-plugin
From f4c456726233a2f917b2ee0a8ca660e802f17b76 Mon Sep 17 00:00:00 2001
From: Elliotte Rusty Harold
Date: Fri, 2 Nov 2018 18:37:17 -0400
Subject: [PATCH 003/983] guava is not provided (#508)
---
google-http-client/pom.xml | 1 -
1 file changed, 1 deletion(-)
diff --git a/google-http-client/pom.xml b/google-http-client/pom.xml
index 0a5996d24..f5ea5497c 100644
--- a/google-http-client/pom.xml
+++ b/google-http-client/pom.xml
@@ -142,7 +142,6 @@
com.google.guavaguava
- providedcom.google.guava
From 0a95dd0d626a34b5127d2f3c78dfeef3cd555b4b Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Tue, 6 Nov 2018 15:15:15 -0800
Subject: [PATCH 004/983] Upgrade maven-javadoc-plugin to 3.0.1 (#519)
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index cb95ddfb9..f480cc106 100644
--- a/pom.xml
+++ b/pom.xml
@@ -318,7 +318,7 @@
org.apache.maven.pluginsmaven-javadoc-plugin
- 2.9.1
+ 3.0.1attach-javadocs
From e1c40f6127bf7b04bdc83b877156203a3194d7e3 Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Tue, 6 Nov 2018 15:16:44 -0800
Subject: [PATCH 005/983] Add google-http-client-bom artifact (#517)
* Add initial pom.xml and README for bom
* Add the bom in the dependencyManagement section of the parent pom
* artifact poms do not need special release info
* PR comments
* Put dependencyManagement section back in parent pom
---
google-http-client-bom/README.md | 28 ++++++++
google-http-client-bom/pom.xml | 113 +++++++++++++++++++++++++++++++
pom.xml | 3 +-
versions.txt | 1 +
4 files changed, 144 insertions(+), 1 deletion(-)
create mode 100644 google-http-client-bom/README.md
create mode 100644 google-http-client-bom/pom.xml
diff --git a/google-http-client-bom/README.md b/google-http-client-bom/README.md
new file mode 100644
index 000000000..568a067db
--- /dev/null
+++ b/google-http-client-bom/README.md
@@ -0,0 +1,28 @@
+# Google HTTP Client Library Bill of Materials
+
+The `google-http-client-bom` modules is a pom that can be used to import consistent
+versions of `google-http-client` components plus its dependencies.
+
+To use it in Maven, add the following to your `pom.xml`:
+
+[//]: # ({x-version-update-start:google-http-client-bom:released})
+```xml
+
+
+
+ com.google.http-client
+ google-http-client-bom
+ 1.26.0
+ pom
+ import
+
+
+
+```
+[//]: # ({x-version-update-end})
+
+## License
+
+Apache 2.0 - See [LICENSE] for more information.
+
+[LICENSE]: https://github.com/googleapis/google-http-java-client/blob/master/LICENSE
diff --git a/google-http-client-bom/pom.xml b/google-http-client-bom/pom.xml
new file mode 100644
index 000000000..a71e63ae9
--- /dev/null
+++ b/google-http-client-bom/pom.xml
@@ -0,0 +1,113 @@
+
+
+ 4.0.0
+ com.google.http-client
+ google-http-client-bom
+ 1.26.1-SNAPSHOT
+ pom
+
+ Google HTTP Client Library for Java BOM
+ https://github.com/googleapis/google-http-java-client/tree/master/google-http-client-bom
+
+ BOM for Google HTTP Client Library for Java
+
+
+
+ Google LLC
+
+
+
+ scm:git:https://github.com/googleapis/google-http-java-client.git
+ scm:git:git@github.com:googleapis/google-http-java-client.git
+ https://github.com/googleapis/google-http-java-client
+
+
+
+
+ sonatype-nexus-snapshots
+ https://oss.sonatype.org/content/repositories/snapshots
+
+
+ sonatype-nexus-staging
+ https://oss.sonatype.org/service/local/staging/deploy/maven2/
+
+
+ github-pages-site
+ Deployment through GitHub's site deployment plugin
+ site/google-cloud-bom
+
+
+
+
+
+ The Apache Software License, Version 2.0
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+ repo
+
+
+
+
+
+
+ com.google.http-client
+ google-http-client
+ 1.26.1-SNAPSHOT
+
+
+ com.google.http-client
+ google-http-client-android
+ 1.26.1-SNAPSHOT
+
+
+ com.google.http-client
+ google-http-client-appengine
+ 1.26.1-SNAPSHOT
+
+
+ com.google.http-client
+ google-http-client-assembly
+ 1.26.1-SNAPSHOT
+
+
+ com.google.http-client
+ google-http-client-findbugs
+ 1.26.1-SNAPSHOT
+
+
+ com.google.http-client
+ google-http-client-gson
+ 1.26.1-SNAPSHOT
+
+
+ com.google.http-client
+ google-http-client-jackson
+ 1.26.1-SNAPSHOT
+
+
+ com.google.http-client
+ google-http-client-jackson2
+ 1.26.1-SNAPSHOT
+
+
+ com.google.http-client
+ google-http-client-jdo
+ 1.26.1-SNAPSHOT
+
+
+ com.google.http-client
+ google-http-client-protobuf
+ 1.26.1-SNAPSHOT
+
+
+ com.google.http-client
+ google-http-client-test
+ 1.26.1-SNAPSHOT
+
+
+ com.google.http-client
+ google-http-client-xml
+ 1.26.1-SNAPSHOT
+
+
+
+
diff --git a/pom.xml b/pom.xml
index f480cc106..ea6bdf3d1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -66,6 +66,7 @@
google-http-client-jacksongoogle-http-client-jackson2google-http-client-jdo
+ google-http-client-xmlgoogle-http-client-findbugsgoogle-http-client-test
@@ -73,7 +74,7 @@
samples/googleplus-simple-cmdline-sample
- google-http-client-xml
+ google-http-client-bom
diff --git a/versions.txt b/versions.txt
index 61355d7cd..6983f416e 100644
--- a/versions.txt
+++ b/versions.txt
@@ -2,6 +2,7 @@
# module:released-version:current-version
google-http-client:1.26.0:1.26.1-SNAPSHOT
+google-http-client-bom:1.26.0:1.26.1-SNAPSHOT
google-http-client-parent:1.26.0:1.26.1-SNAPSHOT
google-http-client-android:1.26.0:1.26.1-SNAPSHOT
google-http-client-android-test:1.26.0:1.26.1-SNAPSHOT
From 287cca15a34a2d758b4125c4a37e4ee38d2bdbdd Mon Sep 17 00:00:00 2001
From: Gerald Madlmayr
Date: Wed, 7 Nov 2018 00:17:42 +0100
Subject: [PATCH 006/983] Allow Enums in DataMaps (#505)
* Fixes bug in #475, add relevant Tests (#504)
* Adding more Tests for XML parsing/mapping (#504)
* Add more list tests (#504)
* Cleanup documentation of tests (#504)
* Adding asserts in GenericXmlTests (#504)
* Try-with-resources Java6 Style (#504)
* Replace Heise feed with Custom feed, set encoding for reading file (#504)
* Use Guava for reading resource file (#504)
* delete commented out code (#504)
* Improve JavaDoc of Tests (#504)
* Change method of asserting enums (#504)
* Minor fixes in JavaDoc (#504)
* Rename Test methods (#504)
* Fix Typo in JavaDoc (#504)
* Remove irrelevant annotation, clean up test case (#504)
* Fix incorrect/missing annotations, improve instanceof annotations (#504)
---
.../java/com/google/api/client/xml/Xml.java | 1 +
.../com/google/api/client/xml/AtomTest.java | 270 +++++++-
.../api/client/xml/GenericXmlListTest.java | 467 ++++++++++++++
.../google/api/client/xml/GenericXmlTest.java | 392 +++++++++++-
.../google/api/client/xml/XmlEnumTest.java | 197 ++++--
.../google/api/client/xml/XmlListTest.java | 410 ++++++++++++
.../xml/XmlNamespaceDictionaryTest.java | 102 ++-
.../com/google/api/client/xml/XmlTest.java | 605 ++++++++++++++++--
.../src/test/resources/sample-atom.xml | 1 +
.../com/google/api/client/util/DataMap.java | 1 -
10 files changed, 2242 insertions(+), 204 deletions(-)
create mode 100644 google-http-client-xml/src/test/java/com/google/api/client/xml/GenericXmlListTest.java
create mode 100644 google-http-client-xml/src/test/java/com/google/api/client/xml/XmlListTest.java
create mode 100644 google-http-client-xml/src/test/resources/sample-atom.xml
diff --git a/google-http-client-xml/src/main/java/com/google/api/client/xml/Xml.java b/google-http-client-xml/src/main/java/com/google/api/client/xml/Xml.java
index a0f0b95d2..935eee30b 100644
--- a/google-http-client-xml/src/main/java/com/google/api/client/xml/Xml.java
+++ b/google-http-client-xml/src/main/java/com/google/api/client/xml/Xml.java
@@ -94,6 +94,7 @@ public static XmlPullParser createParser() throws XmlPullParserException {
/**
* Shows a debug string representation of an element data object of key/value pairs.
+ *
*
+ * Implementations may want to back off on server or product-specific errors.
+ *
+ *
+ * @param statusCode HTTP status code
+ */
+ public boolean isBackOffRequired(int statusCode);
+
+ /**
+ * Reset Back off counters (if any) in an implementation-specific fashion.
+ */
+ public void reset();
+
+ /**
+ * Gets the number of milliseconds to wait before retrying an HTTP request. If {@link #STOP} is
+ * returned, no retries should be made.
+ *
+ * This method should be used as follows:
+ *
+ *
+ *
+ * @return the number of milliseconds to wait when backing off requests, or {@link #STOP} if no
+ * more retries should be made
+ */
+ public long getNextBackOffMillis() throws IOException;
+}
diff --git a/google-http-client/src/main/java/com/google/api/client/http/ExponentialBackOffPolicy.java b/google-http-client/src/main/java/com/google/api/client/http/ExponentialBackOffPolicy.java
new file mode 100644
index 000000000..90e8d0058
--- /dev/null
+++ b/google-http-client/src/main/java/com/google/api/client/http/ExponentialBackOffPolicy.java
@@ -0,0 +1,454 @@
+/*
+ * Copyright (c) 2011 Google Inc.
+ *
+ * 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;
+
+import com.google.api.client.util.Beta;
+import com.google.api.client.util.ExponentialBackOff;
+import com.google.api.client.util.NanoClock;
+
+import java.io.IOException;
+
+/**
+ * {@link Beta}
+ * Implementation of {@link BackOffPolicy} that increases the back off period for each retry attempt
+ * using a randomization function that grows exponentially.
+ *
+ *
+ * {@link #getNextBackOffMillis()} is calculated using the following formula:
+ *
+ *
+ * randomized_interval =
+ * retry_interval * (random value in range [1 - randomization_factor, 1 + randomization_factor])
+ *
+ * In other words {@link #getNextBackOffMillis()} will range between the randomization factor
+ * percentage below and above the retry interval. For example, using 2 seconds as the base retry
+ * interval and 0.5 as the randomization factor, the actual back off period used in the next retry
+ * attempt will be between 1 and 3 seconds.
+ *
+ *
+ *
+ * Note: max_interval caps the retry_interval and not the randomized_interval.
+ *
+ *
+ *
+ * If the time elapsed since an {@link ExponentialBackOffPolicy} instance is created goes past the
+ * max_elapsed_time then the method {@link #getNextBackOffMillis()} starts returning
+ * {@link BackOffPolicy#STOP}. The elapsed time can be reset by calling {@link #reset()}.
+ *
+ *
+ *
+ * Example: The default retry_interval is .5 seconds, default randomization_factor is 0.5, default
+ * multiplier is 1.5 and the default max_interval is 1 minute. For 10 requests the sequence will be
+ * (values in seconds) and assuming we go over the max_elapsed_time on the 10th request:
+ *
+ *
+ *
+ * @since 1.7
+ * @author Ravi Mistry
+ * @deprecated (scheduled to be removed in 1.18). Use {@link HttpBackOffUnsuccessfulResponseHandler}
+ * with {@link ExponentialBackOff} instead.
+ */
+@Beta
+@Deprecated
+public class ExponentialBackOffPolicy implements BackOffPolicy {
+
+ /**
+ * The default initial interval value in milliseconds (0.5 seconds).
+ */
+ public static final int DEFAULT_INITIAL_INTERVAL_MILLIS =
+ ExponentialBackOff.DEFAULT_INITIAL_INTERVAL_MILLIS;
+
+ /**
+ * The default randomization factor (0.5 which results in a random period ranging between 50%
+ * below and 50% above the retry interval).
+ */
+ public static final double DEFAULT_RANDOMIZATION_FACTOR =
+ ExponentialBackOff.DEFAULT_RANDOMIZATION_FACTOR;
+
+ /**
+ * The default multiplier value (1.5 which is 50% increase per back off).
+ */
+ public static final double DEFAULT_MULTIPLIER = ExponentialBackOff.DEFAULT_MULTIPLIER;
+
+ /**
+ * The default maximum back off time in milliseconds (1 minute).
+ */
+ public static final int DEFAULT_MAX_INTERVAL_MILLIS =
+ ExponentialBackOff.DEFAULT_MAX_INTERVAL_MILLIS;
+
+ /**
+ * The default maximum elapsed time in milliseconds (15 minutes).
+ */
+ public static final int DEFAULT_MAX_ELAPSED_TIME_MILLIS =
+ ExponentialBackOff.DEFAULT_MAX_ELAPSED_TIME_MILLIS;
+
+ /** Exponential backoff. */
+ private final ExponentialBackOff exponentialBackOff;
+
+ /**
+ * Creates an instance of ExponentialBackOffPolicy using default values. To override the defaults
+ * use {@link #builder}.
+ *
+ *
{@code initialIntervalMillis} is defaulted to {@link #DEFAULT_INITIAL_INTERVAL_MILLIS}
+ *
{@code randomizationFactor} is defaulted to {@link #DEFAULT_RANDOMIZATION_FACTOR}
+ *
{@code multiplier} is defaulted to {@link #DEFAULT_MULTIPLIER}
+ *
{@code maxIntervalMillis} is defaulted to {@link #DEFAULT_MAX_INTERVAL_MILLIS}
+ *
{@code maxElapsedTimeMillis} is defaulted in {@link #DEFAULT_MAX_ELAPSED_TIME_MILLIS}
+ *
+ */
+ public ExponentialBackOffPolicy() {
+ this(new Builder());
+ }
+
+ /**
+ * @param builder builder
+ *
+ * @since 1.14
+ */
+ protected ExponentialBackOffPolicy(Builder builder) {
+ exponentialBackOff = builder.exponentialBackOffBuilder.build();
+ }
+
+ /**
+ * Determines if back off is required based on the specified status code.
+ *
+ *
+ * The idea is that the servers are only temporarily unavailable, and they should not be
+ * overwhelmed when they are trying to get back up.
+ *
+ *
+ *
+ * The default implementation requires back off for 500 and 503 status codes. Subclasses may
+ * override if different status codes are required.
+ *
+ */
+ public boolean isBackOffRequired(int statusCode) {
+ switch (statusCode) {
+ case HttpStatusCodes.STATUS_CODE_SERVER_ERROR: // 500
+ case HttpStatusCodes.STATUS_CODE_SERVICE_UNAVAILABLE: // 503
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Sets the interval back to the initial retry interval and restarts the timer.
+ */
+ public final void reset() {
+ exponentialBackOff.reset();
+ }
+
+ /**
+ * Gets the number of milliseconds to wait before retrying an HTTP request. If {@link #STOP} is
+ * returned, no retries should be made.
+ *
+ *
+ * This method calculates the next back off interval using the formula: randomized_interval =
+ * retry_interval +/- (randomization_factor * retry_interval)
+ *
+ *
+ *
+ * Subclasses may override if a different algorithm is required.
+ *
+ *
+ * @return the number of milliseconds to wait when backing off requests, or {@link #STOP} if no
+ * more retries should be made
+ */
+ public long getNextBackOffMillis() throws IOException {
+ return exponentialBackOff.nextBackOffMillis();
+ }
+
+ /**
+ * Returns the initial retry interval in milliseconds.
+ */
+ public final int getInitialIntervalMillis() {
+ return exponentialBackOff.getInitialIntervalMillis();
+ }
+
+ /**
+ * Returns the randomization factor to use for creating a range around the retry interval.
+ *
+ *
+ * A randomization factor of 0.5 results in a random period ranging between 50% below and 50%
+ * above the retry interval.
+ *
+ */
+ public final double getRandomizationFactor() {
+ return exponentialBackOff.getRandomizationFactor();
+ }
+
+ /**
+ * Returns the current retry interval in milliseconds.
+ */
+ public final int getCurrentIntervalMillis() {
+ return exponentialBackOff.getCurrentIntervalMillis();
+ }
+
+ /**
+ * Returns the value to multiply the current interval with for each retry attempt.
+ */
+ public final double getMultiplier() {
+ return exponentialBackOff.getMultiplier();
+ }
+
+ /**
+ * Returns the maximum value of the back off period in milliseconds. Once the current interval
+ * reaches this value it stops increasing.
+ */
+ public final int getMaxIntervalMillis() {
+ return exponentialBackOff.getMaxIntervalMillis();
+ }
+
+ /**
+ * Returns the maximum elapsed time in milliseconds.
+ *
+ *
+ * If the time elapsed since an {@link ExponentialBackOffPolicy} instance is created goes past the
+ * max_elapsed_time then the method {@link #getNextBackOffMillis()} starts returning
+ * {@link BackOffPolicy#STOP}. The elapsed time can be reset by calling {@link #reset()}.
+ *
+ */
+ public final int getMaxElapsedTimeMillis() {
+ return exponentialBackOff.getMaxElapsedTimeMillis();
+ }
+
+ /**
+ * Returns the elapsed time in milliseconds since an {@link ExponentialBackOffPolicy} instance is
+ * created and is reset when {@link #reset()} is called.
+ *
+ *
+ * The elapsed time is computed using {@link System#nanoTime()}.
+ *
+ */
+ public final long getElapsedTimeMillis() {
+ return exponentialBackOff.getElapsedTimeMillis();
+ }
+
+ /**
+ * Returns an instance of a new builder.
+ */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * {@link Beta}
+ * Builder for {@link ExponentialBackOffPolicy}.
+ *
+ *
+ * Implementation is not thread-safe.
+ *
+ *
+ * @since 1.7
+ */
+ @Beta
+ @Deprecated
+ public static class Builder {
+
+ /** Exponential back-off builder. */
+ final ExponentialBackOff.Builder exponentialBackOffBuilder = new ExponentialBackOff.Builder();
+
+ protected Builder() {
+ }
+
+ /** Builds a new instance of {@link ExponentialBackOffPolicy}. */
+ public ExponentialBackOffPolicy build() {
+ return new ExponentialBackOffPolicy(this);
+ }
+
+ /**
+ * Returns the initial retry interval in milliseconds. The default value is
+ * {@link #DEFAULT_INITIAL_INTERVAL_MILLIS}.
+ */
+ public final int getInitialIntervalMillis() {
+ return exponentialBackOffBuilder.getInitialIntervalMillis();
+ }
+
+ /**
+ * Sets the initial retry interval in milliseconds. The default value is
+ * {@link #DEFAULT_INITIAL_INTERVAL_MILLIS}. Must be {@code > 0}.
+ *
+ *
+ * Overriding is only supported for the purpose of calling the super implementation and changing
+ * the return type, but nothing else.
+ *
+ */
+ public Builder setInitialIntervalMillis(int initialIntervalMillis) {
+ exponentialBackOffBuilder.setInitialIntervalMillis(initialIntervalMillis);
+ return this;
+ }
+
+ /**
+ * Returns the randomization factor to use for creating a range around the retry interval. The
+ * default value is {@link #DEFAULT_RANDOMIZATION_FACTOR}.
+ *
+ *
+ * A randomization factor of 0.5 results in a random period ranging between 50% below and 50%
+ * above the retry interval.
+ *
+ *
+ *
+ * Overriding is only supported for the purpose of calling the super implementation and changing
+ * the return type, but nothing else.
+ *
+ */
+ public final double getRandomizationFactor() {
+ return exponentialBackOffBuilder.getRandomizationFactor();
+ }
+
+ /**
+ * Sets the randomization factor to use for creating a range around the retry interval. The
+ * default value is {@link #DEFAULT_RANDOMIZATION_FACTOR}. Must fall in the range
+ * {@code 0 <= randomizationFactor < 1}.
+ *
+ *
+ * A randomization factor of 0.5 results in a random period ranging between 50% below and 50%
+ * above the retry interval.
+ *
+ *
+ *
+ * Overriding is only supported for the purpose of calling the super implementation and changing
+ * the return type, but nothing else.
+ *
+ */
+ public Builder setRandomizationFactor(double randomizationFactor) {
+ exponentialBackOffBuilder.setRandomizationFactor(randomizationFactor);
+ return this;
+ }
+
+ /**
+ * Returns the value to multiply the current interval with for each retry attempt. The default
+ * value is {@link #DEFAULT_MULTIPLIER}.
+ */
+ public final double getMultiplier() {
+ return exponentialBackOffBuilder.getMultiplier();
+ }
+
+ /**
+ * Sets the value to multiply the current interval with for each retry attempt. The default
+ * value is {@link #DEFAULT_MULTIPLIER}. Must be {@code >= 1}.
+ *
+ *
+ * Overriding is only supported for the purpose of calling the super implementation and changing
+ * the return type, but nothing else.
+ *
+ */
+ public Builder setMultiplier(double multiplier) {
+ exponentialBackOffBuilder.setMultiplier(multiplier);
+ return this;
+ }
+
+ /**
+ * Returns the maximum value of the back off period in milliseconds. Once the current interval
+ * reaches this value it stops increasing. The default value is
+ * {@link #DEFAULT_MAX_INTERVAL_MILLIS}. Must be {@code >= initialInterval}.
+ */
+ public final int getMaxIntervalMillis() {
+ return exponentialBackOffBuilder.getMaxIntervalMillis();
+ }
+
+ /**
+ * Sets the maximum value of the back off period in milliseconds. Once the current interval
+ * reaches this value it stops increasing. The default value is
+ * {@link #DEFAULT_MAX_INTERVAL_MILLIS}.
+ *
+ *
+ * Overriding is only supported for the purpose of calling the super implementation and changing
+ * the return type, but nothing else.
+ *
+ */
+ public Builder setMaxIntervalMillis(int maxIntervalMillis) {
+ exponentialBackOffBuilder.setMaxIntervalMillis(maxIntervalMillis);
+ return this;
+ }
+
+ /**
+ * Returns the maximum elapsed time in milliseconds. The default value is
+ * {@link #DEFAULT_MAX_ELAPSED_TIME_MILLIS}.
+ *
+ *
+ * If the time elapsed since an {@link ExponentialBackOffPolicy} instance is created goes past
+ * the max_elapsed_time then the method {@link #getNextBackOffMillis()} starts returning
+ * {@link BackOffPolicy#STOP}. The elapsed time can be reset by calling {@link #reset()}.
+ *
+ */
+ public final int getMaxElapsedTimeMillis() {
+ return exponentialBackOffBuilder.getMaxElapsedTimeMillis();
+ }
+
+ /**
+ * Sets the maximum elapsed time in milliseconds. The default value is
+ * {@link #DEFAULT_MAX_ELAPSED_TIME_MILLIS}. Must be {@code > 0}.
+ *
+ *
+ * If the time elapsed since an {@link ExponentialBackOffPolicy} instance is created goes past
+ * the max_elapsed_time then the method {@link #getNextBackOffMillis()} starts returning
+ * {@link BackOffPolicy#STOP}. The elapsed time can be reset by calling {@link #reset()}.
+ *
+ *
+ *
+ * Overriding is only supported for the purpose of calling the super implementation and changing
+ * the return type, but nothing else.
+ *
+ */
+ public Builder setMaxElapsedTimeMillis(int maxElapsedTimeMillis) {
+ exponentialBackOffBuilder.setMaxElapsedTimeMillis(maxElapsedTimeMillis);
+ return this;
+ }
+
+ /**
+ * Returns the nano clock.
+ *
+ * @since 1.14
+ */
+ public final NanoClock getNanoClock() {
+ return exponentialBackOffBuilder.getNanoClock();
+ }
+
+ /**
+ * Sets the nano clock ({@link NanoClock#SYSTEM} by default).
+ *
+ *
+ * Overriding is only supported for the purpose of calling the super implementation and changing
+ * the return type, but nothing else.
+ *
+ *
+ * @since 1.14
+ */
+ public Builder setNanoClock(NanoClock nanoClock) {
+ exponentialBackOffBuilder.setNanoClock(nanoClock);
+ return this;
+ }
+ }
+}
diff --git a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
index cb9e91e7e..d75b7fa2f 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
@@ -174,6 +174,13 @@ static String executeAndGetValueOfSomeCustomHeader(HttpRequest request) {
/** HTTP content encoding or {@code null} for none. */
private HttpEncoding encoding;
+ /**
+ * The {@link BackOffPolicy} to use between retry attempts or {@code null} for none.
+ */
+ @Deprecated
+ @Beta
+ private BackOffPolicy backOffPolicy;
+
/** Whether to automatically follow redirects ({@code true} by default). */
private boolean followRedirects = true;
@@ -298,6 +305,37 @@ public HttpRequest setEncoding(HttpEncoding encoding) {
return this;
}
+ /**
+ * {@link Beta}
+ * Returns the {@link BackOffPolicy} to use between retry attempts or {@code null} for none.
+ *
+ * @since 1.7
+ * @deprecated (scheduled to be removed in 1.18).
+ * {@link #setUnsuccessfulResponseHandler(HttpUnsuccessfulResponseHandler)} with a new
+ * {@link HttpBackOffUnsuccessfulResponseHandler} instead.
+ */
+ @Deprecated
+ @Beta
+ public BackOffPolicy getBackOffPolicy() {
+ return backOffPolicy;
+ }
+
+ /**
+ * {@link Beta}
+ * Sets the {@link BackOffPolicy} to use between retry attempts or {@code null} for none.
+ *
+ * @since 1.7
+ * @deprecated (scheduled to be removed in 1.18). Use
+ * {@link #setUnsuccessfulResponseHandler(HttpUnsuccessfulResponseHandler)} with a new
+ * {@link HttpBackOffUnsuccessfulResponseHandler} instead.
+ */
+ @Deprecated
+ @Beta
+ public HttpRequest setBackOffPolicy(BackOffPolicy backOffPolicy) {
+ this.backOffPolicy = backOffPolicy;
+ return this;
+ }
+
/**
* Returns the limit to the content size that will be logged during {@link #execute()}.
*
@@ -806,8 +844,10 @@ public HttpResponse execute() throws IOException {
boolean retryRequest = false;
Preconditions.checkArgument(numRetries >= 0);
int retriesRemaining = numRetries;
- // TODO(chingor): notify error handlers that the request is about to start
-
+ if (backOffPolicy != null) {
+ // Reset the BackOffPolicy at the start of each execute.
+ backOffPolicy.reset();
+ }
HttpResponse response = null;
IOException executeException;
@@ -980,6 +1020,19 @@ public HttpResponse execute() throws IOException {
if (handleRedirect(response.getStatusCode(), response.getHeaders())) {
// The unsuccessful request's error could not be handled and it is a redirect request.
errorHandled = true;
+ } else if (retryRequest && backOffPolicy != null
+ && backOffPolicy.isBackOffRequired(response.getStatusCode())) {
+ // The unsuccessful request's error could not be handled and should be backed off
+ // before retrying
+ long backOffTime = backOffPolicy.getNextBackOffMillis();
+ if (backOffTime != BackOffPolicy.STOP) {
+ try {
+ sleeper.sleep(backOffTime);
+ } catch (InterruptedException exception) {
+ // ignore
+ }
+ errorHandled = true;
+ }
}
}
// A retry is required if the error was successfully handled or if it is a redirect
diff --git a/google-http-client/src/main/java/com/google/api/client/util/ExponentialBackOff.java b/google-http-client/src/main/java/com/google/api/client/util/ExponentialBackOff.java
index f132c6a2e..c949b6f23 100644
--- a/google-http-client/src/main/java/com/google/api/client/util/ExponentialBackOff.java
+++ b/google-http-client/src/main/java/com/google/api/client/util/ExponentialBackOff.java
@@ -120,7 +120,7 @@ public class ExponentialBackOff implements BackOff {
private final int maxIntervalMillis;
/**
- * The system time in nanoseconds. It is calculated when an ExponentialBackOff instance is
+ * The system time in nanoseconds. It is calculated when an ExponentialBackOffPolicy instance is
* created and is reset when {@link #reset()} is called.
*/
long startTimeNanos;
@@ -135,7 +135,7 @@ public class ExponentialBackOff implements BackOff {
private final NanoClock nanoClock;
/**
- * Creates an instance of ExponentialBackOff using default values.
+ * Creates an instance of ExponentialBackOffPolicy using default values.
*
*
* To override the defaults use {@link Builder}.
diff --git a/google-http-client/src/test/java/com/google/api/client/http/ExponentialBackOffPolicyTest.java b/google-http-client/src/test/java/com/google/api/client/http/ExponentialBackOffPolicyTest.java
new file mode 100644
index 000000000..fc9dc9bd1
--- /dev/null
+++ b/google-http-client/src/test/java/com/google/api/client/http/ExponentialBackOffPolicyTest.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2011 Google Inc.
+ *
+ * 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;
+
+import com.google.api.client.util.NanoClock;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests {@link ExponentialBackOffPolicy}.
+ *
+ * @author Ravi Mistry
+ */
+@Deprecated
+public class ExponentialBackOffPolicyTest extends TestCase {
+
+ public ExponentialBackOffPolicyTest(String name) {
+ super(name);
+ }
+
+ public void testConstructor() {
+ ExponentialBackOffPolicy backOffPolicy = new ExponentialBackOffPolicy();
+ assertEquals(ExponentialBackOffPolicy.DEFAULT_INITIAL_INTERVAL_MILLIS,
+ backOffPolicy.getInitialIntervalMillis());
+ assertEquals(ExponentialBackOffPolicy.DEFAULT_INITIAL_INTERVAL_MILLIS,
+ backOffPolicy.getCurrentIntervalMillis());
+ assertEquals(ExponentialBackOffPolicy.DEFAULT_RANDOMIZATION_FACTOR,
+ backOffPolicy.getRandomizationFactor());
+ assertEquals(ExponentialBackOffPolicy.DEFAULT_MULTIPLIER, backOffPolicy.getMultiplier());
+ assertEquals(
+ ExponentialBackOffPolicy.DEFAULT_MAX_INTERVAL_MILLIS, backOffPolicy.getMaxIntervalMillis());
+ assertEquals(ExponentialBackOffPolicy.DEFAULT_MAX_ELAPSED_TIME_MILLIS,
+ backOffPolicy.getMaxElapsedTimeMillis());
+ }
+
+ public void testBuilder() {
+ ExponentialBackOffPolicy backOffPolicy = ExponentialBackOffPolicy.builder().build();
+ assertEquals(ExponentialBackOffPolicy.DEFAULT_INITIAL_INTERVAL_MILLIS,
+ backOffPolicy.getInitialIntervalMillis());
+ assertEquals(ExponentialBackOffPolicy.DEFAULT_INITIAL_INTERVAL_MILLIS,
+ backOffPolicy.getCurrentIntervalMillis());
+ assertEquals(ExponentialBackOffPolicy.DEFAULT_RANDOMIZATION_FACTOR,
+ backOffPolicy.getRandomizationFactor());
+ assertEquals(ExponentialBackOffPolicy.DEFAULT_MULTIPLIER, backOffPolicy.getMultiplier());
+ assertEquals(
+ ExponentialBackOffPolicy.DEFAULT_MAX_INTERVAL_MILLIS, backOffPolicy.getMaxIntervalMillis());
+ assertEquals(ExponentialBackOffPolicy.DEFAULT_MAX_ELAPSED_TIME_MILLIS,
+ backOffPolicy.getMaxElapsedTimeMillis());
+
+ int testInitialInterval = 1;
+ double testRandomizationFactor = 0.1;
+ double testMultiplier = 5.0;
+ int testMaxInterval = 10;
+ int testMaxElapsedTime = 900000;
+
+ backOffPolicy = ExponentialBackOffPolicy.builder()
+ .setInitialIntervalMillis(testInitialInterval)
+ .setRandomizationFactor(testRandomizationFactor)
+ .setMultiplier(testMultiplier)
+ .setMaxIntervalMillis(testMaxInterval)
+ .setMaxElapsedTimeMillis(testMaxElapsedTime)
+ .build();
+ assertEquals(testInitialInterval, backOffPolicy.getInitialIntervalMillis());
+ assertEquals(testInitialInterval, backOffPolicy.getCurrentIntervalMillis());
+ assertEquals(testRandomizationFactor, backOffPolicy.getRandomizationFactor());
+ assertEquals(testMultiplier, backOffPolicy.getMultiplier());
+ assertEquals(testMaxInterval, backOffPolicy.getMaxIntervalMillis());
+ assertEquals(testMaxElapsedTime, backOffPolicy.getMaxElapsedTimeMillis());
+ }
+
+ public void testBackOff() throws Exception {
+ int testInitialInterval = 500;
+ double testRandomizationFactor = 0.1;
+ double testMultiplier = 2.0;
+ int testMaxInterval = 5000;
+ int testMaxElapsedTime = 900000;
+
+ ExponentialBackOffPolicy backOffPolicy = ExponentialBackOffPolicy.builder()
+ .setInitialIntervalMillis(testInitialInterval)
+ .setRandomizationFactor(testRandomizationFactor)
+ .setMultiplier(testMultiplier)
+ .setMaxIntervalMillis(testMaxInterval)
+ .setMaxElapsedTimeMillis(testMaxElapsedTime)
+ .build();
+ int[] expectedResults = {500, 1000, 2000, 4000, 5000, 5000, 5000, 5000, 5000, 5000};
+ for (int expected : expectedResults) {
+ assertEquals(expected, backOffPolicy.getCurrentIntervalMillis());
+ // Assert that the next back off falls in the expected range.
+ int minInterval = (int) (expected - (testRandomizationFactor * expected));
+ int maxInterval = (int) (expected + (testRandomizationFactor * expected));
+ long actualInterval = backOffPolicy.getNextBackOffMillis();
+ assertTrue(minInterval <= actualInterval && actualInterval <= maxInterval);
+ }
+ }
+
+ static class MyNanoClock implements NanoClock {
+
+ private int i = 0;
+ private long startSeconds;
+
+ MyNanoClock() {
+ }
+
+ MyNanoClock(long startSeconds) {
+ this.startSeconds = startSeconds;
+ }
+
+ public long nanoTime() {
+ return (startSeconds + i++) * 1000000000;
+ }
+ }
+
+ public void testGetElapsedTimeMillis() {
+ ExponentialBackOffPolicy backOffPolicy =
+ new ExponentialBackOffPolicy.Builder().setNanoClock(new MyNanoClock()).build();
+ long elapsedTimeMillis = backOffPolicy.getElapsedTimeMillis();
+ assertEquals("elapsedTimeMillis=" + elapsedTimeMillis, 1000, elapsedTimeMillis);
+ }
+
+ public void testBackOffOverflow() throws Exception {
+ int testInitialInterval = Integer.MAX_VALUE / 2;
+ double testMultiplier = 2.1;
+ int testMaxInterval = Integer.MAX_VALUE;
+ ExponentialBackOffPolicy backOffPolicy = ExponentialBackOffPolicy.builder()
+ .setInitialIntervalMillis(testInitialInterval)
+ .setMultiplier(testMultiplier)
+ .setMaxIntervalMillis(testMaxInterval)
+ .build();
+ backOffPolicy.getNextBackOffMillis();
+ // Assert that when an overflow is possible the current interval is set to the max interval.
+ assertEquals(testMaxInterval, backOffPolicy.getCurrentIntervalMillis());
+ }
+}
diff --git a/google-http-client/src/test/java/com/google/api/client/http/HttpRequestTest.java b/google-http-client/src/test/java/com/google/api/client/http/HttpRequestTest.java
index ae2303dbf..fc0e016ba 100644
--- a/google-http-client/src/test/java/com/google/api/client/http/HttpRequestTest.java
+++ b/google-http-client/src/test/java/com/google/api/client/http/HttpRequestTest.java
@@ -100,7 +100,6 @@ public void testNotSupportedByDefault() throws Exception {
static class MockExecutor implements Executor {
private Runnable runnable;
-
public void actuallyRun() {
runnable.run();
}
@@ -110,6 +109,39 @@ public void execute(Runnable command) {
}
}
+ @Deprecated
+ static private class MockBackOffPolicy implements BackOffPolicy {
+
+ int backOffCalls;
+ int resetCalls;
+ boolean returnBackOffStop;
+
+ MockBackOffPolicy() {
+ }
+
+ public boolean isBackOffRequired(int statusCode) {
+ switch (statusCode) {
+ case HttpStatusCodes.STATUS_CODE_SERVER_ERROR: // 500
+ case HttpStatusCodes.STATUS_CODE_SERVICE_UNAVAILABLE: // 503
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ public void reset() {
+ resetCalls++;
+ }
+
+ public long getNextBackOffMillis() {
+ backOffCalls++;
+ if (returnBackOffStop) {
+ return BackOffPolicy.STOP;
+ }
+ return 0;
+ }
+ }
+
/**
* Transport used for testing the redirection logic in HttpRequest.
*/
@@ -178,6 +210,29 @@ public void test301Redirect() throws Exception {
Assert.assertEquals(2, fakeTransport.lowLevelExecCalls);
}
+ @Deprecated
+ public void test301RedirectWithUnsuccessfulResponseHandled() throws Exception {
+ MockHttpUnsuccessfulResponseHandler handler = new MockHttpUnsuccessfulResponseHandler(true);
+ MockBackOffPolicy backOffPolicy = new MockBackOffPolicy();
+ // Set up RedirectTransport to redirect on the first request and then return success.
+ RedirectTransport fakeTransport = new RedirectTransport();
+ HttpRequest request =
+ fakeTransport.createRequestFactory().buildGetRequest(new GenericUrl("http://gmail.com"));
+ request.setUnsuccessfulResponseHandler(handler);
+ request.setBackOffPolicy(backOffPolicy);
+ HttpResponse resp = request.execute();
+
+ Assert.assertEquals(200, resp.getStatusCode());
+ Assert.assertEquals(2, fakeTransport.lowLevelExecCalls);
+ // Assert that the redirect logic was not invoked because the response handler could handle the
+ // request. The request url should be the original http://gmail.com
+ Assert.assertEquals("http://gmail.com", request.getUrl().toString());
+ // Assert that the backoff policy was not invoked because the response handler could handle the
+ // request.
+ Assert.assertEquals(1, backOffPolicy.resetCalls);
+ Assert.assertEquals(0, backOffPolicy.backOffCalls);
+ Assert.assertTrue(handler.isCalled());
+ }
public void test301RedirectWithBackOffUnsuccessfulResponseHandled() throws Exception {
MockHttpUnsuccessfulResponseHandler handler = new MockHttpUnsuccessfulResponseHandler(true);
@@ -201,6 +256,30 @@ public void test301RedirectWithBackOffUnsuccessfulResponseHandled() throws Excep
Assert.assertTrue(handler.isCalled());
}
+ @Deprecated
+ public void test301RedirectWithUnsuccessfulResponseNotHandled() throws Exception {
+ // Create an Unsuccessful response handler that always returns false.
+ MockHttpUnsuccessfulResponseHandler handler = new MockHttpUnsuccessfulResponseHandler(false);
+ MockBackOffPolicy backOffPolicy = new MockBackOffPolicy();
+ // Set up RedirectTransport to redirect on the first request and then return success.
+ RedirectTransport fakeTransport = new RedirectTransport();
+ HttpRequest request =
+ fakeTransport.createRequestFactory().buildGetRequest(new GenericUrl("http://gmail.com"));
+ request.setUnsuccessfulResponseHandler(handler);
+ request.setBackOffPolicy(backOffPolicy);
+ HttpResponse resp = request.execute();
+
+ Assert.assertEquals(200, resp.getStatusCode());
+ // Assert that the redirect logic was invoked because the response handler could not handle the
+ // request. The request url should have changed from http://gmail.com to http://google.com
+ Assert.assertEquals(HttpTesting.SIMPLE_URL, request.getUrl().toString());
+ Assert.assertEquals(2, fakeTransport.lowLevelExecCalls);
+ // Assert that the backoff policy is never invoked (except to reset) because the response
+ // handler returned false.
+ Assert.assertEquals(1, backOffPolicy.resetCalls);
+ Assert.assertEquals(0, backOffPolicy.backOffCalls);
+ }
+
public void test301RedirectWithBackOffUnsuccessfulResponseNotHandled() throws Exception {
// Create an Unsuccessful response handler that always returns false.
MockHttpUnsuccessfulResponseHandler handler = new MockHttpUnsuccessfulResponseHandler(false);
@@ -568,6 +647,26 @@ public void testAbnormalResponseHandlerWithNoBackOff() throws Exception {
Assert.assertTrue(handler.isCalled());
}
+ @Deprecated
+ public void testAbnormalResponseHandlerWithBackOff() throws Exception {
+ FailThenSuccessBackoffTransport fakeTransport =
+ new FailThenSuccessBackoffTransport(HttpStatusCodes.STATUS_CODE_SERVER_ERROR, 1);
+ MockHttpUnsuccessfulResponseHandler handler = new MockHttpUnsuccessfulResponseHandler(true);
+ MockBackOffPolicy backOffPolicy = new MockBackOffPolicy();
+
+ HttpRequest req =
+ fakeTransport.createRequestFactory().buildGetRequest(new GenericUrl("http://not/used"));
+ req.setUnsuccessfulResponseHandler(handler);
+ req.setBackOffPolicy(backOffPolicy);
+ HttpResponse resp = req.execute();
+
+ Assert.assertEquals(200, resp.getStatusCode());
+ Assert.assertEquals(2, fakeTransport.lowLevelExecCalls);
+ Assert.assertEquals(1, backOffPolicy.resetCalls);
+ Assert.assertEquals(0, backOffPolicy.backOffCalls);
+ Assert.assertTrue(handler.isCalled());
+ }
+
public void testAbnormalResponseHandlerWithBackOffUnsuccessfulResponseHandler() throws Exception {
FailThenSuccessBackoffTransport fakeTransport =
new FailThenSuccessBackoffTransport(HttpStatusCodes.STATUS_CODE_SERVER_ERROR, 1);
@@ -585,6 +684,26 @@ public void testAbnormalResponseHandlerWithBackOffUnsuccessfulResponseHandler()
Assert.assertTrue(handler.isCalled());
}
+ @Deprecated
+ public void testBackOffSingleCall() throws Exception {
+ FailThenSuccessBackoffTransport fakeTransport =
+ new FailThenSuccessBackoffTransport(HttpStatusCodes.STATUS_CODE_SERVER_ERROR, 1);
+ MockHttpUnsuccessfulResponseHandler handler = new MockHttpUnsuccessfulResponseHandler(false);
+ MockBackOffPolicy backOffPolicy = new MockBackOffPolicy();
+
+ HttpRequest req =
+ fakeTransport.createRequestFactory().buildGetRequest(new GenericUrl("http://not/used"));
+ req.setUnsuccessfulResponseHandler(handler);
+ req.setBackOffPolicy(backOffPolicy);
+ HttpResponse resp = req.execute();
+
+ Assert.assertEquals(200, resp.getStatusCode());
+ Assert.assertEquals(2, fakeTransport.lowLevelExecCalls);
+ Assert.assertEquals(1, backOffPolicy.resetCalls);
+ Assert.assertEquals(1, backOffPolicy.backOffCalls);
+ Assert.assertTrue(handler.isCalled());
+ }
+
public void testBackOffUnsuccessfulResponseSingleCall() throws Exception {
FailThenSuccessBackoffTransport fakeTransport =
new FailThenSuccessBackoffTransport(HttpStatusCodes.STATUS_CODE_SERVER_ERROR, 1);
@@ -602,6 +721,27 @@ public void testBackOffUnsuccessfulResponseSingleCall() throws Exception {
Assert.assertTrue(handler.isCalled());
}
+ @Deprecated
+ public void testBackOffMultipleCalls() throws Exception {
+ int callsBeforeSuccess = 5;
+ FailThenSuccessBackoffTransport fakeTransport = new FailThenSuccessBackoffTransport(
+ HttpStatusCodes.STATUS_CODE_SERVER_ERROR, callsBeforeSuccess);
+ MockHttpUnsuccessfulResponseHandler handler = new MockHttpUnsuccessfulResponseHandler(false);
+ MockBackOffPolicy backOffPolicy = new MockBackOffPolicy();
+
+ HttpRequest req =
+ fakeTransport.createRequestFactory().buildGetRequest(new GenericUrl("http://not/used"));
+ req.setUnsuccessfulResponseHandler(handler);
+ req.setBackOffPolicy(backOffPolicy);
+ HttpResponse resp = req.execute();
+
+ Assert.assertEquals(200, resp.getStatusCode());
+ Assert.assertEquals(callsBeforeSuccess + 1, fakeTransport.lowLevelExecCalls);
+ Assert.assertEquals(1, backOffPolicy.resetCalls);
+ Assert.assertEquals(callsBeforeSuccess, backOffPolicy.backOffCalls);
+ Assert.assertTrue(handler.isCalled());
+ }
+
public void testBackOffUnsucessfulReponseMultipleCalls() throws Exception {
int callsBeforeSuccess = 5;
FailThenSuccessBackoffTransport fakeTransport = new FailThenSuccessBackoffTransport(
@@ -620,6 +760,30 @@ public void testBackOffUnsucessfulReponseMultipleCalls() throws Exception {
Assert.assertTrue(handler.isCalled());
}
+ @Deprecated
+ public void testBackOffCallsBeyondRetryLimit() throws Exception {
+ int callsBeforeSuccess = 11;
+ FailThenSuccessBackoffTransport fakeTransport = new FailThenSuccessBackoffTransport(
+ HttpStatusCodes.STATUS_CODE_SERVER_ERROR, callsBeforeSuccess);
+ MockHttpUnsuccessfulResponseHandler handler = new MockHttpUnsuccessfulResponseHandler(false);
+ MockBackOffPolicy backOffPolicy = new MockBackOffPolicy();
+
+ HttpRequest req =
+ fakeTransport.createRequestFactory().buildGetRequest(new GenericUrl("http://not/used"));
+ req.setNumberOfRetries(callsBeforeSuccess - 1);
+ req.setUnsuccessfulResponseHandler(handler);
+ req.setBackOffPolicy(backOffPolicy);
+ try {
+ req.execute();
+ fail("expected HttpResponseException");
+ } catch (HttpResponseException e) {
+ }
+ Assert.assertEquals(callsBeforeSuccess, fakeTransport.lowLevelExecCalls);
+ Assert.assertEquals(1, backOffPolicy.resetCalls);
+ Assert.assertEquals(callsBeforeSuccess - 1, backOffPolicy.backOffCalls);
+ Assert.assertTrue(handler.isCalled());
+ }
+
public void testBackOffUnsuccessfulReponseCallsBeyondRetryLimit() throws Exception {
int callsBeforeSuccess = 11;
FailThenSuccessBackoffTransport fakeTransport = new FailThenSuccessBackoffTransport(
@@ -641,6 +805,29 @@ public void testBackOffUnsuccessfulReponseCallsBeyondRetryLimit() throws Excepti
Assert.assertTrue(handler.isCalled());
}
+ @Deprecated
+ public void testBackOffUnRecognizedStatusCode() throws Exception {
+ FailThenSuccessBackoffTransport fakeTransport =
+ new FailThenSuccessBackoffTransport(HttpStatusCodes.STATUS_CODE_UNAUTHORIZED, 1);
+ MockHttpUnsuccessfulResponseHandler handler = new MockHttpUnsuccessfulResponseHandler(false);
+ MockBackOffPolicy backOffPolicy = new MockBackOffPolicy();
+
+ HttpRequest req =
+ fakeTransport.createRequestFactory().buildGetRequest(new GenericUrl("http://not/used"));
+ req.setUnsuccessfulResponseHandler(handler);
+ req.setBackOffPolicy(backOffPolicy);
+ try {
+ req.execute();
+ } catch (HttpResponseException e) {
+ }
+
+ Assert.assertEquals(1, fakeTransport.lowLevelExecCalls);
+ Assert.assertEquals(1, backOffPolicy.resetCalls);
+ // The BackOffPolicy should not be called since it does not support 401 status codes.
+ Assert.assertEquals(0, backOffPolicy.backOffCalls);
+ Assert.assertTrue(handler.isCalled());
+ }
+
public void testBackOffUnsuccessfulReponseUnRecognizedStatusCode() throws Exception {
FailThenSuccessBackoffTransport fakeTransport =
new FailThenSuccessBackoffTransport(HttpStatusCodes.STATUS_CODE_UNAUTHORIZED, 1);
@@ -661,6 +848,32 @@ public void testBackOffUnsuccessfulReponseUnRecognizedStatusCode() throws Except
Assert.assertTrue(handler.isCalled());
}
+ @Deprecated
+ public void testBackOffStop() throws Exception {
+ int callsBeforeSuccess = 5;
+ FailThenSuccessBackoffTransport fakeTransport = new FailThenSuccessBackoffTransport(
+ HttpStatusCodes.STATUS_CODE_SERVER_ERROR, callsBeforeSuccess);
+ MockHttpUnsuccessfulResponseHandler handler = new MockHttpUnsuccessfulResponseHandler(false);
+ MockBackOffPolicy backOffPolicy = new MockBackOffPolicy();
+ backOffPolicy.returnBackOffStop = true;
+
+ HttpRequest req =
+ fakeTransport.createRequestFactory().buildGetRequest(new GenericUrl("http://not/used"));
+ req.setUnsuccessfulResponseHandler(handler);
+ req.setBackOffPolicy(backOffPolicy);
+ try {
+ req.execute();
+ } catch (HttpResponseException e) {
+ }
+
+ Assert.assertEquals(1, fakeTransport.lowLevelExecCalls);
+ Assert.assertEquals(1, backOffPolicy.resetCalls);
+ // The BackOffPolicy should be called only once and then it should return BackOffPolicy.STOP
+ // should stop all back off retries.
+ Assert.assertEquals(1, backOffPolicy.backOffCalls);
+ Assert.assertTrue(handler.isCalled());
+ }
+
public void testBackOffUnsucessfulResponseStop() throws Exception {
int callsBeforeSuccess = 5;
FailThenSuccessBackoffTransport fakeTransport = new FailThenSuccessBackoffTransport(
From 80b1a9c12056f1e4f4d9294f15d2c970f774a903 Mon Sep 17 00:00:00 2001
From: Gerald Madlmayr
Date: Wed, 7 Nov 2018 22:36:23 +0100
Subject: [PATCH 009/983] Fix parameter of maven-javadoc-plugin (#522) (#523)
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index ea6bdf3d1..e464c080b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -384,7 +384,7 @@
maven-javadoc-plugin
- -Xdoclint:none
+ -Xdoclint:none
From d7f18a377b1ab257820898709693a11ab6a4714d Mon Sep 17 00:00:00 2001
From: Gerald Madlmayr
Date: Fri, 9 Nov 2018 00:18:07 +0100
Subject: [PATCH 010/983] Skip Lint of JavaDoc (#525)
* Use doclint to skip checks of javadoc (#524)
* Remove comment out command (#522)
---
.kokoro/build.sh | 2 +-
pom.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.kokoro/build.sh b/.kokoro/build.sh
index ac85fb805..b883e2c51 100755
--- a/.kokoro/build.sh
+++ b/.kokoro/build.sh
@@ -23,5 +23,5 @@ echo $JOB_TYPE
export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m"
-mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
+mvn install -DskipTests=true -B -V
mvn test -B
diff --git a/pom.xml b/pom.xml
index e464c080b..6ced6b2ee 100644
--- a/pom.xml
+++ b/pom.xml
@@ -384,7 +384,7 @@
maven-javadoc-plugin
- -Xdoclint:none
+ none
From 7b95ce830d9fcce5e165db63ed245f6ed08ce4d4 Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Fri, 9 Nov 2018 09:24:21 -0800
Subject: [PATCH 011/983] Add write timeout for post/put requests (#485)
* Introduce API to set writeTimeout and use it in the NetHttp request
* Surface the writeTimeout to HttpRequest
* remove debug statements
* Fix warnings
* Fix syntax
* DI for testing
* Make field constant field final
---
.../google/api/client/http/HttpRequest.java | 30 +++++++
.../api/client/http/LowLevelHttpRequest.java | 15 ++++
.../client/http/javanet/NetHttpRequest.java | 76 ++++++++++++++++-
.../http/javanet/NetHttpRequestTest.java | 85 +++++++++++++++++++
.../src/test/resources/file.txt | 1 +
5 files changed, 205 insertions(+), 2 deletions(-)
create mode 100644 google-http-client/src/test/java/com/google/api/client/http/javanet/NetHttpRequestTest.java
create mode 100644 google-http-client/src/test/resources/file.txt
diff --git a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
index d75b7fa2f..dcabb9044 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
@@ -158,6 +158,11 @@ static String executeAndGetValueOfSomeCustomHeader(HttpRequest request) {
*/
private int readTimeout = 20 * 1000;
+ /**
+ * Timeout in milliseconds to set POST/PUT data or {@code 0} for an infinite timeout.
+ */
+ private int writeTimeout = 0;
+
/** HTTP unsuccessful (non-2XX) response handler or {@code null} for none. */
private HttpUnsuccessfulResponseHandler unsuccessfulResponseHandler;
@@ -493,6 +498,30 @@ public HttpRequest setReadTimeout(int readTimeout) {
return this;
}
+ /**
+ * Returns the timeout in milliseconds to send POST/PUT data or {@code 0} for an infinite timeout.
+ *
+ *
+ * By default it is 0 (infinite).
+ *
+ *
+ * @since 1.26
+ */
+ public int getWriteTimeout() {
+ return writeTimeout;
+ }
+
+ /**
+ * Sets the timeout in milliseconds to send POST/PUT data or {@code 0} for an infinite timeout.
+ *
+ * @since 1.26
+ */
+ public HttpRequest setWriteTimeout(int writeTimeout) {
+ Preconditions.checkArgument(writeTimeout >= 0);
+ this.writeTimeout = writeTimeout;
+ return this;
+ }
+
/**
* Returns the HTTP request headers.
*
@@ -977,6 +1006,7 @@ public HttpResponse execute() throws IOException {
// execute
lowLevelHttpRequest.setTimeout(connectTimeout, readTimeout);
+ lowLevelHttpRequest.setWriteTimeout(writeTimeout);
try {
LowLevelHttpResponse lowLevelHttpResponse = lowLevelHttpRequest.execute();
// Flag used to indicate if an exception is thrown before the response is constructed.
diff --git a/google-http-client/src/main/java/com/google/api/client/http/LowLevelHttpRequest.java b/google-http-client/src/main/java/com/google/api/client/http/LowLevelHttpRequest.java
index a3f489efc..d3900f91c 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/LowLevelHttpRequest.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/LowLevelHttpRequest.java
@@ -159,6 +159,21 @@ public final StreamingContent getStreamingContent() {
public void setTimeout(int connectTimeout, int readTimeout) throws IOException {
}
+ /**
+ * Sets the write timeout for POST/PUT requests.
+ *
+ *
+ * Default implementation does nothing, but subclasses should normally override.
+ *
+ *
+ * @param writeTimeout timeout in milliseconds to establish a connection or {@code 0} for an
+ * infinite timeout
+ * @throws IOException I/O exception
+ * @since 1.26
+ */
+ public void setWriteTimeout(int writeTimeout) throws IOException {
+ }
+
/** Executes the request and returns a low-level HTTP response object. */
public abstract LowLevelHttpResponse execute() throws IOException;
}
diff --git a/google-http-client/src/main/java/com/google/api/client/http/javanet/NetHttpRequest.java b/google-http-client/src/main/java/com/google/api/client/http/javanet/NetHttpRequest.java
index d0d8d0cb1..cd92cac11 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/javanet/NetHttpRequest.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/javanet/NetHttpRequest.java
@@ -18,9 +18,19 @@
import com.google.api.client.http.LowLevelHttpResponse;
import com.google.api.client.util.Preconditions;
+import com.google.api.client.util.StreamingContent;
+import com.google.common.annotations.VisibleForTesting;
import java.io.IOException;
import java.io.OutputStream;
import java.net.HttpURLConnection;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
/**
* @author Yaniv Inbar
@@ -28,12 +38,14 @@
final class NetHttpRequest extends LowLevelHttpRequest {
private final HttpURLConnection connection;
+ private int writeTimeout;
/**
* @param connection HTTP URL connection
*/
NetHttpRequest(HttpURLConnection connection) {
this.connection = connection;
+ this.writeTimeout = 0;
connection.setInstanceFollowRedirects(false);
}
@@ -48,8 +60,32 @@ public void setTimeout(int connectTimeout, int readTimeout) {
connection.setConnectTimeout(connectTimeout);
}
+ @Override
+ public void setWriteTimeout(int writeTimeout) throws IOException {
+ this.writeTimeout = writeTimeout;
+ }
+
+ interface OutputWriter {
+ void write(OutputStream outputStream, StreamingContent content) throws IOException;
+ }
+
+ static class DefaultOutputWriter implements OutputWriter {
+ @Override
+ public void write(OutputStream outputStream, final StreamingContent content)
+ throws IOException {
+ content.writeTo(outputStream);
+ }
+ }
+
+ private static final OutputWriter DEFAULT_CONNECTION_WRITER = new DefaultOutputWriter();
+
@Override
public LowLevelHttpResponse execute() throws IOException {
+ return execute(DEFAULT_CONNECTION_WRITER);
+ }
+
+ @VisibleForTesting
+ LowLevelHttpResponse execute(final OutputWriter outputWriter) throws IOException {
HttpURLConnection connection = this.connection;
// write content
if (getStreamingContent() != null) {
@@ -74,10 +110,12 @@ public LowLevelHttpResponse execute() throws IOException {
} else {
connection.setChunkedStreamingMode(0);
}
- OutputStream out = connection.getOutputStream();
+ final OutputStream out = connection.getOutputStream();
+
boolean threw = true;
try {
- getStreamingContent().writeTo(out);
+ writeContentToOutputStream(outputWriter, out);
+
threw = false;
} finally {
try {
@@ -111,4 +149,38 @@ public LowLevelHttpResponse execute() throws IOException {
}
}
}
+
+ private void writeContentToOutputStream(final OutputWriter outputWriter, final OutputStream out)
+ throws IOException {
+ if (writeTimeout == 0) {
+ outputWriter.write(out, getStreamingContent());
+ } else {
+ // do it with timeout
+ final StreamingContent content = getStreamingContent();
+ final Callable writeContent = new Callable() {
+ @Override
+ public Boolean call() throws IOException {
+ outputWriter.write(out, content);
+ return Boolean.TRUE;
+ }
+ };
+
+ final ExecutorService executor = Executors.newSingleThreadExecutor();
+ final Future future = executor.submit(new FutureTask(writeContent), null);
+ executor.shutdown();
+
+ try {
+ future.get(writeTimeout, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException e) {
+ throw new IOException("Socket write interrupted", e);
+ } catch (ExecutionException e) {
+ throw new IOException("Exception in socket write", e);
+ } catch (TimeoutException e) {
+ throw new IOException("Socket write timed out", e);
+ }
+ if (!executor.isTerminated()) {
+ executor.shutdown();
+ }
+ }
+ }
}
diff --git a/google-http-client/src/test/java/com/google/api/client/http/javanet/NetHttpRequestTest.java b/google-http-client/src/test/java/com/google/api/client/http/javanet/NetHttpRequestTest.java
new file mode 100644
index 000000000..6839dfd76
--- /dev/null
+++ b/google-http-client/src/test/java/com/google/api/client/http/javanet/NetHttpRequestTest.java
@@ -0,0 +1,85 @@
+package com.google.api.client.http.javanet;
+
+import com.google.api.client.http.HttpContent;
+import com.google.api.client.http.InputStreamContent;
+import com.google.api.client.http.javanet.NetHttpRequest.OutputWriter;
+import com.google.api.client.testing.http.HttpTesting;
+import com.google.api.client.testing.http.javanet.MockHttpURLConnection;
+import com.google.api.client.util.StreamingContent;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.concurrent.TimeoutException;
+import org.junit.Test;
+
+public class NetHttpRequestTest {
+
+ static class SleepingOutputWriter implements OutputWriter {
+ private long sleepTimeInMs;
+ public SleepingOutputWriter(long sleepTimeInMs) {
+ this.sleepTimeInMs = sleepTimeInMs;
+ }
+ @Override
+ public void write(OutputStream outputStream, StreamingContent content) throws IOException {
+ try {
+ Thread.sleep(sleepTimeInMs);
+ } catch (InterruptedException e) {
+ throw new IOException("sleep interrupted", e);
+ }
+ }
+ }
+
+ @Test
+ public void testHangingWrite() throws InterruptedException {
+ Thread thread = new Thread() {
+ @Override
+ public void run() {
+ try {
+ postWithTimeout(0);
+ } catch (IOException e) {
+ // expected to be interrupted
+ assertEquals(e.getCause().getClass(), InterruptedException.class);
+ return;
+ } catch (Exception e) {
+ fail();
+ }
+ fail("should be interrupted before here");
+ }
+ };
+
+ thread.start();
+ Thread.sleep(1000);
+ assertTrue(thread.isAlive());
+ thread.interrupt();
+ }
+
+ @Test(timeout = 1000)
+ public void testOutputStreamWriteTimeout() throws Exception {
+ try {
+ postWithTimeout(100);
+ fail("should have timed out");
+ } catch (IOException e) {
+ assertEquals(e.getCause().getClass(), TimeoutException.class);
+ } catch (Exception e) {
+ fail("Expected an IOException not a " + e.getCause().getClass().getName());
+ }
+ }
+
+ private static void postWithTimeout(int timeout) throws Exception {
+ MockHttpURLConnection connection = new MockHttpURLConnection(new URL(HttpTesting.SIMPLE_URL));
+ connection.setRequestMethod("POST");
+ NetHttpRequest request = new NetHttpRequest(connection);
+ InputStream is = NetHttpRequestTest.class.getClassLoader().getResourceAsStream("file.txt");
+ HttpContent content = new InputStreamContent("text/plain", is);
+ request.setStreamingContent(content);
+ request.setWriteTimeout(timeout);
+ request.execute(new SleepingOutputWriter(5000L));
+ }
+
+}
diff --git a/google-http-client/src/test/resources/file.txt b/google-http-client/src/test/resources/file.txt
new file mode 100644
index 000000000..1065c29e7
--- /dev/null
+++ b/google-http-client/src/test/resources/file.txt
@@ -0,0 +1 @@
+some sample file
From 67d8c5d6347944cb41f52e92389accb150b1eb3d Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Mon, 12 Nov 2018 08:46:33 -0800
Subject: [PATCH 012/983] Release google-http-java-client v1.27.0 (#527)
* Release v1.27.0
* Fix `@since` javadoc for new write timeout features
* Fix VERSION constant
* Fix version annotations in google-http-client-android-test artifact
* Fix line length
* Cleanup output and fix plugin versions
* Change order of deployed assets
* Add nexus-staging-maven-plugin and release profile to bom
* Put the pom last again
* bom needs a developers section
---
.kokoro/release/stage.sh | 2 +-
google-http-client-android-test/pom.xml | 6 +-
google-http-client-android/pom.xml | 4 +-
google-http-client-appengine/pom.xml | 4 +-
google-http-client-assembly/pom.xml | 4 +-
google-http-client-bom/README.md | 2 +-
google-http-client-bom/pom.xml | 89 ++++++++++++++++---
google-http-client-findbugs/pom.xml | 4 +-
google-http-client-gson/pom.xml | 4 +-
google-http-client-jackson/pom.xml | 4 +-
google-http-client-jackson2/pom.xml | 4 +-
google-http-client-jdo/pom.xml | 4 +-
google-http-client-protobuf/pom.xml | 4 +-
google-http-client-test/pom.xml | 4 +-
google-http-client-xml/pom.xml | 4 +-
google-http-client/pom.xml | 4 +-
.../google/api/client/http/HttpRequest.java | 6 +-
.../api/client/http/LowLevelHttpRequest.java | 2 +-
pom.xml | 6 +-
.../dailymotion-simple-cmdline-sample/pom.xml | 2 +-
.../googleplus-simple-cmdline-sample/pom.xml | 2 +-
versions.txt | 30 +++----
22 files changed, 131 insertions(+), 64 deletions(-)
diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh
index 02809c918..3b6794c27 100755
--- a/.kokoro/release/stage.sh
+++ b/.kokoro/release/stage.sh
@@ -22,7 +22,7 @@ pushd $(dirname "$0")/../../
setup_environment_secrets
create_settings_xml_file "settings.xml"
-mvn clean install deploy \
+mvn clean install deploy -B \
--settings settings.xml \
-DperformRelease=true \
-Dgpg.executable=gpg \
diff --git a/google-http-client-android-test/pom.xml b/google-http-client-android-test/pom.xml
index d129d05e7..5d6953615 100644
--- a/google-http-client-android-test/pom.xml
+++ b/google-http-client-android-test/pom.xml
@@ -4,7 +4,7 @@
google-http-clientgoogle-http-client-android-testTest project for google-http-client-android.
- 1.26.1-SNAPSHOT
+ 1.27.0apk
@@ -53,7 +53,7 @@
com.google.http-clientgoogle-http-client-android
- 1.26.0-1.26.0
+ 1.27.0android
@@ -72,7 +72,7 @@
com.google.http-clientgoogle-http-client-test
- 1.26.0
+ 1.27.0junit
diff --git a/google-http-client-android/pom.xml b/google-http-client-android/pom.xml
index 99968587f..e52bd4921 100644
--- a/google-http-client-android/pom.xml
+++ b/google-http-client-android/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.26.1-SNAPSHOT
+ 1.27.0../pom.xmlgoogle-http-client-android
- 1.26.1-SNAPSHOT
+ 1.27.0Android Platform Extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-appengine/pom.xml b/google-http-client-appengine/pom.xml
index 27013590a..3fc0641de 100644
--- a/google-http-client-appengine/pom.xml
+++ b/google-http-client-appengine/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.26.1-SNAPSHOT
+ 1.27.0../pom.xmlgoogle-http-client-appengine
- 1.26.1-SNAPSHOT
+ 1.27.0Google App Engine extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-assembly/pom.xml b/google-http-client-assembly/pom.xml
index e89325431..6eb170031 100644
--- a/google-http-client-assembly/pom.xml
+++ b/google-http-client-assembly/pom.xml
@@ -4,12 +4,12 @@
com.google.http-clientgoogle-http-client-parent
- 1.26.1-SNAPSHOT
+ 1.27.0../pom.xmlcom.google.http-clientgoogle-http-client-assembly
- 1.26.1-SNAPSHOT
+ 1.27.0pomAssembly for the Google HTTP Client Library for Java
diff --git a/google-http-client-bom/README.md b/google-http-client-bom/README.md
index 568a067db..4932f09d8 100644
--- a/google-http-client-bom/README.md
+++ b/google-http-client-bom/README.md
@@ -12,7 +12,7 @@ To use it in Maven, add the following to your `pom.xml`:
com.google.http-clientgoogle-http-client-bom
- 1.26.0
+ 1.27.0pomimport
diff --git a/google-http-client-bom/pom.xml b/google-http-client-bom/pom.xml
index a71e63ae9..05078d44f 100644
--- a/google-http-client-bom/pom.xml
+++ b/google-http-client-bom/pom.xml
@@ -3,7 +3,7 @@
4.0.0com.google.http-clientgoogle-http-client-bom
- 1.26.1-SNAPSHOT
+ 1.27.0pomGoogle HTTP Client Library for Java BOM
@@ -16,6 +16,18 @@
Google LLC
+
+
+ chingor13
+ Jeff Ching
+ chingor@google.com
+ Google LLC
+
+ Developer
+
+
+
+
scm:git:https://github.com/googleapis/google-http-java-client.gitscm:git:git@github.com:googleapis/google-http-java-client.git
@@ -51,63 +63,114 @@
com.google.http-clientgoogle-http-client
- 1.26.1-SNAPSHOT
+ 1.27.0com.google.http-clientgoogle-http-client-android
- 1.26.1-SNAPSHOT
+ 1.27.0com.google.http-clientgoogle-http-client-appengine
- 1.26.1-SNAPSHOT
+ 1.27.0com.google.http-clientgoogle-http-client-assembly
- 1.26.1-SNAPSHOT
+ 1.27.0com.google.http-clientgoogle-http-client-findbugs
- 1.26.1-SNAPSHOT
+ 1.27.0com.google.http-clientgoogle-http-client-gson
- 1.26.1-SNAPSHOT
+ 1.27.0com.google.http-clientgoogle-http-client-jackson
- 1.26.1-SNAPSHOT
+ 1.27.0com.google.http-clientgoogle-http-client-jackson2
- 1.26.1-SNAPSHOT
+ 1.27.0com.google.http-clientgoogle-http-client-jdo
- 1.26.1-SNAPSHOT
+ 1.27.0com.google.http-clientgoogle-http-client-protobuf
- 1.26.1-SNAPSHOT
+ 1.27.0com.google.http-clientgoogle-http-client-test
- 1.26.1-SNAPSHOT
+ 1.27.0com.google.http-clientgoogle-http-client-xml
- 1.26.1-SNAPSHOT
+ 1.27.0
+
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+ 1.6.6
+ true
+
+ sonatype-nexus-staging
+ https://oss.sonatype.org/
+ false
+
+
+
+
+
+
+
+ release-sign-artifacts
+
+
+ performRelease
+ true
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ 1.6
+
+
+ sign-artifacts
+ verify
+
+ sign
+
+
+
+ --pinentry-mode
+ loopback
+
+
+
+
+
+
+
+
+
diff --git a/google-http-client-findbugs/pom.xml b/google-http-client-findbugs/pom.xml
index 719b36eeb..243a44d42 100644
--- a/google-http-client-findbugs/pom.xml
+++ b/google-http-client-findbugs/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.26.1-SNAPSHOT
+ 1.27.0../pom.xmlgoogle-http-client-findbugs
- 1.26.1-SNAPSHOT
+ 1.27.0Google APIs Client Library Findbugs custom plugin.
diff --git a/google-http-client-gson/pom.xml b/google-http-client-gson/pom.xml
index 443c23aef..40768d189 100644
--- a/google-http-client-gson/pom.xml
+++ b/google-http-client-gson/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.26.1-SNAPSHOT
+ 1.27.0../pom.xmlgoogle-http-client-gson
- 1.26.1-SNAPSHOT
+ 1.27.0GSON extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-jackson/pom.xml b/google-http-client-jackson/pom.xml
index 712e5366e..177693c69 100644
--- a/google-http-client-jackson/pom.xml
+++ b/google-http-client-jackson/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.26.1-SNAPSHOT
+ 1.27.0../pom.xmlgoogle-http-client-jackson
- 1.26.1-SNAPSHOT
+ 1.27.0Jackson extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-jackson2/pom.xml b/google-http-client-jackson2/pom.xml
index c34bf6f19..ddb0ab9d1 100644
--- a/google-http-client-jackson2/pom.xml
+++ b/google-http-client-jackson2/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.26.1-SNAPSHOT
+ 1.27.0../pom.xmlgoogle-http-client-jackson2
- 1.26.1-SNAPSHOT
+ 1.27.0Jackson 2 extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-jdo/pom.xml b/google-http-client-jdo/pom.xml
index 020b1de33..d1aac3f60 100644
--- a/google-http-client-jdo/pom.xml
+++ b/google-http-client-jdo/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.26.1-SNAPSHOT
+ 1.27.0../pom.xmlgoogle-http-client-jdo
- 1.26.1-SNAPSHOT
+ 1.27.0JDO extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-protobuf/pom.xml b/google-http-client-protobuf/pom.xml
index 8f6917aff..a08599caf 100644
--- a/google-http-client-protobuf/pom.xml
+++ b/google-http-client-protobuf/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.26.1-SNAPSHOT
+ 1.27.0../pom.xmlgoogle-http-client-protobuf
- 1.26.1-SNAPSHOT
+ 1.27.0Protocol Buffer extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-test/pom.xml b/google-http-client-test/pom.xml
index df038a2c1..da137f88f 100644
--- a/google-http-client-test/pom.xml
+++ b/google-http-client-test/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.26.1-SNAPSHOT
+ 1.27.0../pom.xmlgoogle-http-client-test
- 1.26.1-SNAPSHOT
+ 1.27.0Shared classes used for testing of artifacts in the Google HTTP Client Library for Java.
diff --git a/google-http-client-xml/pom.xml b/google-http-client-xml/pom.xml
index 9f7b745cc..848135406 100644
--- a/google-http-client-xml/pom.xml
+++ b/google-http-client-xml/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.26.1-SNAPSHOT
+ 1.27.0../pom.xmlgoogle-http-client-xml
- 1.26.1-SNAPSHOT
+ 1.27.0XML extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client/pom.xml b/google-http-client/pom.xml
index f5ea5497c..9971a0280 100644
--- a/google-http-client/pom.xml
+++ b/google-http-client/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.26.1-SNAPSHOT
+ 1.27.0../pom.xmlgoogle-http-client
- 1.26.1-SNAPSHOT
+ 1.27.0Google HTTP Client Library for Java
Google HTTP Client Library for Java. Functionality that works on all supported Java platforms,
diff --git a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
index dcabb9044..856666a68 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
@@ -50,7 +50,7 @@ public final class HttpRequest {
*
* @since 1.8
*/
- public static final String VERSION = "1.26.0";
+ public static final String VERSION = "1.27.0";
/**
* User agent suffix for all requests.
@@ -505,7 +505,7 @@ public HttpRequest setReadTimeout(int readTimeout) {
* By default it is 0 (infinite).
*
*
- * @since 1.26
+ * @since 1.27
*/
public int getWriteTimeout() {
return writeTimeout;
@@ -514,7 +514,7 @@ public int getWriteTimeout() {
/**
* Sets the timeout in milliseconds to send POST/PUT data or {@code 0} for an infinite timeout.
*
- * @since 1.26
+ * @since 1.27
*/
public HttpRequest setWriteTimeout(int writeTimeout) {
Preconditions.checkArgument(writeTimeout >= 0);
diff --git a/google-http-client/src/main/java/com/google/api/client/http/LowLevelHttpRequest.java b/google-http-client/src/main/java/com/google/api/client/http/LowLevelHttpRequest.java
index d3900f91c..36e6c3c22 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/LowLevelHttpRequest.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/LowLevelHttpRequest.java
@@ -169,7 +169,7 @@ public void setTimeout(int connectTimeout, int readTimeout) throws IOException {
* @param writeTimeout timeout in milliseconds to establish a connection or {@code 0} for an
* infinite timeout
* @throws IOException I/O exception
- * @since 1.26
+ * @since 1.27
*/
public void setWriteTimeout(int writeTimeout) throws IOException {
}
diff --git a/pom.xml b/pom.xml
index 6ced6b2ee..c341ca8bd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
com.google.http-clientgoogle-http-client-parent
- 1.26.1-SNAPSHOT
+ 1.27.0pomParent for the Google HTTP Client Library for Java
@@ -298,6 +298,10 @@
1.6
+
+ maven-deploy-plugin
+ 2.8.2
+ org.sonatype.pluginsjarjar-maven-plugin
diff --git a/samples/dailymotion-simple-cmdline-sample/pom.xml b/samples/dailymotion-simple-cmdline-sample/pom.xml
index ca0ffb08e..63d8dbd99 100644
--- a/samples/dailymotion-simple-cmdline-sample/pom.xml
+++ b/samples/dailymotion-simple-cmdline-sample/pom.xml
@@ -4,7 +4,7 @@
com.google.http-clientgoogle-http-client-parent
- 1.26.1-SNAPSHOT
+ 1.27.0../../pom.xmldailymotion-simple-cmdline-sample
diff --git a/samples/googleplus-simple-cmdline-sample/pom.xml b/samples/googleplus-simple-cmdline-sample/pom.xml
index 16d6b3a80..da75b3aa6 100644
--- a/samples/googleplus-simple-cmdline-sample/pom.xml
+++ b/samples/googleplus-simple-cmdline-sample/pom.xml
@@ -4,7 +4,7 @@
com.google.http-clientgoogle-http-client-parent
- 1.26.1-SNAPSHOT
+ 1.27.0../../pom.xmlgoogleplus-simple-cmdline-sample
diff --git a/versions.txt b/versions.txt
index 6983f416e..6d23f2a92 100644
--- a/versions.txt
+++ b/versions.txt
@@ -1,18 +1,18 @@
# Format:
# module:released-version:current-version
-google-http-client:1.26.0:1.26.1-SNAPSHOT
-google-http-client-bom:1.26.0:1.26.1-SNAPSHOT
-google-http-client-parent:1.26.0:1.26.1-SNAPSHOT
-google-http-client-android:1.26.0:1.26.1-SNAPSHOT
-google-http-client-android-test:1.26.0:1.26.1-SNAPSHOT
-google-http-client-appengine:1.26.0:1.26.1-SNAPSHOT
-google-http-client-assembly:1.26.0:1.26.1-SNAPSHOT
-google-http-client-findbugs:1.26.0:1.26.1-SNAPSHOT
-google-http-client-gson:1.26.0:1.26.1-SNAPSHOT
-google-http-client-jackson:1.26.0:1.26.1-SNAPSHOT
-google-http-client-jackson2:1.26.0:1.26.1-SNAPSHOT
-google-http-client-jdo:1.26.0:1.26.1-SNAPSHOT
-google-http-client-protobuf:1.26.0:1.26.1-SNAPSHOT
-google-http-client-test:1.26.0:1.26.1-SNAPSHOT
-google-http-client-xml:1.26.0:1.26.1-SNAPSHOT
+google-http-client:1.27.0:1.27.0
+google-http-client-bom:1.27.0:1.27.0
+google-http-client-parent:1.27.0:1.27.0
+google-http-client-android:1.27.0:1.27.0
+google-http-client-android-test:1.27.0:1.27.0
+google-http-client-appengine:1.27.0:1.27.0
+google-http-client-assembly:1.27.0:1.27.0
+google-http-client-findbugs:1.27.0:1.27.0
+google-http-client-gson:1.27.0:1.27.0
+google-http-client-jackson:1.27.0:1.27.0
+google-http-client-jackson2:1.27.0:1.27.0
+google-http-client-jdo:1.27.0:1.27.0
+google-http-client-protobuf:1.27.0:1.27.0
+google-http-client-test:1.27.0:1.27.0
+google-http-client-xml:1.27.0:1.27.0
From 7d1f23a852b028574690be54cf574bea8c36d71c Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Mon, 12 Nov 2018 11:27:15 -0800
Subject: [PATCH 013/983] Bump next snapshot (#528)
---
google-http-client-android-test/pom.xml | 6 ++--
google-http-client-android/pom.xml | 4 +--
google-http-client-appengine/pom.xml | 4 +--
google-http-client-assembly/pom.xml | 4 +--
google-http-client-bom/pom.xml | 26 ++++++++--------
google-http-client-findbugs/pom.xml | 4 +--
google-http-client-gson/pom.xml | 4 +--
google-http-client-jackson/pom.xml | 4 +--
google-http-client-jackson2/pom.xml | 4 +--
google-http-client-jdo/pom.xml | 4 +--
google-http-client-protobuf/pom.xml | 4 +--
google-http-client-test/pom.xml | 4 +--
google-http-client-xml/pom.xml | 4 +--
google-http-client/pom.xml | 4 +--
pom.xml | 2 +-
.../dailymotion-simple-cmdline-sample/pom.xml | 2 +-
.../googleplus-simple-cmdline-sample/pom.xml | 2 +-
versions.txt | 30 +++++++++----------
18 files changed, 58 insertions(+), 58 deletions(-)
diff --git a/google-http-client-android-test/pom.xml b/google-http-client-android-test/pom.xml
index 5d6953615..06d65d2f8 100644
--- a/google-http-client-android-test/pom.xml
+++ b/google-http-client-android-test/pom.xml
@@ -4,7 +4,7 @@
google-http-clientgoogle-http-client-android-testTest project for google-http-client-android.
- 1.27.0
+ 1.27.1-SNAPSHOTapk
@@ -53,7 +53,7 @@
com.google.http-clientgoogle-http-client-android
- 1.27.0
+ 1.27.1-SNAPSHOTandroid
@@ -72,7 +72,7 @@
com.google.http-clientgoogle-http-client-test
- 1.27.0
+ 1.27.1-SNAPSHOTjunit
diff --git a/google-http-client-android/pom.xml b/google-http-client-android/pom.xml
index e52bd4921..05d531e92 100644
--- a/google-http-client-android/pom.xml
+++ b/google-http-client-android/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.0
+ 1.27.1-SNAPSHOT../pom.xmlgoogle-http-client-android
- 1.27.0
+ 1.27.1-SNAPSHOTAndroid Platform Extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-appengine/pom.xml b/google-http-client-appengine/pom.xml
index 3fc0641de..d0cb381c2 100644
--- a/google-http-client-appengine/pom.xml
+++ b/google-http-client-appengine/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.0
+ 1.27.1-SNAPSHOT../pom.xmlgoogle-http-client-appengine
- 1.27.0
+ 1.27.1-SNAPSHOTGoogle App Engine extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-assembly/pom.xml b/google-http-client-assembly/pom.xml
index 6eb170031..691062532 100644
--- a/google-http-client-assembly/pom.xml
+++ b/google-http-client-assembly/pom.xml
@@ -4,12 +4,12 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.0
+ 1.27.1-SNAPSHOT../pom.xmlcom.google.http-clientgoogle-http-client-assembly
- 1.27.0
+ 1.27.1-SNAPSHOTpomAssembly for the Google HTTP Client Library for Java
diff --git a/google-http-client-bom/pom.xml b/google-http-client-bom/pom.xml
index 05078d44f..f60b55bcf 100644
--- a/google-http-client-bom/pom.xml
+++ b/google-http-client-bom/pom.xml
@@ -3,7 +3,7 @@
4.0.0com.google.http-clientgoogle-http-client-bom
- 1.27.0
+ 1.27.1-SNAPSHOTpomGoogle HTTP Client Library for Java BOM
@@ -63,62 +63,62 @@
com.google.http-clientgoogle-http-client
- 1.27.0
+ 1.27.1-SNAPSHOTcom.google.http-clientgoogle-http-client-android
- 1.27.0
+ 1.27.1-SNAPSHOTcom.google.http-clientgoogle-http-client-appengine
- 1.27.0
+ 1.27.1-SNAPSHOTcom.google.http-clientgoogle-http-client-assembly
- 1.27.0
+ 1.27.1-SNAPSHOTcom.google.http-clientgoogle-http-client-findbugs
- 1.27.0
+ 1.27.1-SNAPSHOTcom.google.http-clientgoogle-http-client-gson
- 1.27.0
+ 1.27.1-SNAPSHOTcom.google.http-clientgoogle-http-client-jackson
- 1.27.0
+ 1.27.1-SNAPSHOTcom.google.http-clientgoogle-http-client-jackson2
- 1.27.0
+ 1.27.1-SNAPSHOTcom.google.http-clientgoogle-http-client-jdo
- 1.27.0
+ 1.27.1-SNAPSHOTcom.google.http-clientgoogle-http-client-protobuf
- 1.27.0
+ 1.27.1-SNAPSHOTcom.google.http-clientgoogle-http-client-test
- 1.27.0
+ 1.27.1-SNAPSHOTcom.google.http-clientgoogle-http-client-xml
- 1.27.0
+ 1.27.1-SNAPSHOT
diff --git a/google-http-client-findbugs/pom.xml b/google-http-client-findbugs/pom.xml
index 243a44d42..f785f9f02 100644
--- a/google-http-client-findbugs/pom.xml
+++ b/google-http-client-findbugs/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.0
+ 1.27.1-SNAPSHOT../pom.xmlgoogle-http-client-findbugs
- 1.27.0
+ 1.27.1-SNAPSHOTGoogle APIs Client Library Findbugs custom plugin.
diff --git a/google-http-client-gson/pom.xml b/google-http-client-gson/pom.xml
index 40768d189..ce30b92ec 100644
--- a/google-http-client-gson/pom.xml
+++ b/google-http-client-gson/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.0
+ 1.27.1-SNAPSHOT../pom.xmlgoogle-http-client-gson
- 1.27.0
+ 1.27.1-SNAPSHOTGSON extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-jackson/pom.xml b/google-http-client-jackson/pom.xml
index 177693c69..12584dd17 100644
--- a/google-http-client-jackson/pom.xml
+++ b/google-http-client-jackson/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.0
+ 1.27.1-SNAPSHOT../pom.xmlgoogle-http-client-jackson
- 1.27.0
+ 1.27.1-SNAPSHOTJackson extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-jackson2/pom.xml b/google-http-client-jackson2/pom.xml
index ddb0ab9d1..4eaa6cf29 100644
--- a/google-http-client-jackson2/pom.xml
+++ b/google-http-client-jackson2/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.0
+ 1.27.1-SNAPSHOT../pom.xmlgoogle-http-client-jackson2
- 1.27.0
+ 1.27.1-SNAPSHOTJackson 2 extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-jdo/pom.xml b/google-http-client-jdo/pom.xml
index d1aac3f60..6a42bdf0c 100644
--- a/google-http-client-jdo/pom.xml
+++ b/google-http-client-jdo/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.0
+ 1.27.1-SNAPSHOT../pom.xmlgoogle-http-client-jdo
- 1.27.0
+ 1.27.1-SNAPSHOTJDO extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-protobuf/pom.xml b/google-http-client-protobuf/pom.xml
index a08599caf..0f741b8f0 100644
--- a/google-http-client-protobuf/pom.xml
+++ b/google-http-client-protobuf/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.0
+ 1.27.1-SNAPSHOT../pom.xmlgoogle-http-client-protobuf
- 1.27.0
+ 1.27.1-SNAPSHOTProtocol Buffer extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-test/pom.xml b/google-http-client-test/pom.xml
index da137f88f..03fc43773 100644
--- a/google-http-client-test/pom.xml
+++ b/google-http-client-test/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.0
+ 1.27.1-SNAPSHOT../pom.xmlgoogle-http-client-test
- 1.27.0
+ 1.27.1-SNAPSHOTShared classes used for testing of artifacts in the Google HTTP Client Library for Java.
diff --git a/google-http-client-xml/pom.xml b/google-http-client-xml/pom.xml
index 848135406..a2bff67fe 100644
--- a/google-http-client-xml/pom.xml
+++ b/google-http-client-xml/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.0
+ 1.27.1-SNAPSHOT../pom.xmlgoogle-http-client-xml
- 1.27.0
+ 1.27.1-SNAPSHOTXML extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client/pom.xml b/google-http-client/pom.xml
index 9971a0280..69bf450f4 100644
--- a/google-http-client/pom.xml
+++ b/google-http-client/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.0
+ 1.27.1-SNAPSHOT../pom.xmlgoogle-http-client
- 1.27.0
+ 1.27.1-SNAPSHOTGoogle HTTP Client Library for Java
Google HTTP Client Library for Java. Functionality that works on all supported Java platforms,
diff --git a/pom.xml b/pom.xml
index c341ca8bd..94a6721aa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.0
+ 1.27.1-SNAPSHOTpomParent for the Google HTTP Client Library for Java
diff --git a/samples/dailymotion-simple-cmdline-sample/pom.xml b/samples/dailymotion-simple-cmdline-sample/pom.xml
index 63d8dbd99..6db9d2fa7 100644
--- a/samples/dailymotion-simple-cmdline-sample/pom.xml
+++ b/samples/dailymotion-simple-cmdline-sample/pom.xml
@@ -4,7 +4,7 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.0
+ 1.27.1-SNAPSHOT../../pom.xmldailymotion-simple-cmdline-sample
diff --git a/samples/googleplus-simple-cmdline-sample/pom.xml b/samples/googleplus-simple-cmdline-sample/pom.xml
index da75b3aa6..fbb83ff0d 100644
--- a/samples/googleplus-simple-cmdline-sample/pom.xml
+++ b/samples/googleplus-simple-cmdline-sample/pom.xml
@@ -4,7 +4,7 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.0
+ 1.27.1-SNAPSHOT../../pom.xmlgoogleplus-simple-cmdline-sample
diff --git a/versions.txt b/versions.txt
index 6d23f2a92..b8854ee7f 100644
--- a/versions.txt
+++ b/versions.txt
@@ -1,18 +1,18 @@
# Format:
# module:released-version:current-version
-google-http-client:1.27.0:1.27.0
-google-http-client-bom:1.27.0:1.27.0
-google-http-client-parent:1.27.0:1.27.0
-google-http-client-android:1.27.0:1.27.0
-google-http-client-android-test:1.27.0:1.27.0
-google-http-client-appengine:1.27.0:1.27.0
-google-http-client-assembly:1.27.0:1.27.0
-google-http-client-findbugs:1.27.0:1.27.0
-google-http-client-gson:1.27.0:1.27.0
-google-http-client-jackson:1.27.0:1.27.0
-google-http-client-jackson2:1.27.0:1.27.0
-google-http-client-jdo:1.27.0:1.27.0
-google-http-client-protobuf:1.27.0:1.27.0
-google-http-client-test:1.27.0:1.27.0
-google-http-client-xml:1.27.0:1.27.0
+google-http-client:1.27.0:1.27.1-SNAPSHOT
+google-http-client-bom:1.27.0:1.27.1-SNAPSHOT
+google-http-client-parent:1.27.0:1.27.1-SNAPSHOT
+google-http-client-android:1.27.0:1.27.1-SNAPSHOT
+google-http-client-android-test:1.27.0:1.27.1-SNAPSHOT
+google-http-client-appengine:1.27.0:1.27.1-SNAPSHOT
+google-http-client-assembly:1.27.0:1.27.1-SNAPSHOT
+google-http-client-findbugs:1.27.0:1.27.1-SNAPSHOT
+google-http-client-gson:1.27.0:1.27.1-SNAPSHOT
+google-http-client-jackson:1.27.0:1.27.1-SNAPSHOT
+google-http-client-jackson2:1.27.0:1.27.1-SNAPSHOT
+google-http-client-jdo:1.27.0:1.27.1-SNAPSHOT
+google-http-client-protobuf:1.27.0:1.27.1-SNAPSHOT
+google-http-client-test:1.27.0:1.27.1-SNAPSHOT
+google-http-client-xml:1.27.0:1.27.1-SNAPSHOT
From ab627ed38c5891139a507ee1b903e13f498045d8 Mon Sep 17 00:00:00 2001
From: ajaaym <34161822+ajaaym@users.noreply.github.com>
Date: Tue, 4 Dec 2018 12:37:07 -0500
Subject: [PATCH 014/983] Request charset defaults to UTF-8, Response charset
defaults to ISO_8859_1 (#532)
---
.../java/com/google/api/client/http/AbstractHttpContent.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/google-http-client/src/main/java/com/google/api/client/http/AbstractHttpContent.java b/google-http-client/src/main/java/com/google/api/client/http/AbstractHttpContent.java
index d288db1fd..46fcabd45 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/AbstractHttpContent.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/AbstractHttpContent.java
@@ -98,7 +98,7 @@ public AbstractHttpContent setMediaType(HttpMediaType mediaType) {
*/
protected final Charset getCharset() {
return mediaType == null || mediaType.getCharsetParameter() == null
- ? Charsets.UTF_8 : mediaType.getCharsetParameter();
+ ? Charsets.ISO_8859_1 : mediaType.getCharsetParameter();
}
public String getType() {
From fb1855551a998a1b62b319ca90840c4b45e052a4 Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Tue, 4 Dec 2018 14:39:25 -0800
Subject: [PATCH 015/983] Update guava to 26.0-android (#531)
---
...oogle-http-client-appengine-dependencies.html | 8 ++++----
.../google-http-client-dependencies.html | 16 ++++++++--------
.../google-http-client-gson-dependencies.html | 8 ++++----
.../google-http-client-jackson-dependencies.html | 8 ++++----
...google-http-client-jackson2-dependencies.html | 8 ++++----
.../google-http-client-jdo-dependencies.html | 8 ++++----
.../google-http-client-xml-dependencies.html | 8 ++++----
pom.xml | 2 +-
8 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/google-http-client-assembly/dependencies/google-http-client-appengine-dependencies.html b/google-http-client-assembly/dependencies/google-http-client-appengine-dependencies.html
index 91510b1ae..9dcd8632d 100644
--- a/google-http-client-assembly/dependencies/google-http-client-appengine-dependencies.html
+++ b/google-http-client-assembly/dependencies/google-http-client-appengine-dependencies.html
@@ -91,7 +91,7 @@
Description: MXP1 is a stable XmlPull parsing engine that is based on ideas from XPP and in particular XPP2 but completely revised and rewritten to take the best advantage of latest JIT JVMs such as Hotspot in JDK 1.4+.
diff --git a/pom.xml b/pom.xml
index 94a6721aa..3794f581a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -540,7 +540,7 @@
1.9.132.9.62.6.1
- 20.0
+ 26.0-android1.1.4c1.1.11.10
From f0ca8325e6fff636088b5efa777247849510380c Mon Sep 17 00:00:00 2001
From: ajaaym <34161822+ajaaym@users.noreply.github.com>
Date: Mon, 10 Dec 2018 13:40:19 -0500
Subject: [PATCH 016/983] Make signature of
com.google.api.client.util.Data#nullOf more type safe (#537)
---
.../src/main/java/com/google/api/client/util/Data.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/google-http-client/src/main/java/com/google/api/client/util/Data.java b/google-http-client/src/main/java/com/google/api/client/util/Data.java
index 2a8c9ac69..d4b67e02c 100644
--- a/google-http-client/src/main/java/com/google/api/client/util/Data.java
+++ b/google-http-client/src/main/java/com/google/api/client/util/Data.java
@@ -107,7 +107,7 @@ public class Data {
* @return magic object instance that represents the "null" value (not Java {@code null})
* @throws IllegalArgumentException if unable to create a new instance
*/
- public static T nullOf(Class> objClass) {
+ public static T nullOf(Class objClass) {
Object result = NULL_CACHE.get(objClass);
if (result == null) {
synchronized (NULL_CACHE) {
From ff934795716ae3083d1edc8078bb3843e559e59a Mon Sep 17 00:00:00 2001
From: ajaaym <34161822+ajaaym@users.noreply.github.com>
Date: Mon, 10 Dec 2018 13:41:40 -0500
Subject: [PATCH 017/983] GenericData can now overload setters (#538)
* Fix #340 HttpHeaders won't let me put/set "accept"
* fix case of null value
---
.../com/google/api/client/util/FieldInfo.java | 36 +++++++++++++++++++
.../api/client/util/GenericDataTest.java | 24 +++++++++++++
2 files changed, 60 insertions(+)
diff --git a/google-http-client/src/main/java/com/google/api/client/util/FieldInfo.java b/google-http-client/src/main/java/com/google/api/client/util/FieldInfo.java
index 5b7fa7900..0e50c0aba 100644
--- a/google-http-client/src/main/java/com/google/api/client/util/FieldInfo.java
+++ b/google-http-client/src/main/java/com/google/api/client/util/FieldInfo.java
@@ -15,8 +15,12 @@
package com.google.api.client.util;
import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
@@ -112,6 +116,9 @@ public static FieldInfo of(Field field) {
/** Field. */
private final Field field;
+ /** Setters Method for field */
+ private final Method []setters;
+
/**
* Data key name associated with the field for a non-enum-constant with a {@link Key} annotation,
* or data key value associated with the enum constant with a {@link Value} annotation or {@code
@@ -127,6 +134,21 @@ public static FieldInfo of(Field field) {
this.field = field;
this.name = name == null ? null : name.intern();
isPrimitive = Data.isPrimitive(getType());
+ this.setters = settersMethodForField(field);
+ }
+
+ /**
+ * Creates list of setter methods for a field only in declaring class.
+ */
+ private Method[] settersMethodForField(Field field) {
+ List methods = new ArrayList();
+ for (Method method : field.getDeclaringClass().getDeclaredMethods()) {
+ if (method.getName().toLowerCase().equals("set" + field.getName().toLowerCase())
+ && method.getParameterTypes().length == 1) {
+ methods.add(method);
+ }
+ }
+ return methods.toArray(new Method[methods.size()]);
}
/**
@@ -203,6 +225,20 @@ public Object getValue(Object obj) {
* If the field is final, it checks that value being set is identical to the existing value.
*/
public void setValue(Object obj, Object value) {
+ if (setters.length > 0) {
+ for (Method method : setters) {
+ if (value == null || method.getParameterTypes()[0].isAssignableFrom(value.getClass())) {
+ try {
+ method.invoke(obj, value);
+ return;
+ } catch (IllegalAccessException e) {
+ // try to set field directly
+ } catch (InvocationTargetException e) {
+ // try to set field directly
+ }
+ }
+ }
+ }
setFieldValue(field, obj, value);
}
diff --git a/google-http-client/src/test/java/com/google/api/client/util/GenericDataTest.java b/google-http-client/src/test/java/com/google/api/client/util/GenericDataTest.java
index 91d319561..4daf1bf3f 100644
--- a/google-http-client/src/test/java/com/google/api/client/util/GenericDataTest.java
+++ b/google-http-client/src/test/java/com/google/api/client/util/GenericDataTest.java
@@ -15,7 +15,9 @@
package com.google.api.client.util;
import com.google.api.client.util.GenericData.Flags;
+import java.util.ArrayList;
import java.util.EnumSet;
+import java.util.List;
import junit.framework.Assert;
import junit.framework.TestCase;
@@ -32,6 +34,18 @@ public MyData() {
@Key("FieldA")
public String fieldA;
+
+ @Key("FieldB")
+ public List fieldB;
+
+ public void setFieldB(String fieldB) {
+ this.fieldB = Lists.newArrayList();
+ this.fieldB.add(fieldB);
+ }
+
+ public void setFieldB(List fieldB) {
+ this.fieldB = fieldB;
+ }
}
@@ -119,4 +133,14 @@ public void testRemoveIgnoreCase_unknownKey() {
assertEquals(2, data.remove("TESTA"));
assertEquals(null, data.remove("TESTA"));
}
+
+ public void testPutShouldUseSetter() {
+ MyData data = new MyData();
+ data.put("fieldB", "value1");
+ assertEquals("value1", data.fieldB.get(0));
+ List list = new ArrayList();
+ list.add("value2");
+ data.put("fieldB", list);
+ assertEquals(list, data.fieldB);
+ }
}
From d16ab5c32195c7b5069e4887033b15e8dffc50e1 Mon Sep 17 00:00:00 2001
From: ajaaym <34161822+ajaaym@users.noreply.github.com>
Date: Mon, 10 Dec 2018 14:08:27 -0500
Subject: [PATCH 018/983] Fix UriTemplate.expand to properly escape value
(#534)
* Fix #351 UriTemplate.expand does not properly escape characters for path-style parameter expansion
* remove unused import
---
.../google/api/client/http/UriTemplate.java | 25 ++++++++-----------
.../api/client/http/UriTemplateTest.java | 7 ++++++
2 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/google-http-client/src/main/java/com/google/api/client/http/UriTemplate.java b/google-http-client/src/main/java/com/google/api/client/http/UriTemplate.java
index e5c4a40cb..8cedf7e45 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/UriTemplate.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/UriTemplate.java
@@ -186,7 +186,7 @@ String getEncodedValue(String value) {
String encodedValue;
if (reservedExpansion) {
// Reserved expansion allows pct-encoded triplets and characters in the reserved set.
- encodedValue = CharEscapers.escapeUriPath(value);
+ encodedValue = CharEscapers.escapeUriPathWithoutReserved(value);
} else {
encodedValue = CharEscapers.escapeUri(value);
}
@@ -339,26 +339,14 @@ public static String expand(String pathUri, Object parameters,
value = getListPropertyValue(varName, iterator, containsExplodeModifier, compositeOutput);
} else if (value.getClass().isEnum()) {
String name = FieldInfo.of((Enum>) value).getName();
- if (name != null) {
- if (compositeOutput.requiresVarAssignment()) {
- value = String.format("%s=%s", varName, value);
- }
- value = CharEscapers.escapeUriPath(value.toString());
- }
+ value = getSimpleValue(varName, name != null ? name : value.toString(), compositeOutput);
} else if (!Data.isValueOfPrimitiveType(value)) {
// Parse the value as a key/value map.
Map map = getMap(value);
value = getMapPropertyValue(varName, map, containsExplodeModifier, compositeOutput);
} else {
// For everything else...
- if (compositeOutput.requiresVarAssignment()) {
- value = String.format("%s=%s", varName, value);
- }
- if (compositeOutput.getReservedExpansion()) {
- value = CharEscapers.escapeUriPathWithoutReserved(value.toString());
- } else {
- value = CharEscapers.escapeUriPath(value.toString());
- }
+ value = getSimpleValue(varName, value.toString(), compositeOutput);
}
pathBuf.append(value);
}
@@ -370,6 +358,13 @@ public static String expand(String pathUri, Object parameters,
return pathBuf.toString();
}
+ private static String getSimpleValue(String name, String value, CompositeOutput compositeOutput) {
+ if (compositeOutput.requiresVarAssignment()) {
+ return String.format("%s=%s", name, compositeOutput.getEncodedValue(value.toString()));
+ }
+ return compositeOutput.getEncodedValue(value);
+ }
+
/**
* Expand the template of a composite list property.
* Eg: If d := ["red", "green", "blue"]
diff --git a/google-http-client/src/test/java/com/google/api/client/http/UriTemplateTest.java b/google-http-client/src/test/java/com/google/api/client/http/UriTemplateTest.java
index 2dfcc1f3d..fea7d8cbe 100644
--- a/google-http-client/src/test/java/com/google/api/client/http/UriTemplateTest.java
+++ b/google-http-client/src/test/java/com/google/api/client/http/UriTemplateTest.java
@@ -57,6 +57,13 @@ public void testExpandTemplates_basic() {
assertTrue(requestMap.containsKey("unused"));
}
+ public void testExpanTemplates_basicEncodeValue() {
+ SortedMap requestMap = Maps.newTreeMap();
+ requestMap.put("abc", "xyz;def");
+ assertEquals(";abc=xyz%3Bdef", UriTemplate.expand("{;abc}", requestMap, false));
+ assertEquals("xyz;def", UriTemplate.expand("{+abc}", requestMap, false));
+ }
+
public void testExpandTemplates_noExpansionsWithQueryParams() {
SortedMap requestMap = Maps.newTreeMap();
requestMap.put("abc", "xyz");
From 02a604086d95b349c21975e822b300d05abfe08e Mon Sep 17 00:00:00 2001
From: ajaaym <34161822+ajaaym@users.noreply.github.com>
Date: Tue, 11 Dec 2018 11:33:03 -0500
Subject: [PATCH 019/983] Fix building HttpResponseException when charset is
malformed (#535)
* fix #323 IllegalCharsetNameException in HttpResponse getContentCharset() if charset is malformed
* add test case
* remove unused import
---
.../client/http/HttpResponseException.java | 2 +
.../http/HttpResponseExceptionTest.java | 56 +++++++++++++++++++
2 files changed, 58 insertions(+)
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 139773a89..6526ac2d6 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
@@ -179,6 +179,8 @@ public Builder(HttpResponse response) {
} catch (IOException exception) {
// it would be bad to throw an exception while throwing an exception
exception.printStackTrace();
+ } catch (IllegalArgumentException exception) {
+ exception.printStackTrace();
}
// message
StringBuilder builder = computeMessageBuffer(response);
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 950c40d7e..627d70a00 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
@@ -183,6 +183,62 @@ public LowLevelHttpResponse execute() throws IOException {
}
}
+ public void testInvalidCharset() throws Exception {
+ HttpTransport transport = new MockHttpTransport() {
+ @Override
+ public LowLevelHttpRequest buildRequest(String method, String url) throws IOException {
+ return new MockLowLevelHttpRequest() {
+ @Override
+ public LowLevelHttpResponse execute() throws IOException {
+ MockLowLevelHttpResponse result = new MockLowLevelHttpResponse();
+ result.setStatusCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND);
+ result.setReasonPhrase("Not Found");
+ result.setContentType("text/plain; charset=");
+ result.setContent("Unable to find resource");
+ return result;
+ }
+ };
+ }
+ };
+ HttpRequest request =
+ transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
+ try {
+ request.execute();
+ fail();
+ } catch (HttpResponseException e) {
+ assertEquals(
+ "404 Not Found", e.getMessage());
+ }
+ }
+
+ public void testUnsupportedCharset() throws Exception {
+ HttpTransport transport = new MockHttpTransport() {
+ @Override
+ public LowLevelHttpRequest buildRequest(String method, String url) throws IOException {
+ return new MockLowLevelHttpRequest() {
+ @Override
+ public LowLevelHttpResponse execute() throws IOException {
+ MockLowLevelHttpResponse result = new MockLowLevelHttpResponse();
+ result.setStatusCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND);
+ result.setReasonPhrase("Not Found");
+ result.setContentType("text/plain; charset=invalid-charset");
+ result.setContent("Unable to find resource");
+ return result;
+ }
+ };
+ }
+ };
+ HttpRequest request =
+ transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
+ try {
+ request.execute();
+ fail();
+ } catch (HttpResponseException e) {
+ assertEquals(
+ "404 Not Found", e.getMessage());
+ }
+ }
+
public void testSerialization() throws Exception {
HttpTransport transport = new MockHttpTransport();
HttpRequest request =
From 3656dcb7697529d5bcecda3c8b245747fa321856 Mon Sep 17 00:00:00 2001
From: ajaaym <34161822+ajaaym@users.noreply.github.com>
Date: Tue, 11 Dec 2018 11:36:49 -0500
Subject: [PATCH 020/983] Implement Closeable & Flushable in JsonGenerator and
JsonParser (#540)
* fix #342 JsonGenerator and JsonParser should implement Closeable (and Flushable)
* remove flushable from JsonParser
---
.../main/java/com/google/api/client/json/JsonGenerator.java | 4 +++-
.../src/main/java/com/google/api/client/json/JsonParser.java | 3 ++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/google-http-client/src/main/java/com/google/api/client/json/JsonGenerator.java b/google-http-client/src/main/java/com/google/api/client/json/JsonGenerator.java
index a58760281..b37ac6ced 100644
--- a/google-http-client/src/main/java/com/google/api/client/json/JsonGenerator.java
+++ b/google-http-client/src/main/java/com/google/api/client/json/JsonGenerator.java
@@ -22,6 +22,8 @@
import com.google.api.client.util.Preconditions;
import com.google.api.client.util.Types;
+import java.io.Closeable;
+import java.io.Flushable;
import java.io.IOException;
import java.lang.reflect.Field;
import java.math.BigDecimal;
@@ -39,7 +41,7 @@
* @since 1.3
* @author Yaniv Inbar
*/
-public abstract class JsonGenerator {
+public abstract class JsonGenerator implements Closeable, Flushable {
/** Returns the JSON factory from which this generator was created. */
public abstract JsonFactory getFactory();
diff --git a/google-http-client/src/main/java/com/google/api/client/json/JsonParser.java b/google-http-client/src/main/java/com/google/api/client/json/JsonParser.java
index 0c3a5b249..e91c71306 100644
--- a/google-http-client/src/main/java/com/google/api/client/json/JsonParser.java
+++ b/google-http-client/src/main/java/com/google/api/client/json/JsonParser.java
@@ -24,6 +24,7 @@
import com.google.api.client.util.Sets;
import com.google.api.client.util.Types;
+import java.io.Closeable;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
@@ -60,7 +61,7 @@
* @since 1.3
* @author Yaniv Inbar
*/
-public abstract class JsonParser {
+public abstract class JsonParser implements Closeable {
/**
* Maps a polymorphic {@link Class} to its {@link Field} with the {@link JsonPolymorphicTypeMap}
From 158545f50d9d9380fa4d6230c140b810bae2d39b Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Tue, 11 Dec 2018 16:14:57 -0800
Subject: [PATCH 021/983] Compile to Java 1.7 binary (#542)
* Compile to Java 1.7 binary
* Fix javadoc links to official Java 7 docs
---
google-http-client-android/pom.xml | 2 +-
google-http-client-appengine/pom.xml | 4 ++--
.../google-http-client-findbugs-test/pom.xml | 4 ++--
google-http-client-gson/pom.xml | 2 +-
google-http-client-jackson/pom.xml | 2 +-
google-http-client-jackson2/pom.xml | 2 +-
google-http-client-jdo/pom.xml | 2 +-
google-http-client-protobuf/pom.xml | 2 +-
google-http-client-test/pom.xml | 2 +-
google-http-client-xml/pom.xml | 2 +-
google-http-client/pom.xml | 2 +-
pom.xml | 8 ++++----
12 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/google-http-client-android/pom.xml b/google-http-client-android/pom.xml
index 05d531e92..a6d337978 100644
--- a/google-http-client-android/pom.xml
+++ b/google-http-client-android/pom.xml
@@ -17,7 +17,7 @@
maven-javadoc-plugin
- http://download.oracle.com/javase/6/docs/api/
+ http://download.oracle.com/javase/7/docs/api/
${project.name} ${project.version}${project.artifactId} ${project.version}
diff --git a/google-http-client-appengine/pom.xml b/google-http-client-appengine/pom.xml
index d0cb381c2..a5272e118 100644
--- a/google-http-client-appengine/pom.xml
+++ b/google-http-client-appengine/pom.xml
@@ -17,7 +17,7 @@
maven-javadoc-plugin
- http://download.oracle.com/javase/6/docs/api/
+ http://download.oracle.com/javase/7/docs/api/
https://cloud.google.com/appengine/docs/standard/java/javadoc/
${project.name} ${project.version}
@@ -43,7 +43,7 @@
org.codehaus.mojo.signature
- java16
+ java171.0
diff --git a/google-http-client-findbugs/google-http-client-findbugs-test/pom.xml b/google-http-client-findbugs/google-http-client-findbugs-test/pom.xml
index 09ea2382c..3efde56f3 100644
--- a/google-http-client-findbugs/google-http-client-findbugs-test/pom.xml
+++ b/google-http-client-findbugs/google-http-client-findbugs-test/pom.xml
@@ -13,8 +13,8 @@
maven-compiler-plugin2.3.2
- 1.5
- 1.5
+ 1.7
+ 1.7
diff --git a/google-http-client-gson/pom.xml b/google-http-client-gson/pom.xml
index ce30b92ec..7905ce151 100644
--- a/google-http-client-gson/pom.xml
+++ b/google-http-client-gson/pom.xml
@@ -17,7 +17,7 @@
maven-javadoc-plugin
- http://download.oracle.com/javase/6/docs/api/
+ http://download.oracle.com/javase/7/docs/api/
https://www.javadoc.io/doc/com.google.code.gson/gson/${project.gson.version}
${project.name} ${project.version}
diff --git a/google-http-client-jackson/pom.xml b/google-http-client-jackson/pom.xml
index 12584dd17..b800f633a 100644
--- a/google-http-client-jackson/pom.xml
+++ b/google-http-client-jackson/pom.xml
@@ -17,7 +17,7 @@
maven-javadoc-plugin
- http://download.oracle.com/javase/6/docs/api/
+ http://download.oracle.com/javase/7/docs/api/
https://jar-download.com/artifacts/org.codehaus.jackson/jackson-core-asl/${project.jackson-core-asl.version}/documentation
${project.name} ${project.version}
diff --git a/google-http-client-jackson2/pom.xml b/google-http-client-jackson2/pom.xml
index 4eaa6cf29..73c04749c 100644
--- a/google-http-client-jackson2/pom.xml
+++ b/google-http-client-jackson2/pom.xml
@@ -17,7 +17,7 @@
maven-javadoc-plugin
- http://download.oracle.com/javase/6/docs/api/
+ http://download.oracle.com/javase/7/docs/api/
http://fasterxml.github.com/jackson-core/javadoc/${project.jackson-core2.version}/
${project.name} ${project.version}
diff --git a/google-http-client-jdo/pom.xml b/google-http-client-jdo/pom.xml
index 6a42bdf0c..f0303f451 100644
--- a/google-http-client-jdo/pom.xml
+++ b/google-http-client-jdo/pom.xml
@@ -17,7 +17,7 @@
maven-javadoc-plugin
- http://download.oracle.com/javase/6/docs/api/
+ http://download.oracle.com/javase/7/docs/api/
${project.name} ${project.version}${project.artifactId} ${project.version}
diff --git a/google-http-client-protobuf/pom.xml b/google-http-client-protobuf/pom.xml
index 0f741b8f0..0a98346ac 100644
--- a/google-http-client-protobuf/pom.xml
+++ b/google-http-client-protobuf/pom.xml
@@ -24,7 +24,7 @@
maven-javadoc-plugin
- http://download.oracle.com/javase/6/docs/api/
+ http://download.oracle.com/javase/7/docs/api/
${project.name} ${project.version}${project.artifactId} ${project.version}
diff --git a/google-http-client-test/pom.xml b/google-http-client-test/pom.xml
index 03fc43773..e7c843615 100644
--- a/google-http-client-test/pom.xml
+++ b/google-http-client-test/pom.xml
@@ -17,7 +17,7 @@
maven-javadoc-plugin
- http://download.oracle.com/javase/6/docs/api/
+ http://download.oracle.com/javase/7/docs/api/
${project.name} ${project.version}${project.artifactId} ${project.version}
diff --git a/google-http-client-xml/pom.xml b/google-http-client-xml/pom.xml
index a2bff67fe..f731ce066 100644
--- a/google-http-client-xml/pom.xml
+++ b/google-http-client-xml/pom.xml
@@ -17,7 +17,7 @@
maven-javadoc-plugin
- http://download.oracle.com/javase/6/docs/api/
+ http://download.oracle.com/javase/7/docs/api/
${project.name} ${project.version}${project.artifactId} ${project.version}
diff --git a/google-http-client/pom.xml b/google-http-client/pom.xml
index 69bf450f4..03b60de19 100644
--- a/google-http-client/pom.xml
+++ b/google-http-client/pom.xml
@@ -21,7 +21,7 @@
maven-javadoc-plugin
- http://download.oracle.com/javase/6/docs/api/
+ http://download.oracle.com/javase/7/docs/api/
https://google.github.io/guava/releases/${project.guava.version}/api/docs/
https://commons.apache.org/proper/commons-codec/archives/${project.commons-codec.version}/apidocs/
diff --git a/pom.xml b/pom.xml
index 3794f581a..60b173ab6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -294,8 +294,8 @@
maven-compiler-plugin2.3.2
- 1.6
- 1.6
+ 1.7
+ 1.7
@@ -399,7 +399,7 @@
site
- http://download.oracle.com/javase/6/docs/api/
+ http://download.oracle.com/javase/7/docs/api/
http://cloud.google.com/appengine/docs/java/javadoc
https://jar-download.com/artifacts/org.codehaus.jackson/jackson-core-asl/${project.jackson-core-asl.version}/documentation
http://fasterxml.github.com/jackson-core/javadoc/${project.jackson-core2.version}/
@@ -505,7 +505,7 @@
org.codehaus.mojo.signature
- java16
+ java171.0
From 455d4a564347c1db4b7c812ee28cbd7838e39c5e Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Wed, 12 Dec 2018 13:10:38 -0800
Subject: [PATCH 022/983] Deprecate google-http-client-jackson (#539)
* Mark google-http-client-jackson classes as deprecated
* Remove disallowed annotation
---
.../java/com/google/api/client/json/jackson/JacksonFactory.java | 2 ++
.../com/google/api/client/json/jackson/JacksonGenerator.java | 2 ++
.../java/com/google/api/client/json/jackson/JacksonParser.java | 2 ++
.../java/com/google/api/client/json/jackson/package-info.java | 2 +-
4 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/JacksonFactory.java b/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/JacksonFactory.java
index 8f0b86348..817bdbb14 100644
--- a/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/JacksonFactory.java
+++ b/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/JacksonFactory.java
@@ -37,7 +37,9 @@
*
* @since 1.3
* @author Yaniv Inbar
+ * @deprecated As of release 1.28, please use Jackson2 and google-http-client-jackson2.
*/
+@Deprecated
public final class JacksonFactory extends JsonFactory {
/** JSON factory. */
diff --git a/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/JacksonGenerator.java b/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/JacksonGenerator.java
index 27f8c9d34..64c0eed57 100644
--- a/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/JacksonGenerator.java
+++ b/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/JacksonGenerator.java
@@ -28,7 +28,9 @@
*
*
* @author Yaniv Inbar
+ * @deprecated As of release 1.28, please use Jackson2 and google-http-client-jackson2.
*/
+@Deprecated
final class JacksonGenerator extends JsonGenerator {
private final org.codehaus.jackson.JsonGenerator generator;
private final JacksonFactory factory;
diff --git a/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/JacksonParser.java b/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/JacksonParser.java
index a7b3427a3..9a246d185 100644
--- a/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/JacksonParser.java
+++ b/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/JacksonParser.java
@@ -29,7 +29,9 @@
*
*
* @author Yaniv Inbar
+ * @deprecated As of release 1.28, please use Jackson2 and google-http-client-jackson2.
*/
+@Deprecated
final class JacksonParser extends JsonParser {
private final org.codehaus.jackson.JsonParser parser;
diff --git a/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/package-info.java b/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/package-info.java
index 28df204df..81ca7adb7 100644
--- a/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/package-info.java
+++ b/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/package-info.java
@@ -18,7 +18,7 @@
*
* @since 1.3
* @author Yaniv Inbar
+ * @deprecated As of release 1.28, please use Jackson2 and google-http-client-jackson2.
*/
-
package com.google.api.client.json.jackson;
From 79ed2feb3036b7fd9eb579037aa23e9304f815aa Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Wed, 12 Dec 2018 13:10:52 -0800
Subject: [PATCH 023/983] Deprecate AndroidHttp compatibility shim (#541)
---
.../google/api/client/extensions/android/http/AndroidHttp.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/google-http-client-android/src/main/java/com/google/api/client/extensions/android/http/AndroidHttp.java b/google-http-client-android/src/main/java/com/google/api/client/extensions/android/http/AndroidHttp.java
index c7c08f3cb..63287ee18 100644
--- a/google-http-client-android/src/main/java/com/google/api/client/extensions/android/http/AndroidHttp.java
+++ b/google-http-client-android/src/main/java/com/google/api/client/extensions/android/http/AndroidHttp.java
@@ -28,8 +28,11 @@
*
* @since 1.11
* @author Yaniv Inbar
+ * @deprecated Gingerbread is no longer supported by Google Play Services. Please use
+ * {@link NetHttpTransport} directly or switch to Cronet which is better supported.
*/
@Beta
+@Deprecated
public class AndroidHttp {
/**
From bf4a8dad3f44772504f0223544ab7b92c9bea3be Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Wed, 12 Dec 2018 13:11:08 -0800
Subject: [PATCH 024/983] Split http apache artifact (#543)
* Split apache transport into 2 artifacts, current and legacy
* Fix poms to make tests pass
---
clirr-ignored-differences.xml | 4 +
google-http-client-android/pom.xml | 4 +
google-http-client-apache-legacy/pom.xml | 111 +++++
.../client/http/apache/ApacheHttpRequest.java | 0
.../http/apache/ApacheHttpResponse.java | 0
.../http/apache/ApacheHttpTransport.java | 0
.../api/client/http/apache/ContentEntity.java | 0
.../http/apache/HttpExtensionMethod.java | 0
.../apache/SSLSocketFactoryExtension.java | 0
.../api/client/http/apache/package-info.java | 0
.../http/apache/ApacheHttpTransportTest.java | 0
google-http-client-apache/pom.xml | 111 +++++
.../client/http/apache/ApacheHttpRequest.java | 67 +++
.../http/apache/ApacheHttpResponse.java | 120 +++++
.../http/apache/ApacheHttpTransport.java | 412 ++++++++++++++++++
.../api/client/http/apache/ContentEntity.java | 65 +++
.../http/apache/HttpExtensionMethod.java | 42 ++
.../apache/SSLSocketFactoryExtension.java | 61 +++
.../api/client/http/apache/package-info.java | 23 +
.../http/apache/ApacheHttpTransportTest.java | 119 +++++
google-http-client-bom/pom.xml | 5 +
pom.xml | 7 +
versions.txt | 2 +
23 files changed, 1153 insertions(+)
create mode 100644 google-http-client-apache-legacy/pom.xml
rename {google-http-client => google-http-client-apache-legacy}/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java (100%)
rename {google-http-client => google-http-client-apache-legacy}/src/main/java/com/google/api/client/http/apache/ApacheHttpResponse.java (100%)
rename {google-http-client => google-http-client-apache-legacy}/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java (100%)
rename {google-http-client => google-http-client-apache-legacy}/src/main/java/com/google/api/client/http/apache/ContentEntity.java (100%)
rename {google-http-client => google-http-client-apache-legacy}/src/main/java/com/google/api/client/http/apache/HttpExtensionMethod.java (100%)
rename {google-http-client => google-http-client-apache-legacy}/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java (100%)
rename {google-http-client => google-http-client-apache-legacy}/src/main/java/com/google/api/client/http/apache/package-info.java (100%)
rename {google-http-client => google-http-client-apache-legacy}/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java (100%)
create mode 100644 google-http-client-apache/pom.xml
create mode 100644 google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java
create mode 100644 google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpResponse.java
create mode 100644 google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
create mode 100644 google-http-client-apache/src/main/java/com/google/api/client/http/apache/ContentEntity.java
create mode 100644 google-http-client-apache/src/main/java/com/google/api/client/http/apache/HttpExtensionMethod.java
create mode 100644 google-http-client-apache/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java
create mode 100644 google-http-client-apache/src/main/java/com/google/api/client/http/apache/package-info.java
create mode 100644 google-http-client-apache/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java
diff --git a/clirr-ignored-differences.xml b/clirr-ignored-differences.xml
index 898e94c20..fb3252a38 100644
--- a/clirr-ignored-differences.xml
+++ b/clirr-ignored-differences.xml
@@ -7,4 +7,8 @@
8001com/google/api/client/repackaged/**
+
+ 8001
+ com/google/api/client/http/apache/**
+
diff --git a/google-http-client-android/pom.xml b/google-http-client-android/pom.xml
index a6d337978..509d7aab0 100644
--- a/google-http-client-android/pom.xml
+++ b/google-http-client-android/pom.xml
@@ -48,5 +48,9 @@
com.google.http-clientgoogle-http-client
+
+ com.google.http-client
+ google-http-client-apache
+
diff --git a/google-http-client-apache-legacy/pom.xml b/google-http-client-apache-legacy/pom.xml
new file mode 100644
index 000000000..3914fc251
--- /dev/null
+++ b/google-http-client-apache-legacy/pom.xml
@@ -0,0 +1,111 @@
+
+ 4.0.0
+
+ com.google.http-client
+ google-http-client-parent
+ 1.27.1-SNAPSHOT
+ ../pom.xml
+
+ google-http-client-apache-legacy
+ 1.27.1-SNAPSHOT
+ Apache HTTP transport for the Google HTTP Client Library for Java.
+
+
+
+
+ maven-javadoc-plugin
+
+
+ http://download.oracle.com/javase/6/docs/api/
+ https://jar-download.com/artifacts/org.codehaus.jackson/jackson-core-asl/${project.jackson-core-asl.version}/documentation
+
+ ${project.name} ${project.version}
+ ${project.artifactId} ${project.version}
+
+
+
+ maven-source-plugin
+
+
+ source-jar
+ compile
+
+ jar
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+ 1.5
+
+
+ add-test-source
+ generate-test-sources
+
+ add-test-source
+
+
+
+ target/generated-test-sources
+
+
+
+
+
+
+ maven-jar-plugin
+
+
+ ${project.build.outputDirectory}/META-INF/MANIFEST.MF
+
+ com.google.api.client.http.apache
+
+
+
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ 2.5.4
+
+
+ bundle-manifest
+ process-classes
+
+ manifest
+
+
+
+
+
+
+
+
+ com.google.http-client
+ google-http-client
+
+
+ com.google.http-client
+ google-http-client-test
+ test
+
+
+ junit
+ junit
+ test
+
+
+ com.google.guava
+ guava
+ test
+
+
+ org.mockito
+ mockito-all
+ test
+
+
+
diff --git a/google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java
similarity index 100%
rename from google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java
rename to google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java
diff --git a/google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpResponse.java b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpResponse.java
similarity index 100%
rename from google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpResponse.java
rename to google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpResponse.java
diff --git a/google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
similarity index 100%
rename from google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
rename to google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
diff --git a/google-http-client/src/main/java/com/google/api/client/http/apache/ContentEntity.java b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ContentEntity.java
similarity index 100%
rename from google-http-client/src/main/java/com/google/api/client/http/apache/ContentEntity.java
rename to google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ContentEntity.java
diff --git a/google-http-client/src/main/java/com/google/api/client/http/apache/HttpExtensionMethod.java b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/HttpExtensionMethod.java
similarity index 100%
rename from google-http-client/src/main/java/com/google/api/client/http/apache/HttpExtensionMethod.java
rename to google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/HttpExtensionMethod.java
diff --git a/google-http-client/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java
similarity index 100%
rename from google-http-client/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java
rename to google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java
diff --git a/google-http-client/src/main/java/com/google/api/client/http/apache/package-info.java b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/package-info.java
similarity index 100%
rename from google-http-client/src/main/java/com/google/api/client/http/apache/package-info.java
rename to google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/package-info.java
diff --git a/google-http-client/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java b/google-http-client-apache-legacy/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java
similarity index 100%
rename from google-http-client/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java
rename to google-http-client-apache-legacy/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java
diff --git a/google-http-client-apache/pom.xml b/google-http-client-apache/pom.xml
new file mode 100644
index 000000000..6a40174c5
--- /dev/null
+++ b/google-http-client-apache/pom.xml
@@ -0,0 +1,111 @@
+
+ 4.0.0
+
+ com.google.http-client
+ google-http-client-parent
+ 1.27.1-SNAPSHOT
+ ../pom.xml
+
+ google-http-client-apache
+ 1.27.1-SNAPSHOT
+ Apache HTTP transport for the Google HTTP Client Library for Java.
+
+
+
+
+ maven-javadoc-plugin
+
+
+ http://download.oracle.com/javase/6/docs/api/
+ https://jar-download.com/artifacts/org.codehaus.jackson/jackson-core-asl/${project.jackson-core-asl.version}/documentation
+
+ ${project.name} ${project.version}
+ ${project.artifactId} ${project.version}
+
+
+
+ maven-source-plugin
+
+
+ source-jar
+ compile
+
+ jar
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+ 1.5
+
+
+ add-test-source
+ generate-test-sources
+
+ add-test-source
+
+
+
+ target/generated-test-sources
+
+
+
+
+
+
+ maven-jar-plugin
+
+
+ ${project.build.outputDirectory}/META-INF/MANIFEST.MF
+
+ com.google.api.client.http.apache
+
+
+
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ 2.5.4
+
+
+ bundle-manifest
+ process-classes
+
+ manifest
+
+
+
+
+
+
+
+
+ com.google.http-client
+ google-http-client
+
+
+ com.google.http-client
+ google-http-client-test
+ test
+
+
+ junit
+ junit
+ test
+
+
+ com.google.guava
+ guava
+ test
+
+
+ org.mockito
+ mockito-all
+ test
+
+
+
diff --git a/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java b/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java
new file mode 100644
index 000000000..b31b20594
--- /dev/null
+++ b/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2010 Google Inc.
+ *
+ * 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;
+
+import com.google.api.client.http.LowLevelHttpRequest;
+import com.google.api.client.http.LowLevelHttpResponse;
+import com.google.api.client.util.Preconditions;
+import java.io.IOException;
+import org.apache.http.HttpEntityEnclosingRequest;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.conn.params.ConnManagerParams;
+import org.apache.http.params.HttpConnectionParams;
+import org.apache.http.params.HttpParams;
+
+/**
+ * @author Yaniv Inbar
+ */
+final class ApacheHttpRequest extends LowLevelHttpRequest {
+ private final HttpClient httpClient;
+
+ private final HttpRequestBase request;
+
+ ApacheHttpRequest(HttpClient httpClient, HttpRequestBase request) {
+ this.httpClient = httpClient;
+ this.request = request;
+ }
+
+ @Override
+ public void addHeader(String name, String value) {
+ request.addHeader(name, value);
+ }
+
+ @Override
+ public void setTimeout(int connectTimeout, int readTimeout) throws IOException {
+ HttpParams params = request.getParams();
+ ConnManagerParams.setTimeout(params, connectTimeout);
+ HttpConnectionParams.setConnectionTimeout(params, connectTimeout);
+ HttpConnectionParams.setSoTimeout(params, readTimeout);
+ }
+
+ @Override
+ public LowLevelHttpResponse execute() throws IOException {
+ if (getStreamingContent() != null) {
+ Preconditions.checkArgument(request instanceof HttpEntityEnclosingRequest,
+ "Apache HTTP client does not support %s requests with content.",
+ request.getRequestLine().getMethod());
+ ContentEntity entity = new ContentEntity(getContentLength(), getStreamingContent());
+ entity.setContentEncoding(getContentEncoding());
+ entity.setContentType(getContentType());
+ ((HttpEntityEnclosingRequest) request).setEntity(entity);
+ }
+ return new ApacheHttpResponse(request, httpClient.execute(request));
+ }
+}
diff --git a/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpResponse.java b/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpResponse.java
new file mode 100644
index 000000000..0b2e9cef5
--- /dev/null
+++ b/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpResponse.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2010 Google Inc.
+ *
+ * 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;
+
+import com.google.api.client.http.LowLevelHttpResponse;
+import java.io.IOException;
+import java.io.InputStream;
+import org.apache.http.Header;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.StatusLine;
+import org.apache.http.client.methods.HttpRequestBase;
+
+final class ApacheHttpResponse extends LowLevelHttpResponse {
+
+ private final HttpRequestBase request;
+ private final HttpResponse response;
+ private final Header[] allHeaders;
+
+ ApacheHttpResponse(HttpRequestBase request, HttpResponse response) {
+ this.request = request;
+ this.response = response;
+ allHeaders = response.getAllHeaders();
+ }
+
+ @Override
+ public int getStatusCode() {
+ StatusLine statusLine = response.getStatusLine();
+ return statusLine == null ? 0 : statusLine.getStatusCode();
+ }
+
+ @Override
+ public InputStream getContent() throws IOException {
+ HttpEntity entity = response.getEntity();
+ return entity == null ? null : entity.getContent();
+ }
+
+ @Override
+ public String getContentEncoding() {
+ HttpEntity entity = response.getEntity();
+ if (entity != null) {
+ Header contentEncodingHeader = entity.getContentEncoding();
+ if (contentEncodingHeader != null) {
+ return contentEncodingHeader.getValue();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public long getContentLength() {
+ HttpEntity entity = response.getEntity();
+ return entity == null ? -1 : entity.getContentLength();
+ }
+
+ @Override
+ public String getContentType() {
+ HttpEntity entity = response.getEntity();
+ if (entity != null) {
+ Header contentTypeHeader = entity.getContentType();
+ if (contentTypeHeader != null) {
+ return contentTypeHeader.getValue();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String getReasonPhrase() {
+ StatusLine statusLine = response.getStatusLine();
+ return statusLine == null ? null : statusLine.getReasonPhrase();
+ }
+
+ @Override
+ public String getStatusLine() {
+ StatusLine statusLine = response.getStatusLine();
+ return statusLine == null ? null : statusLine.toString();
+ }
+
+ public String getHeaderValue(String name) {
+ return response.getLastHeader(name).getValue();
+ }
+
+ @Override
+ public int getHeaderCount() {
+ return allHeaders.length;
+ }
+
+ @Override
+ public String getHeaderName(int index) {
+ return allHeaders[index].getName();
+ }
+
+ @Override
+ public String getHeaderValue(int index) {
+ return allHeaders[index].getValue();
+ }
+
+ /**
+ * Aborts execution of the request.
+ *
+ * @since 1.4
+ */
+ @Override
+ public void disconnect() {
+ request.abort();
+ }
+}
diff --git a/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java b/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
new file mode 100644
index 000000000..50e74dc87
--- /dev/null
+++ b/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
@@ -0,0 +1,412 @@
+/*
+ * Copyright (c) 2010 Google Inc.
+ *
+ * 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;
+
+import com.google.api.client.http.HttpMethods;
+import com.google.api.client.http.HttpRequest;
+import com.google.api.client.http.HttpTransport;
+import com.google.api.client.util.Beta;
+import com.google.api.client.util.Preconditions;
+import com.google.api.client.util.SecurityUtils;
+import com.google.api.client.util.SslUtils;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.ProxySelector;
+import java.security.GeneralSecurityException;
+import java.security.KeyStore;
+import java.security.cert.CertificateFactory;
+import javax.net.ssl.SSLContext;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpVersion;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpHead;
+import org.apache.http.client.methods.HttpOptions;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.client.methods.HttpTrace;
+import org.apache.http.client.params.ClientPNames;
+import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.conn.params.ConnManagerParams;
+import org.apache.http.conn.params.ConnPerRouteBean;
+import org.apache.http.conn.params.ConnRouteParams;
+import org.apache.http.conn.scheme.PlainSocketFactory;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.scheme.SchemeRegistry;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
+import org.apache.http.impl.conn.DefaultHttpRoutePlanner;
+import org.apache.http.impl.conn.ProxySelectorRoutePlanner;
+import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.HttpConnectionParams;
+import org.apache.http.params.HttpParams;
+import org.apache.http.params.HttpProtocolParams;
+
+/**
+ * Thread-safe HTTP transport based on the Apache HTTP Client library.
+ *
+ *
+ * Implementation is thread-safe, as long as any parameter modification to the
+ * {@link #getHttpClient() Apache HTTP Client} is only done at initialization time. For maximum
+ * efficiency, applications should use a single globally-shared instance of the HTTP transport.
+ *
+ *
+ *
+ * Default settings are specified in {@link #newDefaultHttpClient()}. Use the
+ * {@link #ApacheHttpTransport(HttpClient)} constructor to override the Apache HTTP Client used.
+ * Alternatively, use {@link #ApacheHttpTransport()} and change the {@link #getHttpClient()}. Please
+ * read the Apache HTTP
+ * Client connection management tutorial for more complex configuration options.
+ *
+ *
+ * @since 1.0
+ * @author Yaniv Inbar
+ */
+public final class ApacheHttpTransport extends HttpTransport {
+
+ /** Apache HTTP client. */
+ private final HttpClient httpClient;
+
+ /**
+ * Constructor that uses {@link #newDefaultHttpClient()} for the Apache HTTP client.
+ *
+ *
+ * Use {@link Builder} to modify HTTP client options.
+ *
+ *
+ * @since 1.3
+ */
+ public ApacheHttpTransport() {
+ this(newDefaultHttpClient());
+ }
+
+ /**
+ * Constructor that allows an alternative Apache HTTP client to be used.
+ *
+ *
+ * Note that a few settings are overridden:
+ *
+ *
+ *
HTTP version is set to 1.1 using {@link HttpProtocolParams#setVersion} with
+ * {@link HttpVersion#HTTP_1_1}.
+ *
Redirects are disabled using {@link ClientPNames#HANDLE_REDIRECTS}.
+ *
{@link ConnManagerParams#setTimeout} and {@link HttpConnectionParams#setConnectionTimeout}
+ * are set on each request based on {@link HttpRequest#getConnectTimeout()}.
+ *
{@link HttpConnectionParams#setSoTimeout} is set on each request based on
+ * {@link HttpRequest#getReadTimeout()}.
+ *
+ *
+ *
+ * Use {@link Builder} for a more user-friendly way to modify the HTTP client options.
+ *
+ *
+ * @param httpClient Apache HTTP client to use
+ *
+ * @since 1.6
+ */
+ public ApacheHttpTransport(HttpClient httpClient) {
+ this.httpClient = httpClient;
+ HttpParams params = httpClient.getParams();
+ if (params == null) {
+ params = newDefaultHttpClient().getParams();
+ }
+ HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
+ params.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, false);
+ }
+
+ /**
+ * Creates a new instance of the Apache HTTP client that is used by the
+ * {@link #ApacheHttpTransport()} constructor.
+ *
+ *
+ * Use this constructor if you want to customize the default Apache HTTP client. Settings:
+ *
+ *
+ *
The client connection manager is set to {@link ThreadSafeClientConnManager}.
+ *
The socket buffer size is set to 8192 using
+ * {@link HttpConnectionParams#setSocketBufferSize}.
+ *
+ *
The route planner uses {@link ProxySelectorRoutePlanner} with
+ * {@link ProxySelector#getDefault()}, which uses the proxy settings from system
+ * properties.
+ *
+ *
+ * @return new instance of the Apache HTTP client
+ * @since 1.6
+ */
+ public static DefaultHttpClient newDefaultHttpClient() {
+ return newDefaultHttpClient(
+ SSLSocketFactory.getSocketFactory(), newDefaultHttpParams(), ProxySelector.getDefault());
+ }
+
+ /** Returns a new instance of the default HTTP parameters we use. */
+ static HttpParams newDefaultHttpParams() {
+ HttpParams params = new BasicHttpParams();
+ // Turn off stale checking. Our connections break all the time anyway,
+ // and it's not worth it to pay the penalty of checking every time.
+ HttpConnectionParams.setStaleCheckingEnabled(params, false);
+ HttpConnectionParams.setSocketBufferSize(params, 8192);
+ ConnManagerParams.setMaxTotalConnections(params, 200);
+ ConnManagerParams.setMaxConnectionsPerRoute(params, new ConnPerRouteBean(20));
+ return params;
+ }
+
+ /**
+ * Creates a new instance of the Apache HTTP client that is used by the
+ * {@link #ApacheHttpTransport()} constructor.
+ *
+ * @param socketFactory SSL socket factory
+ * @param params HTTP parameters
+ * @param proxySelector HTTP proxy selector to use {@link ProxySelectorRoutePlanner} or
+ * {@code null} for {@link DefaultHttpRoutePlanner}
+ * @return new instance of the Apache HTTP client
+ */
+ static DefaultHttpClient newDefaultHttpClient(
+ SSLSocketFactory socketFactory, HttpParams params, ProxySelector proxySelector) {
+ // See http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html
+ SchemeRegistry registry = new SchemeRegistry();
+ registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
+ registry.register(new Scheme("https", socketFactory, 443));
+ ClientConnectionManager connectionManager = new ThreadSafeClientConnManager(params, registry);
+ DefaultHttpClient defaultHttpClient = new DefaultHttpClient(connectionManager, params);
+ defaultHttpClient.setHttpRequestRetryHandler(new DefaultHttpRequestRetryHandler(0, false));
+ if (proxySelector != null) {
+ defaultHttpClient.setRoutePlanner(new ProxySelectorRoutePlanner(registry, proxySelector));
+ }
+ return defaultHttpClient;
+ }
+
+ @Override
+ public boolean supportsMethod(String method) {
+ return true;
+ }
+
+ @Override
+ protected ApacheHttpRequest buildRequest(String method, String url) {
+ HttpRequestBase requestBase;
+ if (method.equals(HttpMethods.DELETE)) {
+ requestBase = new HttpDelete(url);
+ } else if (method.equals(HttpMethods.GET)) {
+ requestBase = new HttpGet(url);
+ } else if (method.equals(HttpMethods.HEAD)) {
+ requestBase = new HttpHead(url);
+ } else if (method.equals(HttpMethods.POST)) {
+ requestBase = new HttpPost(url);
+ } else if (method.equals(HttpMethods.PUT)) {
+ requestBase = new HttpPut(url);
+ } else if (method.equals(HttpMethods.TRACE)) {
+ requestBase = new HttpTrace(url);
+ } else if (method.equals(HttpMethods.OPTIONS)) {
+ requestBase = new HttpOptions(url);
+ } else {
+ requestBase = new HttpExtensionMethod(method, url);
+ }
+ return new ApacheHttpRequest(httpClient, requestBase);
+ }
+
+ /**
+ * Shuts down the connection manager and releases allocated resources. This includes closing all
+ * connections, whether they are currently used or not.
+ *
+ * @since 1.4
+ */
+ @Override
+ public void shutdown() {
+ httpClient.getConnectionManager().shutdown();
+ }
+
+ /**
+ * Returns the Apache HTTP client.
+ *
+ * @since 1.5
+ */
+ public HttpClient getHttpClient() {
+ return httpClient;
+ }
+
+ /**
+ * Builder for {@link ApacheHttpTransport}.
+ *
+ *
+ * Implementation is not thread-safe.
+ *
+ *
+ * @since 1.13
+ */
+ public static final class Builder {
+
+ /** SSL socket factory. */
+ private SSLSocketFactory socketFactory = SSLSocketFactory.getSocketFactory();
+
+ /** HTTP parameters. */
+ private HttpParams params = newDefaultHttpParams();
+
+ /**
+ * HTTP proxy selector to use {@link ProxySelectorRoutePlanner} or {@code null} for
+ * {@link DefaultHttpRoutePlanner}.
+ */
+ private ProxySelector proxySelector = ProxySelector.getDefault();
+
+ /**
+ * Sets the HTTP proxy to use {@link DefaultHttpRoutePlanner} or {@code null} to use
+ * {@link #setProxySelector(ProxySelector)} with {@link ProxySelector#getDefault()}.
+ *
+ *
+ * By default it is {@code null}, which uses the proxy settings from system
+ * properties.
+ *
+ *
+ *
+ * For example:
+ *
+ *
+ *
+ setProxy(new HttpHost("127.0.0.1", 8080))
+ *
+ */
+ public Builder setProxy(HttpHost proxy) {
+ ConnRouteParams.setDefaultProxy(params, proxy);
+ if (proxy != null) {
+ proxySelector = null;
+ }
+ return this;
+ }
+
+ /**
+ * Sets the HTTP proxy selector to use {@link ProxySelectorRoutePlanner} or {@code null} for
+ * {@link DefaultHttpRoutePlanner}.
+ *
+ *
+ * By default it is {@link ProxySelector#getDefault()} which uses the proxy settings from system
+ * properties.
+ *
+ */
+ public Builder setProxySelector(ProxySelector proxySelector) {
+ this.proxySelector = proxySelector;
+ if (proxySelector != null) {
+ ConnRouteParams.setDefaultProxy(params, null);
+ }
+ return this;
+ }
+ /**
+ * Sets the SSL socket factory based on root certificates in a Java KeyStore.
+ *
+ *
Window > Preferences... (or on Mac, Eclipse >
- Preferences...)
-
Select Maven
-
-
check on "Download Artifact Sources"
-
check on "Download Artifact JavaDoc"
-
-
-
-
-
Import googleplus-simple-cmdline-sample project
-
-
File > Import...
-
Select "General > Existing Project into Workspace" and click
- "Next"
-
Click "Browse" next to "Select root directory", find
- [someDirectory]/google-http-java-client-samples/googleplus-simple-cmdline-sample
- and click "Next"
-
Click "Finish"
-
-
-
Run
-
-
Right-click on project googleplus-simple-cmdline-sample
-
Run As > Java Application
-
If asked, type "GooglePlusSample" and click OK
-
To enabled logging, uncomment the logging level lines in logging.properties
-
-
-
-
-
-
diff --git a/samples/googleplus-simple-cmdline-sample/logging.properties b/samples/googleplus-simple-cmdline-sample/logging.properties
deleted file mode 100644
index b72da4db4..000000000
--- a/samples/googleplus-simple-cmdline-sample/logging.properties
+++ /dev/null
@@ -1,10 +0,0 @@
-# Properties file which configures the operation of the JDK logging facility.
-# The system will look for this config file to be specified as a system property:
-# -Djava.util.logging.config.file=${project_loc:googleplus-simple-cmdline-sample}/logging.properties
-
-# Set up the console handler (uncomment "level" to show more fine-grained messages)
-handlers = java.util.logging.ConsoleHandler
-# java.util.logging.ConsoleHandler.level = CONFIG
-
-# Set up logging of HTTP requests and responses (uncomment "level" to show)
-# com.google.api.client.http.level = CONFIG
diff --git a/samples/googleplus-simple-cmdline-sample/pom.xml b/samples/googleplus-simple-cmdline-sample/pom.xml
deleted file mode 100644
index fbb83ff0d..000000000
--- a/samples/googleplus-simple-cmdline-sample/pom.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-
- 4.0.0
-
- com.google.http-client
- google-http-client-parent
- 1.27.1-SNAPSHOT
- ../../pom.xml
-
- googleplus-simple-cmdline-sample
- Simple example for the Google+ API.
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
- 1.1
-
-
-
- java
-
-
-
-
- com.google.api.services.samples.googleplus.cmdline.simple.GooglePlusSample
-
-
- java.util.logging.config.file
- logging.properties
-
-
-
-
-
- maven-checkstyle-plugin
- 2.6
-
- ../checkstyle.xml
- true
- false
-
-
-
-
- check
-
-
-
-
-
- org.codehaus.mojo
- findbugs-maven-plugin
- 2.3.2
-
- ../../findbugs-exclude.xml
- false
-
-
-
-
- check
-
-
-
-
-
- org.apache.maven.plugins
- maven-deploy-plugin
- 2.5
-
- true
-
-
-
- org.sonatype.plugins
- nexus-staging-maven-plugin
- 1.6.6
-
- true
-
-
-
- ${project.artifactId}-${project.version}
-
-
-
- com.google.http-client
- google-http-client
-
-
- com.google.http-client
- google-http-client-jackson2
-
-
-
- UTF-8
-
-
diff --git a/samples/googleplus-simple-cmdline-sample/src/main/java/com/google/api/services/samples/googleplus/cmdline/simple/GooglePlusSample.java b/samples/googleplus-simple-cmdline-sample/src/main/java/com/google/api/services/samples/googleplus/cmdline/simple/GooglePlusSample.java
deleted file mode 100644
index 96802e01b..000000000
--- a/samples/googleplus-simple-cmdline-sample/src/main/java/com/google/api/services/samples/googleplus/cmdline/simple/GooglePlusSample.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright (c) 2011 Google Inc.
- *
- * 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.services.samples.googleplus.cmdline.simple;
-
-import com.google.api.client.http.GenericUrl;
-import com.google.api.client.http.HttpRequest;
-import com.google.api.client.http.HttpRequestFactory;
-import com.google.api.client.http.HttpRequestInitializer;
-import com.google.api.client.http.HttpResponse;
-import com.google.api.client.http.HttpResponseException;
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.http.javanet.NetHttpTransport;
-import com.google.api.client.json.GenericJson;
-import com.google.api.client.json.JsonFactory;
-import com.google.api.client.json.JsonObjectParser;
-import com.google.api.client.json.jackson2.JacksonFactory;
-import com.google.api.client.util.Key;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * Simple example that demonstrates how to use Google HTTP Client Library for Java with
- * the Google+ API.
- *
- *
- * Note that in the case of the Google+ API, there is a much better custom library built on top of
- * this HTTP library that is much easier to use and hides most of these details for you. See Google+ API for
- * Java.
- *
- *
- * @author Yaniv Inbar
- */
-public class GooglePlusSample {
-
- private static final String API_KEY =
- "Enter API Key from https://console.cloud.google.com/apis/api/plus.googleapis.com/overview into API_KEY";
-
- private static final String USER_ID = "116899029375914044550";
- private static final int MAX_RESULTS = 3;
-
- static final HttpTransport HTTP_TRANSPORT = new NetHttpTransport();
- static final JsonFactory JSON_FACTORY = new JacksonFactory();
-
- /** Feed of Google+ activities. */
- public static class ActivityFeed {
-
- /** List of Google+ activities. */
- @Key("items")
- private List activities;
-
- public List getActivities() {
- return activities;
- }
- }
-
- /** Google+ activity. */
- public static class Activity extends GenericJson {
-
- /** Activity URL. */
- @Key
- private String url;
-
- public String getUrl() {
- return url;
- }
-
- /** Activity object. */
- @Key("object")
- private ActivityObject activityObject;
-
- public ActivityObject getActivityObject() {
- return activityObject;
- }
- }
-
- /** Google+ activity object. */
- public static class ActivityObject {
-
- /** HTML-formatted content. */
- @Key
- private String content;
-
- public String getContent() {
- return content;
- }
-
- /** People who +1'd this activity. */
- @Key
- private PlusOners plusoners;
-
- public PlusOners getPlusOners() {
- return plusoners;
- }
- }
-
- /** People who +1'd an activity. */
- public static class PlusOners {
-
- /** Total number of people who +1'd this activity. */
- @Key
- private long totalItems;
-
- public long getTotalItems() {
- return totalItems;
- }
- }
-
- /** Google+ URL. */
- public static class PlusUrl extends GenericUrl {
-
- public PlusUrl(String encodedUrl) {
- super(encodedUrl);
- }
-
- @SuppressWarnings("unused")
- @Key
- private final String key = API_KEY;
-
- /** Maximum number of results. */
- @Key
- private int maxResults;
-
- public int getMaxResults() {
- return maxResults;
- }
-
- public PlusUrl setMaxResults(int maxResults) {
- this.maxResults = maxResults;
- return this;
- }
-
- /** Lists the public activities for the given Google+ user ID. */
- public static PlusUrl listPublicActivities(String userId) {
- return new PlusUrl(
- "https://www.googleapis.com/plus/v1/people/" + userId + "/activities/public");
- }
- }
-
- private static void parseResponse(HttpResponse response) throws IOException {
- ActivityFeed feed = response.parseAs(ActivityFeed.class);
- if (feed.getActivities().isEmpty()) {
- System.out.println("No activities found.");
- } else {
- if (feed.getActivities().size() == MAX_RESULTS) {
- System.out.print("First ");
- }
- System.out.println(feed.getActivities().size() + " activities found:");
- for (Activity activity : feed.getActivities()) {
- System.out.println();
- System.out.println("-----------------------------------------------");
- System.out.println("HTML Content: " + activity.getActivityObject().getContent());
- System.out.println("+1's: " + activity.getActivityObject().getPlusOners().getTotalItems());
- System.out.println("URL: " + activity.getUrl());
- System.out.println("ID: " + activity.get("id"));
- }
- }
- }
-
- private static void run() throws IOException {
- HttpRequestFactory requestFactory =
- HTTP_TRANSPORT.createRequestFactory(new HttpRequestInitializer() {
- @Override
- public void initialize(HttpRequest request) {
- request.setParser(new JsonObjectParser(JSON_FACTORY));
- }
- });
- PlusUrl url = PlusUrl.listPublicActivities(USER_ID).setMaxResults(MAX_RESULTS);
- url.put("fields", "items(id,url,object(content,plusoners/totalItems))");
- HttpRequest request = requestFactory.buildGetRequest(url);
- parseResponse(request.execute());
- }
-
- public static void main(String[] args) {
- if (API_KEY.startsWith("Enter ")) {
- System.err.println(API_KEY);
- System.exit(1);
- }
- try {
- try {
- run();
- return;
- } catch (HttpResponseException e) {
- System.err.println(e.getMessage());
- }
- } catch (Throwable t) {
- t.printStackTrace();
- }
- System.exit(1);
- }
-}
From ce27437a151de5d123d067994d2b6e6a442c1c96 Mon Sep 17 00:00:00 2001
From: Sebastien Briquet
Date: Fri, 28 Dec 2018 18:44:11 +0100
Subject: [PATCH 026/983] Fixed MockBackOff#getMaxTries, returns `maxTries`
(#548)
---
.../java/com/google/api/client/testing/util/MockBackOff.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/google-http-client/src/main/java/com/google/api/client/testing/util/MockBackOff.java b/google-http-client/src/main/java/com/google/api/client/testing/util/MockBackOff.java
index 6e5a85415..ba68370ad 100644
--- a/google-http-client/src/main/java/com/google/api/client/testing/util/MockBackOff.java
+++ b/google-http-client/src/main/java/com/google/api/client/testing/util/MockBackOff.java
@@ -85,7 +85,7 @@ public MockBackOff setMaxTries(int maxTries) {
/** Returns the maximum number of tries before returning {@link #STOP}. */
public final int getMaxTries() {
- return numTries;
+ return maxTries;
}
/** Returns the number of tries so far. */
From 2635d5af972ae6604dc3074c86bab669d7d7754e Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Fri, 28 Dec 2018 10:35:52 -0800
Subject: [PATCH 027/983] Re-add Apache PATCH request (#547)
* Revert "Revert "add patch to google http client (#486)" (#493)"
This reverts commit 9de9cbbb45c78fe48138dff01be34a66b5b2f51b.
* Move the new handlers to the apache-transport from the legacy apache-transport
---
.../com/google/api/client/http/apache/ApacheHttpTransport.java | 3 +++
.../google/api/client/http/apache/ApacheHttpTransportTest.java | 2 ++
2 files changed, 5 insertions(+)
diff --git a/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java b/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
index 50e74dc87..0b55a4ed0 100644
--- a/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
+++ b/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
@@ -35,6 +35,7 @@
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpHead;
import org.apache.http.client.methods.HttpOptions;
+import org.apache.http.client.methods.HttpPatch;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.methods.HttpRequestBase;
@@ -209,6 +210,8 @@ protected ApacheHttpRequest buildRequest(String method, String url) {
requestBase = new HttpGet(url);
} else if (method.equals(HttpMethods.HEAD)) {
requestBase = new HttpHead(url);
+ } else if (method.equals(HttpMethods.PATCH)) {
+ requestBase = new HttpPatch(url);
} else if (method.equals(HttpMethods.POST)) {
requestBase = new HttpPost(url);
} else if (method.equals(HttpMethods.PUT)) {
diff --git a/google-http-client-apache/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java b/google-http-client-apache/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java
index 21aa27357..07f6c29c7 100644
--- a/google-http-client-apache/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java
+++ b/google-http-client-apache/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java
@@ -73,6 +73,8 @@ public void testRequestsWithContent() throws Exception {
subtestUnsupportedRequestsWithContent(
transport.buildRequest("HEAD", "http://www.test.url"), "HEAD");
+ // Test PATCH.
+ execute(transport.buildRequest("PATCH", "http://www.test.url"));
// Test PUT.
execute(transport.buildRequest("PUT", "http://www.test.url"));
// Test POST.
From 6f89edc7f5a29617dbbd6df4da404221f8237bfb Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Fri, 28 Dec 2018 10:47:11 -0800
Subject: [PATCH 028/983] Re-add OpenCensus integration (#545)
* Revert "Revert "Add OpenCensus tracing instrument.""
This reverts commit 9dd0d1c1479d9298cca14eccce39cedbae73bbad.
* Revert "Revert "Enhance OpenCensus tracing instrumentation.""
This reverts commit 36280df23e07ec4a062353f20866649559143d9c.
* Update opencensus version and use dependencyManagement section
* Fix missing import
* Set span attributes
* Fix checkstyle and NPE for missing attributes
---
google-http-client/pom.xml | 9 +-
.../google/api/client/http/HttpRequest.java | 44 ++-
.../api/client/util/OpenCensusUtils.java | 264 ++++++++++++++++++
.../api/client/util/OpenCensusUtilsTest.java | 239 ++++++++++++++++
pom.xml | 11 +
5 files changed, 565 insertions(+), 2 deletions(-)
create mode 100644 google-http-client/src/main/java/com/google/api/client/util/OpenCensusUtils.java
create mode 100644 google-http-client/src/test/java/com/google/api/client/util/OpenCensusUtilsTest.java
diff --git a/google-http-client/pom.xml b/google-http-client/pom.xml
index 03b60de19..4b24e0c36 100644
--- a/google-http-client/pom.xml
+++ b/google-http-client/pom.xml
@@ -175,7 +175,14 @@
com.google.j2objcj2objc-annotations
- 1.1
+
+
+ io.opencensus
+ opencensus-api
+
+
+ io.opencensus
+ opencensus-contrib-http-util
diff --git a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
index 856666a68..1c68d9036 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
@@ -18,11 +18,18 @@
import com.google.api.client.util.IOUtils;
import com.google.api.client.util.LoggingStreamingContent;
import com.google.api.client.util.ObjectParser;
+import com.google.api.client.util.OpenCensusUtils;
import com.google.api.client.util.Preconditions;
import com.google.api.client.util.Sleeper;
import com.google.api.client.util.StreamingContent;
import com.google.api.client.util.StringUtils;
+import io.opencensus.common.Scope;
+import io.opencensus.contrib.http.util.HttpTraceAttributeConstants;
+import io.opencensus.trace.AttributeValue;
+import io.opencensus.trace.Span;
+import io.opencensus.trace.Tracer;
+
import java.io.IOException;
import java.io.InputStream;
import java.util.concurrent.Callable;
@@ -215,6 +222,9 @@ static String executeAndGetValueOfSomeCustomHeader(HttpRequest request) {
/** Sleeper. */
private Sleeper sleeper = Sleeper.DEFAULT;
+ /** OpenCensus tracing component. */
+ private Tracer tracer = OpenCensusUtils.getTracer();
+
/**
* @param transport HTTP transport
* @param requestMethod HTTP request method or {@code null} for none
@@ -883,7 +893,12 @@ public HttpResponse execute() throws IOException {
Preconditions.checkNotNull(requestMethod);
Preconditions.checkNotNull(url);
+ Span span = tracer
+ .spanBuilder(OpenCensusUtils.SPAN_NAME_HTTP_REQUEST_EXECUTE)
+ .setRecordEvents(OpenCensusUtils.isRecordEvent())
+ .startSpan();
do {
+ span.addAnnotation("retry #" + (numRetries - retriesRemaining));
// Cleanup any unneeded response from a previous iteration
if (response != null) {
response.ignore();
@@ -898,6 +913,11 @@ public HttpResponse execute() throws IOException {
}
// build low-level HTTP request
String urlString = url.build();
+ addSpanAttribute(span, HttpTraceAttributeConstants.HTTP_METHOD, requestMethod);
+ addSpanAttribute(span, HttpTraceAttributeConstants.HTTP_HOST, url.getHost());
+ addSpanAttribute(span, HttpTraceAttributeConstants.HTTP_PATH, url.getRawPath());
+ addSpanAttribute(span, HttpTraceAttributeConstants.HTTP_URL, urlString);
+
LowLevelHttpRequest lowLevelHttpRequest = transport.buildRequest(requestMethod, urlString);
Logger logger = HttpTransport.LOGGER;
boolean loggable = loggingEnabled && logger.isLoggable(Level.CONFIG);
@@ -923,10 +943,15 @@ public HttpResponse execute() throws IOException {
if (!suppressUserAgentSuffix) {
if (originalUserAgent == null) {
headers.setUserAgent(USER_AGENT_SUFFIX);
+ addSpanAttribute(span, HttpTraceAttributeConstants.HTTP_USER_AGENT, USER_AGENT_SUFFIX);
} else {
- headers.setUserAgent(originalUserAgent + " " + USER_AGENT_SUFFIX);
+ String newUserAgent = originalUserAgent + " " + USER_AGENT_SUFFIX;
+ headers.setUserAgent(newUserAgent);
+ addSpanAttribute(span, HttpTraceAttributeConstants.HTTP_USER_AGENT, newUserAgent);
}
}
+ OpenCensusUtils.propagateTracingContext(span, headers);
+
// headers
HttpHeaders.serializeHeaders(headers, logbuf, curlbuf, logger, lowLevelHttpRequest);
if (!suppressUserAgentSuffix) {
@@ -1007,8 +1032,16 @@ public HttpResponse execute() throws IOException {
// execute
lowLevelHttpRequest.setTimeout(connectTimeout, readTimeout);
lowLevelHttpRequest.setWriteTimeout(writeTimeout);
+
+ // switch tracing scope to current span
+ @SuppressWarnings("MustBeClosedChecker")
+ Scope ws = tracer.withSpan(span);
+ OpenCensusUtils.recordSentMessageEvent(span, lowLevelHttpRequest.getContentLength());
try {
LowLevelHttpResponse lowLevelHttpResponse = lowLevelHttpRequest.execute();
+ if (lowLevelHttpResponse != null) {
+ OpenCensusUtils.recordReceivedMessageEvent(span, lowLevelHttpResponse.getContentLength());
+ }
// Flag used to indicate if an exception is thrown before the response is constructed.
boolean responseConstructed = false;
try {
@@ -1032,6 +1065,8 @@ public HttpResponse execute() throws IOException {
if (loggable) {
logger.log(Level.WARNING, "exception thrown while executing request", e);
}
+ } finally {
+ ws.close();
}
// Flag used to indicate if an exception is thrown before the response has completed
@@ -1087,6 +1122,7 @@ public HttpResponse execute() throws IOException {
}
}
} while (retryRequest);
+ span.end(OpenCensusUtils.getEndSpanOptions(response == null ? null : response.getStatusCode()));
if (response == null) {
// Retries did not help resolve the execute exception, re-throw it.
@@ -1201,4 +1237,10 @@ public HttpRequest setSleeper(Sleeper sleeper) {
this.sleeper = Preconditions.checkNotNull(sleeper);
return this;
}
+
+ private static void addSpanAttribute(Span span, String key, String value) {
+ if (value != null) {
+ span.putAttribute(key, AttributeValue.stringAttributeValue(value));
+ }
+ }
}
diff --git a/google-http-client/src/main/java/com/google/api/client/util/OpenCensusUtils.java b/google-http-client/src/main/java/com/google/api/client/util/OpenCensusUtils.java
new file mode 100644
index 000000000..c2a2cc000
--- /dev/null
+++ b/google-http-client/src/main/java/com/google/api/client/util/OpenCensusUtils.java
@@ -0,0 +1,264 @@
+/*
+ * Copyright (c) 2018 Google Inc.
+ *
+ * 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.util;
+
+import com.google.api.client.http.HttpHeaders;
+import com.google.api.client.http.HttpRequest;
+import com.google.api.client.http.HttpStatusCodes;
+import com.google.common.annotations.VisibleForTesting;
+
+import io.opencensus.contrib.http.util.HttpPropagationUtil;
+import io.opencensus.trace.BlankSpan;
+import io.opencensus.trace.EndSpanOptions;
+import io.opencensus.trace.NetworkEvent;
+import io.opencensus.trace.NetworkEvent.Type;
+import io.opencensus.trace.Span;
+import io.opencensus.trace.Status;
+import io.opencensus.trace.Tracer;
+import io.opencensus.trace.Tracing;
+import io.opencensus.trace.propagation.TextFormat;
+
+import java.util.Collections;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.annotation.Nullable;
+
+/**
+ * Utilities for Census monitoring and tracing.
+ *
+ * @author Hailong Wen
+ * @since 1.24
+ */
+public class OpenCensusUtils {
+
+ private static final Logger logger = Logger.getLogger(OpenCensusUtils.class.getName());
+
+ /**
+ * Span name for tracing {@link HttpRequest#execute()}.
+ */
+ public static final String SPAN_NAME_HTTP_REQUEST_EXECUTE =
+ "Sent." + HttpRequest.class.getName() + ".execute";
+
+ /**
+ * OpenCensus tracing component. When no OpenCensus implementation is provided, it will return a
+ * no-op tracer.
+ */
+ private static Tracer tracer = Tracing.getTracer();
+
+ /**
+ * Sequence id generator for message event.
+ */
+ private static AtomicLong idGenerator = new AtomicLong();
+
+ /**
+ * Whether spans should be recorded locally. Defaults to true.
+ */
+ private static volatile boolean isRecordEvent = true;
+
+ /**
+ * {@link TextFormat} used in tracing context propagation.
+ */
+ @Nullable
+ @VisibleForTesting
+ static volatile TextFormat propagationTextFormat = null;
+
+ /**
+ * {@link TextFormat.Setter} for {@link #propagationTextFormat}.
+ */
+ @Nullable
+ @VisibleForTesting
+ static volatile TextFormat.Setter propagationTextFormatSetter = null;
+
+ /**
+ * Sets the {@link TextFormat} used in context propagation.
+ *
+ *
This API allows users of google-http-client to specify other text format, or disable context
+ * propagation by setting it to {@code null}. It should be used along with {@link
+ * #setPropagationTextFormatSetter} for setting purpose.
+ *
+ * @param textFormat the text format.
+ */
+ public static void setPropagationTextFormat(@Nullable TextFormat textFormat) {
+ propagationTextFormat = textFormat;
+ }
+
+ /**
+ * Sets the {@link TextFormat.Setter} used in context propagation.
+ *
+ *
This API allows users of google-http-client to specify other text format setter, or disable
+ * context propagation by setting it to {@code null}. It should be used along with {@link
+ * #setPropagationTextFormat} for setting purpose.
+ *
+ * @param textFormatSetter the {@code TextFormat.Setter} for the text format.
+ */
+ public static void setPropagationTextFormatSetter(@Nullable TextFormat.Setter textFormatSetter) {
+ propagationTextFormatSetter = textFormatSetter;
+ }
+
+ /**
+ * Sets whether spans should be recorded locally.
+ *
+ *
This API allows users of google-http-client to turn on/off local span collection.
+ *
+ * @param recordEvent record span locally if true.
+ */
+ public static void setIsRecordEvent(boolean recordEvent) {
+ isRecordEvent = recordEvent;
+ }
+
+ /**
+ * Returns the tracing component of OpenCensus.
+ *
+ * @return the tracing component of OpenCensus.
+ */
+ public static Tracer getTracer() {
+ return tracer;
+ }
+
+ /**
+ * Returns whether spans should be recorded locally.
+ *
+ * @return whether spans should be recorded locally.
+ */
+ public static boolean isRecordEvent() {
+ return isRecordEvent;
+ }
+
+ /**
+ * Propagate information of current tracing context. This information will be injected into HTTP
+ * header.
+ *
+ * @param span the span to be propagated.
+ * @param headers the headers used in propagation.
+ */
+ public static void propagateTracingContext(Span span, HttpHeaders headers) {
+ Preconditions.checkArgument(span != null, "span should not be null.");
+ Preconditions.checkArgument(headers != null, "headers should not be null.");
+ if (propagationTextFormat != null && propagationTextFormatSetter != null) {
+ if (!span.equals(BlankSpan.INSTANCE)) {
+ propagationTextFormat.inject(span.getContext(), headers, propagationTextFormatSetter);
+ }
+ }
+ }
+
+ /**
+ * Returns an {@link EndSpanOptions} to end a http span according to the status code.
+ *
+ * @param statusCode the status code, can be null to represent no valid response is returned.
+ * @return an {@code EndSpanOptions} that best suits the status code.
+ */
+ public static EndSpanOptions getEndSpanOptions(@Nullable Integer statusCode) {
+ // Always sample the span, but optionally export it.
+ EndSpanOptions.Builder builder = EndSpanOptions.builder();
+ if (statusCode == null) {
+ builder.setStatus(Status.UNKNOWN);
+ } else if (!HttpStatusCodes.isSuccess(statusCode)) {
+ switch (statusCode) {
+ case HttpStatusCodes.STATUS_CODE_BAD_REQUEST:
+ builder.setStatus(Status.INVALID_ARGUMENT);
+ break;
+ case HttpStatusCodes.STATUS_CODE_UNAUTHORIZED:
+ builder.setStatus(Status.UNAUTHENTICATED);
+ break;
+ case HttpStatusCodes.STATUS_CODE_FORBIDDEN:
+ builder.setStatus(Status.PERMISSION_DENIED);
+ break;
+ case HttpStatusCodes.STATUS_CODE_NOT_FOUND:
+ builder.setStatus(Status.NOT_FOUND);
+ break;
+ case HttpStatusCodes.STATUS_CODE_PRECONDITION_FAILED:
+ builder.setStatus(Status.FAILED_PRECONDITION);
+ break;
+ case HttpStatusCodes.STATUS_CODE_SERVER_ERROR:
+ builder.setStatus(Status.UNAVAILABLE);
+ break;
+ default:
+ builder.setStatus(Status.UNKNOWN);
+ }
+ } else {
+ builder.setStatus(Status.OK);
+ }
+ return builder.build();
+ }
+
+ /**
+ * Records a new message event which contains the size of the request content. Note that the size
+ * represents the message size in application layer, i.e., content-length.
+ *
+ * @param span The {@code span} in which the send event occurs.
+ * @param size Size of the request.
+ */
+ public static void recordSentMessageEvent(Span span, long size) {
+ recordMessageEvent(span, size, Type.SENT);
+ }
+
+ /**
+ * Records a new message event which contains the size of the response content. Note that the size
+ * represents the message size in application layer, i.e., content-length.
+ *
+ * @param span The {@code span} in which the receive event occurs.
+ * @param size Size of the response.
+ */
+ public static void recordReceivedMessageEvent(Span span, long size) {
+ recordMessageEvent(span, size, Type.RECV);
+ }
+
+ /**
+ * Records a message event of a certain {@link NetworkEvent.Type}. This method is package
+ * protected since {@link NetworkEvent} might be deprecated in future releases.
+ *
+ * @param span The {@code span} in which the event occurs.
+ * @param size Size of the message.
+ * @param eventType The {@code NetworkEvent.Type} of the message event.
+ */
+ @VisibleForTesting
+ static void recordMessageEvent(Span span, long size, Type eventType) {
+ Preconditions.checkArgument(span != null, "span should not be null.");
+ if (size < 0) {
+ size = 0;
+ }
+ NetworkEvent event = NetworkEvent
+ .builder(eventType, idGenerator.getAndIncrement())
+ .setUncompressedMessageSize(size)
+ .build();
+ span.addNetworkEvent(event);
+ }
+
+ static {
+ try {
+ propagationTextFormat = HttpPropagationUtil.getCloudTraceFormat();
+ propagationTextFormatSetter = new TextFormat.Setter() {
+ @Override
+ public void put(HttpHeaders carrier, String key, String value) {
+ carrier.set(key, value);
+ }
+ };
+ } catch (Exception e) {
+ logger.log(
+ Level.WARNING, "Cannot initialize default OpenCensus HTTP propagation text format.", e);
+ }
+
+ try {
+ Tracing.getExportComponent().getSampledSpanStore().registerSpanNamesForCollection(
+ Collections.singletonList(SPAN_NAME_HTTP_REQUEST_EXECUTE));
+ } catch (Exception e) {
+ logger.log(
+ Level.WARNING, "Cannot register default OpenCensus span names for collection.", e);
+ }
+ }
+
+ private OpenCensusUtils() {}
+}
diff --git a/google-http-client/src/test/java/com/google/api/client/util/OpenCensusUtilsTest.java b/google-http-client/src/test/java/com/google/api/client/util/OpenCensusUtilsTest.java
new file mode 100644
index 000000000..069b051ec
--- /dev/null
+++ b/google-http-client/src/test/java/com/google/api/client/util/OpenCensusUtilsTest.java
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2018 Google Inc.
+ *
+ * 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.util;
+
+import com.google.api.client.http.HttpHeaders;
+
+import io.opencensus.trace.BlankSpan;
+import io.opencensus.trace.EndSpanOptions;
+import io.opencensus.trace.Annotation;
+import io.opencensus.trace.AttributeValue;
+import io.opencensus.trace.Link;
+import io.opencensus.trace.NetworkEvent;
+import io.opencensus.trace.Span;
+import io.opencensus.trace.SpanContext;
+import io.opencensus.trace.Status;
+import io.opencensus.trace.Tracer;
+import io.opencensus.trace.propagation.TextFormat;
+import java.util.List;
+import java.util.Map;
+import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Rule;
+
+/**
+ * Tests {@link OpenCensusUtils}.
+ *
+ * @author Hailong Wen
+ */
+public class OpenCensusUtilsTest extends TestCase {
+
+ TextFormat mockTextFormat;
+ TextFormat.Setter mockTextFormatSetter;
+ TextFormat originTextFormat;
+ TextFormat.Setter originTextFormatSetter;
+ Span mockSpan;
+ HttpHeaders headers;
+ Tracer tracer;
+
+ public OpenCensusUtilsTest(String testName) {
+ super(testName);
+ }
+
+ @Override
+ public void setUp() {
+ mockTextFormat = new TextFormat() {
+ @Override
+ public List fields() {
+ throw new UnsupportedOperationException("TextFormat.fields");
+ }
+
+ @Override
+ public void inject(SpanContext spanContext, C carrier, Setter setter) {
+ throw new UnsupportedOperationException("TextFormat.inject");
+ }
+
+ @Override
+ public SpanContext extract(C carrier, Getter getter) {
+ throw new UnsupportedOperationException("TextFormat.extract");
+ }
+ };
+ mockTextFormatSetter = new TextFormat.Setter() {
+ @Override
+ public void put(HttpHeaders carrier, String key, String value) {
+ throw new UnsupportedOperationException("TextFormat.Setter.put");
+ }
+ };
+ headers = new HttpHeaders();
+ tracer = OpenCensusUtils.getTracer();
+ mockSpan = new Span(tracer.getCurrentSpan().getContext(), null) {
+
+ @Override
+ public void addAnnotation(String description, Map attributes) {}
+
+ @Override
+ public void addAnnotation(Annotation annotation) {}
+
+ @Override
+ public void addNetworkEvent(NetworkEvent event) {
+ throw new UnsupportedOperationException("Span.addNetworkEvent");
+ }
+
+ @Override
+ public void addLink(Link link) {}
+
+ @Override
+ public void end(EndSpanOptions options) {}
+ };
+ originTextFormat = OpenCensusUtils.propagationTextFormat;
+ originTextFormatSetter = OpenCensusUtils.propagationTextFormatSetter;
+ }
+
+ @Override
+ public void tearDown() {
+ OpenCensusUtils.setPropagationTextFormat(originTextFormat);
+ OpenCensusUtils.setPropagationTextFormatSetter(originTextFormatSetter);
+ }
+
+ public void testInitializatoin() {
+ assertNotNull(OpenCensusUtils.getTracer());
+ assertNotNull(OpenCensusUtils.propagationTextFormat);
+ assertNotNull(OpenCensusUtils.propagationTextFormatSetter);
+ }
+
+ public void testSetPropagationTextFormat() {
+ OpenCensusUtils.setPropagationTextFormat(mockTextFormat);
+ assertEquals(mockTextFormat, OpenCensusUtils.propagationTextFormat);
+ }
+
+ public void testSetPropagationTextFormatSetter() {
+ OpenCensusUtils.setPropagationTextFormatSetter(mockTextFormatSetter);
+ assertEquals(mockTextFormatSetter, OpenCensusUtils.propagationTextFormatSetter);
+ }
+
+ public void testPropagateTracingContextInjection() {
+ OpenCensusUtils.setPropagationTextFormat(mockTextFormat);
+ try {
+ OpenCensusUtils.propagateTracingContext(mockSpan, headers);
+ fail("expected " + UnsupportedOperationException.class);
+ } catch (UnsupportedOperationException e) {
+ assertEquals(e.getMessage(), "TextFormat.inject");
+ }
+ }
+
+ public void testPropagateTracingContextHeader() {
+ OpenCensusUtils.setPropagationTextFormatSetter(mockTextFormatSetter);
+ try {
+ OpenCensusUtils.propagateTracingContext(mockSpan, headers);
+ fail("expected " + UnsupportedOperationException.class);
+ } catch (UnsupportedOperationException e) {
+ assertEquals(e.getMessage(), "TextFormat.Setter.put");
+ }
+ }
+
+ public void testPropagateTracingContextNullSpan() {
+ OpenCensusUtils.setPropagationTextFormat(mockTextFormat);
+ try {
+ OpenCensusUtils.propagateTracingContext(null, headers);
+ fail("expected " + IllegalArgumentException.class);
+ } catch (IllegalArgumentException e) {
+ assertEquals(e.getMessage(), "span should not be null.");
+ }
+ }
+
+ public void testPropagateTracingContextNullHeaders() {
+ OpenCensusUtils.setPropagationTextFormat(mockTextFormat);
+ try {
+ OpenCensusUtils.propagateTracingContext(mockSpan, null);
+ fail("expected " + IllegalArgumentException.class);
+ } catch (IllegalArgumentException e) {
+ assertEquals(e.getMessage(), "headers should not be null.");
+ }
+ }
+
+ public void testPropagateTracingContextInvalidSpan() {
+ OpenCensusUtils.setPropagationTextFormat(mockTextFormat);
+ // No injection. No exceptions should be thrown.
+ OpenCensusUtils.propagateTracingContext(BlankSpan.INSTANCE, headers);
+ }
+
+ public void testGetEndSpanOptionsNoResponse() {
+ EndSpanOptions expected = EndSpanOptions.builder().setStatus(Status.UNKNOWN).build();
+ assertEquals(expected, OpenCensusUtils.getEndSpanOptions(null));
+ }
+
+ public void testGetEndSpanOptionsSuccess() {
+ EndSpanOptions expected = EndSpanOptions.builder().setStatus(Status.OK).build();
+ assertEquals(expected, OpenCensusUtils.getEndSpanOptions(200));
+ assertEquals(expected, OpenCensusUtils.getEndSpanOptions(201));
+ assertEquals(expected, OpenCensusUtils.getEndSpanOptions(202));
+ }
+
+ public void testGetEndSpanOptionsBadRequest() {
+ EndSpanOptions expected = EndSpanOptions.builder().setStatus(Status.INVALID_ARGUMENT).build();
+ assertEquals(expected, OpenCensusUtils.getEndSpanOptions(400));
+ }
+
+ public void testGetEndSpanOptionsUnauthorized() {
+ EndSpanOptions expected = EndSpanOptions.builder().setStatus(Status.UNAUTHENTICATED).build();
+ assertEquals(expected, OpenCensusUtils.getEndSpanOptions(401));
+ }
+
+ public void testGetEndSpanOptionsForbidden() {
+ EndSpanOptions expected = EndSpanOptions.builder().setStatus(Status.PERMISSION_DENIED).build();
+ assertEquals(expected, OpenCensusUtils.getEndSpanOptions(403));
+ }
+
+ public void testGetEndSpanOptionsNotFound() {
+ EndSpanOptions expected = EndSpanOptions.builder().setStatus(Status.NOT_FOUND).build();
+ assertEquals(expected, OpenCensusUtils.getEndSpanOptions(404));
+ }
+
+ public void testGetEndSpanOptionsPreconditionFailed() {
+ EndSpanOptions expected = EndSpanOptions.builder().setStatus(Status.FAILED_PRECONDITION).build();
+ assertEquals(expected, OpenCensusUtils.getEndSpanOptions(412));
+ }
+
+ public void testGetEndSpanOptionsServerError() {
+ EndSpanOptions expected = EndSpanOptions.builder().setStatus(Status.UNAVAILABLE).build();
+ assertEquals(expected, OpenCensusUtils.getEndSpanOptions(500));
+ }
+
+ public void testGetEndSpanOptionsOther() {
+ EndSpanOptions expected = EndSpanOptions.builder().setStatus(Status.UNKNOWN).build();
+ // test some random unsupported statuses
+ assertEquals(expected, OpenCensusUtils.getEndSpanOptions(301));
+ assertEquals(expected, OpenCensusUtils.getEndSpanOptions(402));
+ assertEquals(expected, OpenCensusUtils.getEndSpanOptions(501));
+ }
+
+ public void testRecordMessageEventInNullSpan() {
+ try {
+ OpenCensusUtils.recordMessageEvent(null, 0, NetworkEvent.Type.SENT);
+ fail("expected " + IllegalArgumentException.class);
+ } catch (IllegalArgumentException e) {
+ assertEquals(e.getMessage(), "span should not be null.");
+ }
+ }
+
+ public void testRecordMessageEvent() {
+ try {
+ OpenCensusUtils.recordMessageEvent(mockSpan, 0, NetworkEvent.Type.SENT);
+ fail("expected " + UnsupportedOperationException.class);
+ } catch (UnsupportedOperationException e) {
+ assertEquals(e.getMessage(), "Span.addNetworkEvent");
+ }
+ }
+}
diff --git a/pom.xml b/pom.xml
index 2c5d04f17..d4d3e69e6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -274,6 +274,16 @@
j2objc-annotations1.1
+
+ io.opencensus
+ opencensus-api
+ ${project.opencensus.version}
+
+
+ io.opencensus
+ opencensus-contrib-http-util
+ ${project.opencensus.version}
+
@@ -556,6 +566,7 @@
3.2.13.2.14.0.3
+ 0.18.0
From dafa2dd19bd37d3abbfe7b45bc409526ca4b5a6b Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Wed, 2 Jan 2019 11:53:17 -0800
Subject: [PATCH 029/983] Update commons-codec 1.10 -> 1.11 (#552)
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index d4d3e69e6..0ff00d4e2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -559,7 +559,7 @@
26.0-android1.1.4c1.1.1
- 1.10
+ 1.114.5.52.3-eb3.2.2
From c8e27ad2234210c128bec0fdb7c915bc3237f42e Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Wed, 2 Jan 2019 13:13:50 -0800
Subject: [PATCH 030/983] Deprecate JdoDataStoreFactory (#553)
---
.../google/api/client/extensions/jdo/JdoDataStoreFactory.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/google-http-client-jdo/src/main/java/com/google/api/client/extensions/jdo/JdoDataStoreFactory.java b/google-http-client-jdo/src/main/java/com/google/api/client/extensions/jdo/JdoDataStoreFactory.java
index b9743e682..ef1d6cc20 100644
--- a/google-http-client-jdo/src/main/java/com/google/api/client/extensions/jdo/JdoDataStoreFactory.java
+++ b/google-http-client-jdo/src/main/java/com/google/api/client/extensions/jdo/JdoDataStoreFactory.java
@@ -46,7 +46,9 @@
*
* @since 1.16
* @author Yaniv Inbar
+ * @deprecated Please use an alternative like Objectify.
*/
+@Deprecated
public class JdoDataStoreFactory extends AbstractDataStoreFactory {
/** Persistence manager factory. */
From 63380a744d1d6c860779d438fd223e182df6b0d4 Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Wed, 2 Jan 2019 15:42:59 -0800
Subject: [PATCH 031/983] Need to specify versions for antrun-plugin or it
doesn't run (#554)
---
google-http-client/pom.xml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/google-http-client/pom.xml b/google-http-client/pom.xml
index 4b24e0c36..b036147b7 100644
--- a/google-http-client/pom.xml
+++ b/google-http-client/pom.xml
@@ -47,6 +47,7 @@
org.sonatype.pluginsjarjar-maven-plugin
+ 1.9package
@@ -77,6 +78,7 @@
maven-antrun-plugin
+ 1.8
From 19f6756fc960a02937cb9a94ca1ddeec03f8d2dc Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Wed, 2 Jan 2019 15:43:09 -0800
Subject: [PATCH 032/983] Use maven enforcer plugin for maven version
requirements (#555)
---
pom.xml | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 0ff00d4e2..8ec73aa68 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,10 +22,6 @@
2011
-
- 3.5.4
-
-
scm:git:https://github.com/googleapis/google-http-java-client.gitscm:git:git@github.com:googleapis/google-http-java-client.git
@@ -401,6 +397,25 @@
+
+ org.apache.maven.plugins
+ maven-enforcer-plugin
+ 3.0.0-M2
+
+ enforce-maven
+
+ enforce
+
+
+
+
+ [3.5.4,4.0.0)
+
+
+
+
+
+ maven-javadoc-plugin
From 44777a984e28c50bccc700a410391b56efc330b0 Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Wed, 2 Jan 2019 15:43:15 -0800
Subject: [PATCH 033/983] Update OpenCensus deprecations (#556)
---
.../google/api/client/util/OpenCensusUtils.java | 16 ++++++++--------
.../api/client/util/OpenCensusUtilsTest.java | 14 ++++++--------
2 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/google-http-client/src/main/java/com/google/api/client/util/OpenCensusUtils.java b/google-http-client/src/main/java/com/google/api/client/util/OpenCensusUtils.java
index c2a2cc000..a636dc7cc 100644
--- a/google-http-client/src/main/java/com/google/api/client/util/OpenCensusUtils.java
+++ b/google-http-client/src/main/java/com/google/api/client/util/OpenCensusUtils.java
@@ -22,8 +22,8 @@
import io.opencensus.contrib.http.util.HttpPropagationUtil;
import io.opencensus.trace.BlankSpan;
import io.opencensus.trace.EndSpanOptions;
-import io.opencensus.trace.NetworkEvent;
-import io.opencensus.trace.NetworkEvent.Type;
+import io.opencensus.trace.MessageEvent;
+import io.opencensus.trace.MessageEvent.Type;
import io.opencensus.trace.Span;
import io.opencensus.trace.Status;
import io.opencensus.trace.Tracer;
@@ -40,7 +40,7 @@
* Utilities for Census monitoring and tracing.
*
* @author Hailong Wen
- * @since 1.24
+ * @since 1.28
*/
public class OpenCensusUtils {
@@ -213,12 +213,12 @@ public static void recordSentMessageEvent(Span span, long size) {
* @param size Size of the response.
*/
public static void recordReceivedMessageEvent(Span span, long size) {
- recordMessageEvent(span, size, Type.RECV);
+ recordMessageEvent(span, size, Type.RECEIVED);
}
/**
- * Records a message event of a certain {@link NetworkEvent.Type}. This method is package
- * protected since {@link NetworkEvent} might be deprecated in future releases.
+ * Records a message event of a certain {@link MessageEvent.Type}. This method is package
+ * protected since {@link MessageEvent} might be deprecated in future releases.
*
* @param span The {@code span} in which the event occurs.
* @param size Size of the message.
@@ -230,11 +230,11 @@ static void recordMessageEvent(Span span, long size, Type eventType) {
if (size < 0) {
size = 0;
}
- NetworkEvent event = NetworkEvent
+ MessageEvent event = MessageEvent
.builder(eventType, idGenerator.getAndIncrement())
.setUncompressedMessageSize(size)
.build();
- span.addNetworkEvent(event);
+ span.addMessageEvent(event);
}
static {
diff --git a/google-http-client/src/test/java/com/google/api/client/util/OpenCensusUtilsTest.java b/google-http-client/src/test/java/com/google/api/client/util/OpenCensusUtilsTest.java
index 069b051ec..f3c850ca7 100644
--- a/google-http-client/src/test/java/com/google/api/client/util/OpenCensusUtilsTest.java
+++ b/google-http-client/src/test/java/com/google/api/client/util/OpenCensusUtilsTest.java
@@ -21,7 +21,7 @@
import io.opencensus.trace.Annotation;
import io.opencensus.trace.AttributeValue;
import io.opencensus.trace.Link;
-import io.opencensus.trace.NetworkEvent;
+import io.opencensus.trace.MessageEvent;
import io.opencensus.trace.Span;
import io.opencensus.trace.SpanContext;
import io.opencensus.trace.Status;
@@ -30,8 +30,6 @@
import java.util.List;
import java.util.Map;
import junit.framework.TestCase;
-import org.junit.Assert;
-import org.junit.Rule;
/**
* Tests {@link OpenCensusUtils}.
@@ -87,8 +85,8 @@ public void addAnnotation(String description, Map attrib
public void addAnnotation(Annotation annotation) {}
@Override
- public void addNetworkEvent(NetworkEvent event) {
- throw new UnsupportedOperationException("Span.addNetworkEvent");
+ public void addMessageEvent(MessageEvent event) {
+ throw new UnsupportedOperationException("Span.addMessageEvent");
}
@Override
@@ -221,7 +219,7 @@ public void testGetEndSpanOptionsOther() {
public void testRecordMessageEventInNullSpan() {
try {
- OpenCensusUtils.recordMessageEvent(null, 0, NetworkEvent.Type.SENT);
+ OpenCensusUtils.recordMessageEvent(null, 0, MessageEvent.Type.SENT);
fail("expected " + IllegalArgumentException.class);
} catch (IllegalArgumentException e) {
assertEquals(e.getMessage(), "span should not be null.");
@@ -230,10 +228,10 @@ public void testRecordMessageEventInNullSpan() {
public void testRecordMessageEvent() {
try {
- OpenCensusUtils.recordMessageEvent(mockSpan, 0, NetworkEvent.Type.SENT);
+ OpenCensusUtils.recordMessageEvent(mockSpan, 0, MessageEvent.Type.SENT);
fail("expected " + UnsupportedOperationException.class);
} catch (UnsupportedOperationException e) {
- assertEquals(e.getMessage(), "Span.addNetworkEvent");
+ assertEquals(e.getMessage(), "Span.addMessageEvent");
}
}
}
From 052f17827482c8b45b4336837bb59cd11bf69d71 Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Thu, 3 Jan 2019 14:03:55 -0800
Subject: [PATCH 034/983] Fix iterable maps JSON serialization (#550)
* Add common generator tests for the iterable map and normal map
* Make json serialization treat maps as maps, always.
Even if they are iterable, like clojure maps.
* Fix compilation on Java 7
* only add one map entry to prevent ordering test failure
---
.../client/json/gson/GsonGeneratorTest.java | 30 ++++++++++
.../json/jackson/JacksonGeneratorTest.java | 30 ++++++++++
.../json/jackson2/JacksonGeneratorTest.java | 30 ++++++++++
.../test/json/AbstractJsonGeneratorTest.java | 60 +++++++++++++++++++
.../google/api/client/json/JsonGenerator.java | 3 +-
5 files changed, 152 insertions(+), 1 deletion(-)
create mode 100644 google-http-client-gson/src/test/java/com/google/api/client/json/gson/GsonGeneratorTest.java
create mode 100644 google-http-client-jackson/src/test/java/com/google/api/client/json/jackson/JacksonGeneratorTest.java
create mode 100644 google-http-client-jackson2/src/test/java/com/google/api/client/json/jackson2/JacksonGeneratorTest.java
create mode 100644 google-http-client-test/src/main/java/com/google/api/client/test/json/AbstractJsonGeneratorTest.java
diff --git a/google-http-client-gson/src/test/java/com/google/api/client/json/gson/GsonGeneratorTest.java b/google-http-client-gson/src/test/java/com/google/api/client/json/gson/GsonGeneratorTest.java
new file mode 100644
index 000000000..caa543836
--- /dev/null
+++ b/google-http-client-gson/src/test/java/com/google/api/client/json/gson/GsonGeneratorTest.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 Google Inc.
+ *
+ * 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.json.gson;
+
+import com.google.api.client.json.JsonGenerator;
+import com.google.api.client.test.json.AbstractJsonGeneratorTest;
+import java.io.IOException;
+import java.io.Writer;
+
+public class GsonGeneratorTest extends AbstractJsonGeneratorTest {
+
+ private static final GsonFactory FACTORY = new GsonFactory();
+
+ @Override
+ protected JsonGenerator newGenerator(Writer writer) throws IOException {
+ return FACTORY.createJsonGenerator(writer);
+ }
+}
diff --git a/google-http-client-jackson/src/test/java/com/google/api/client/json/jackson/JacksonGeneratorTest.java b/google-http-client-jackson/src/test/java/com/google/api/client/json/jackson/JacksonGeneratorTest.java
new file mode 100644
index 000000000..bfdfbfe28
--- /dev/null
+++ b/google-http-client-jackson/src/test/java/com/google/api/client/json/jackson/JacksonGeneratorTest.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 Google Inc.
+ *
+ * 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.json.jackson;
+
+import com.google.api.client.json.JsonGenerator;
+import com.google.api.client.test.json.AbstractJsonGeneratorTest;
+import java.io.IOException;
+import java.io.Writer;
+
+public class JacksonGeneratorTest extends AbstractJsonGeneratorTest {
+
+ private static final JacksonFactory FACTORY = new JacksonFactory();
+
+ @Override
+ protected JsonGenerator newGenerator(Writer writer) throws IOException {
+ return FACTORY.createJsonGenerator(writer);
+ }
+}
diff --git a/google-http-client-jackson2/src/test/java/com/google/api/client/json/jackson2/JacksonGeneratorTest.java b/google-http-client-jackson2/src/test/java/com/google/api/client/json/jackson2/JacksonGeneratorTest.java
new file mode 100644
index 000000000..4b0af8478
--- /dev/null
+++ b/google-http-client-jackson2/src/test/java/com/google/api/client/json/jackson2/JacksonGeneratorTest.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 Google Inc.
+ *
+ * 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.json.jackson2;
+
+import com.google.api.client.json.JsonGenerator;
+import com.google.api.client.test.json.AbstractJsonGeneratorTest;
+import java.io.IOException;
+import java.io.Writer;
+
+public class JacksonGeneratorTest extends AbstractJsonGeneratorTest {
+
+ private static final JacksonFactory FACTORY = new JacksonFactory();
+
+ @Override
+ protected JsonGenerator newGenerator(Writer writer) throws IOException {
+ return FACTORY.createJsonGenerator(writer);
+ }
+}
diff --git a/google-http-client-test/src/main/java/com/google/api/client/test/json/AbstractJsonGeneratorTest.java b/google-http-client-test/src/main/java/com/google/api/client/test/json/AbstractJsonGeneratorTest.java
new file mode 100644
index 000000000..0f92bc10f
--- /dev/null
+++ b/google-http-client-test/src/main/java/com/google/api/client/test/json/AbstractJsonGeneratorTest.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2018 Google Inc.
+ *
+ * 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.test.json;
+
+import com.google.api.client.json.JsonGenerator;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import junit.framework.TestCase;
+
+public abstract class AbstractJsonGeneratorTest extends TestCase {
+
+ protected abstract JsonGenerator newGenerator(Writer writer) throws IOException;
+
+ class IterableMap extends HashMap implements Iterable> {
+ @Override
+ public Iterator> iterator() {
+ return entrySet().iterator();
+ }
+ }
+
+ public void testSerialize_simpleMap() throws Exception {
+ StringWriter writer = new StringWriter();
+ JsonGenerator generator = newGenerator(writer);
+
+ Map m = new HashMap();
+ m.put("a", "b");
+
+ generator.serialize(m);
+ generator.close();
+ assertEquals("{\"a\":\"b\"}", writer.toString());
+ }
+
+ public void testSerialize_iterableMap() throws Exception {
+ StringWriter writer = new StringWriter();
+ JsonGenerator generator = newGenerator(writer);
+
+ Map m = new IterableMap();
+ m.put("a", "b");
+
+ generator.serialize(m);
+ generator.close();
+ assertEquals("{\"a\":\"b\"}", writer.toString());
+ }
+}
diff --git a/google-http-client/src/main/java/com/google/api/client/json/JsonGenerator.java b/google-http-client/src/main/java/com/google/api/client/json/JsonGenerator.java
index b37ac6ced..717a1a58d 100644
--- a/google-http-client/src/main/java/com/google/api/client/json/JsonGenerator.java
+++ b/google-http-client/src/main/java/com/google/api/client/json/JsonGenerator.java
@@ -141,7 +141,8 @@ private void serialize(boolean isJsonString, Object value) throws IOException {
writeBoolean((Boolean) value);
} else if (value instanceof DateTime) {
writeString(((DateTime) value).toStringRfc3339());
- } else if (value instanceof Iterable> || valueClass.isArray()) {
+ } else if ((value instanceof Iterable> || valueClass.isArray()) &&
+ !(value instanceof Map, ?>) && !(value instanceof GenericData)) {
writeStartArray();
for (Object o : Types.iterableOf(value)) {
serialize(isJsonString, o);
From 34f0427c213c05ec650c45952efd28bf3da9424c Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Fri, 4 Jan 2019 10:14:46 -0800
Subject: [PATCH 035/983] Allow users to override handleResponse on
HttpBackOffUnsuccessfulResponseHandler (#560)
---
.../api/client/http/HttpBackOffUnsuccessfulResponseHandler.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/google-http-client/src/main/java/com/google/api/client/http/HttpBackOffUnsuccessfulResponseHandler.java b/google-http-client/src/main/java/com/google/api/client/http/HttpBackOffUnsuccessfulResponseHandler.java
index 23039ff16..82f35fad9 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/HttpBackOffUnsuccessfulResponseHandler.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/HttpBackOffUnsuccessfulResponseHandler.java
@@ -136,7 +136,7 @@ public HttpBackOffUnsuccessfulResponseHandler setSleeper(Sleeper sleeper) {
* {@link Sleeper#sleep(long)} will be made.
*
*/
- public final boolean handleResponse(
+ public boolean handleResponse(
HttpRequest request, HttpResponse response, boolean supportsRetry) throws IOException {
if (!supportsRetry) {
return false;
From 280117fbc1a166f525d562b490b113d3d362fe0a Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Fri, 4 Jan 2019 10:45:00 -0800
Subject: [PATCH 036/983] Provide STAGING_REPOSITORY_ID as an environment
variable (#561)
---
.kokoro/release/drop.sh | 11 +++++++++--
.kokoro/release/promote.sh | 11 ++++++++++-
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/.kokoro/release/drop.sh b/.kokoro/release/drop.sh
index abc381e5d..5c4551efa 100755
--- a/.kokoro/release/drop.sh
+++ b/.kokoro/release/drop.sh
@@ -15,11 +15,18 @@
set -eo pipefail
-source $(dirname "$0")/common.sh
+# STAGING_REPOSITORY_ID must be set
+if [ -z "${STAGING_REPOSITORY_ID}" ]; then
+ echo "Missing STAGING_REPOSITORY_ID environment variable"
+ exit 1
+fi
+source $(dirname "$0")/common.sh
pushd $(dirname "$0")/../../
setup_environment_secrets
create_settings_xml_file "settings.xml"
-mvn nexus-staging:drop --settings=settings.xml
+mvn nexus-staging:drop -B \
+ --settings=settings.xml \
+ -DstagingRepositoryId=${STAGING_REPOSITORY_ID}
diff --git a/.kokoro/release/promote.sh b/.kokoro/release/promote.sh
index 439e0fc3e..1fa95fa53 100755
--- a/.kokoro/release/promote.sh
+++ b/.kokoro/release/promote.sh
@@ -15,6 +15,12 @@
set -eo pipefail
+# STAGING_REPOSITORY_ID must be set
+if [ -z "${STAGING_REPOSITORY_ID}" ]; then
+ echo "Missing STAGING_REPOSITORY_ID environment variable"
+ exit 1
+fi
+
source $(dirname "$0")/common.sh
pushd $(dirname "$0")/../../
@@ -22,4 +28,7 @@ pushd $(dirname "$0")/../../
setup_environment_secrets
create_settings_xml_file "settings.xml"
-mvn nexus-staging:release -DperformRelease=true --settings=settings.xml
+mvn nexus-staging:release -B \
+ -DperformRelease=true \
+ --settings=settings.xml \
+ -DstagingRepositoryId=${STAGING_REPOSITORY_ID}
From 3d7f17c1acd5d8d6e50488ee7c6d047ba614ec11 Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Fri, 4 Jan 2019 11:30:13 -0800
Subject: [PATCH 037/983] Update ApacheHttpTransport implementation (#558)
* Move apache httpclient dependency to apache adapter artifacts
* Rewrite Apache adapter to use new APIs
* Cleanup apache implementations
* Fix tests
* Fix checkstyle
* Fix dependencies - google-http-client does depend on commons-codec
* Publish both apache adapters as google-http-client-apache with version 1.x and 2.0
* Fix dependency versions
* Remove ApacheHttpTransport.Builder for 2.0
We are providing a subset of builder options and we cannot change
setting after the HttpClient has been built. We should allow users to
just provide their implementation via the constructor.
* Allow `shutdown` to throw the IOException from closing the httpClient
---
google-http-client-apache-legacy/pom.xml | 9 +-
google-http-client-apache/pom.xml | 6 +-
.../client/http/apache/ApacheHttpRequest.java | 14 +-
.../http/apache/ApacheHttpTransport.java | 313 +++---------------
.../apache/SSLSocketFactoryExtension.java | 61 ----
.../http/apache/ApacheHttpTransportTest.java | 111 +++++--
google-http-client-bom/pom.xml | 2 +-
google-http-client/pom.xml | 5 -
pom.xml | 25 +-
versions.txt | 2 +-
10 files changed, 168 insertions(+), 380 deletions(-)
delete mode 100644 google-http-client-apache/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java
diff --git a/google-http-client-apache-legacy/pom.xml b/google-http-client-apache-legacy/pom.xml
index 3914fc251..8c19415a0 100644
--- a/google-http-client-apache-legacy/pom.xml
+++ b/google-http-client-apache-legacy/pom.xml
@@ -7,9 +7,9 @@
1.27.1-SNAPSHOT../pom.xml
- google-http-client-apache-legacy
+ google-http-client-apache1.27.1-SNAPSHOT
- Apache HTTP transport for the Google HTTP Client Library for Java.
+ Legacy Apache HTTP transport for the Google HTTP Client Library for Java.
@@ -102,6 +102,11 @@
guavatest
+
+ org.apache.httpcomponents
+ httpclient
+ 4.2.6
+ org.mockitomockito-all
diff --git a/google-http-client-apache/pom.xml b/google-http-client-apache/pom.xml
index 6a40174c5..bafdc0375 100644
--- a/google-http-client-apache/pom.xml
+++ b/google-http-client-apache/pom.xml
@@ -8,7 +8,7 @@
../pom.xmlgoogle-http-client-apache
- 1.27.1-SNAPSHOT
+ 2.0.1-SNAPSHOTApache HTTP transport for the Google HTTP Client Library for Java.
@@ -102,6 +102,10 @@
guavatest
+
+ org.apache.httpcomponents
+ httpclient
+ org.mockitomockito-all
diff --git a/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java b/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java
index b31b20594..f498b7150 100644
--- a/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java
+++ b/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java
@@ -20,10 +20,8 @@
import java.io.IOException;
import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.client.HttpClient;
+import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpRequestBase;
-import org.apache.http.conn.params.ConnManagerParams;
-import org.apache.http.params.HttpConnectionParams;
-import org.apache.http.params.HttpParams;
/**
* @author Yaniv Inbar
@@ -33,9 +31,12 @@ final class ApacheHttpRequest extends LowLevelHttpRequest {
private final HttpRequestBase request;
+ private RequestConfig.Builder requestConfig;
+
ApacheHttpRequest(HttpClient httpClient, HttpRequestBase request) {
this.httpClient = httpClient;
this.request = request;
+ this.requestConfig = RequestConfig.custom().setRedirectsEnabled(false);
}
@Override
@@ -45,10 +46,8 @@ public void addHeader(String name, String value) {
@Override
public void setTimeout(int connectTimeout, int readTimeout) throws IOException {
- HttpParams params = request.getParams();
- ConnManagerParams.setTimeout(params, connectTimeout);
- HttpConnectionParams.setConnectionTimeout(params, connectTimeout);
- HttpConnectionParams.setSoTimeout(params, readTimeout);
+ requestConfig.setConnectionRequestTimeout(connectTimeout)
+ .setSocketTimeout(readTimeout);
}
@Override
@@ -62,6 +61,7 @@ public LowLevelHttpResponse execute() throws IOException {
entity.setContentType(getContentType());
((HttpEntityEnclosingRequest) request).setEntity(entity);
}
+ request.setConfig(requestConfig.build());
return new ApacheHttpResponse(request, httpClient.execute(request));
}
}
diff --git a/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java b/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
index 0b55a4ed0..ecc7e0c13 100644
--- a/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
+++ b/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
@@ -15,9 +15,7 @@
package com.google.api.client.http.apache;
import com.google.api.client.http.HttpMethods;
-import com.google.api.client.http.HttpRequest;
import com.google.api.client.http.HttpTransport;
-import com.google.api.client.util.Beta;
import com.google.api.client.util.Preconditions;
import com.google.api.client.util.SecurityUtils;
import com.google.api.client.util.SslUtils;
@@ -27,9 +25,8 @@
import java.security.GeneralSecurityException;
import java.security.KeyStore;
import java.security.cert.CertificateFactory;
+import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLContext;
-import org.apache.http.HttpHost;
-import org.apache.http.HttpVersion;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
@@ -40,24 +37,12 @@
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.methods.HttpTrace;
-import org.apache.http.client.params.ClientPNames;
-import org.apache.http.conn.ClientConnectionManager;
-import org.apache.http.conn.params.ConnManagerParams;
-import org.apache.http.conn.params.ConnPerRouteBean;
-import org.apache.http.conn.params.ConnRouteParams;
-import org.apache.http.conn.scheme.PlainSocketFactory;
-import org.apache.http.conn.scheme.Scheme;
-import org.apache.http.conn.scheme.SchemeRegistry;
-import org.apache.http.conn.ssl.SSLSocketFactory;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
-import org.apache.http.impl.conn.DefaultHttpRoutePlanner;
-import org.apache.http.impl.conn.ProxySelectorRoutePlanner;
-import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
-import org.apache.http.params.BasicHttpParams;
-import org.apache.http.params.HttpConnectionParams;
-import org.apache.http.params.HttpParams;
-import org.apache.http.params.HttpProtocolParams;
+import org.apache.http.config.SocketConfig;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
+import org.apache.http.impl.conn.SystemDefaultRoutePlanner;
/**
* Thread-safe HTTP transport based on the Apache HTTP Client library.
@@ -71,8 +56,7 @@
*
* Default settings are specified in {@link #newDefaultHttpClient()}. Use the
* {@link #ApacheHttpTransport(HttpClient)} constructor to override the Apache HTTP Client used.
- * Alternatively, use {@link #ApacheHttpTransport()} and change the {@link #getHttpClient()}. Please
- * read the Apache HTTP
* Client connection management tutorial for more complex configuration options.
*
@@ -88,10 +72,6 @@ public final class ApacheHttpTransport extends HttpTransport {
/**
* Constructor that uses {@link #newDefaultHttpClient()} for the Apache HTTP client.
*
- *
- * Use {@link Builder} to modify HTTP client options.
- *
- *
* @since 1.3
*/
public ApacheHttpTransport() {
@@ -102,34 +82,23 @@ public ApacheHttpTransport() {
* Constructor that allows an alternative Apache HTTP client to be used.
*
*
- * Note that a few settings are overridden:
+ * Note that in the previous version, we tried overrode several settings, however, we are no
+ * longer able to do so.
*
+ *
+ *
If you choose to provide your own Apache HttpClient implementation, be sure that
*
- *
HTTP version is set to 1.1 using {@link HttpProtocolParams#setVersion} with
- * {@link HttpVersion#HTTP_1_1}.
- *
Redirects are disabled using {@link ClientPNames#HANDLE_REDIRECTS}.
- *
{@link ConnManagerParams#setTimeout} and {@link HttpConnectionParams#setConnectionTimeout}
- * are set on each request based on {@link HttpRequest#getConnectTimeout()}.
- *
{@link HttpConnectionParams#setSoTimeout} is set on each request based on
- * {@link HttpRequest#getReadTimeout()}.
+ *
HTTP version is set to 1.1.
+ *
Redirects are disabled (google-http-client handles redirects).
+ *
Retries are disabled (google-http-client handles retries).
*
*
- *
- * Use {@link Builder} for a more user-friendly way to modify the HTTP client options.
- *
- * Use this constructor if you want to customize the default Apache HTTP client. Settings:
+ * Settings:
*
*
- *
The client connection manager is set to {@link ThreadSafeClientConnManager}.
- *
The socket buffer size is set to 8192 using
- * {@link HttpConnectionParams#setSocketBufferSize}.
- *
- *
The route planner uses {@link ProxySelectorRoutePlanner} with
+ *
The client connection manager is set to {@link PoolingHttpClientConnectionManager}.
+ *
The socket buffer size is set to 8192 using {@link SocketConfig}.
+ *
+ *
The route planner uses {@link SystemDefaultRoutePlanner} with
* {@link ProxySelector#getDefault()}, which uses the proxy settings from system
* properties.
*
*
* @return new instance of the Apache HTTP client
- * @since 1.6
- */
- public static DefaultHttpClient newDefaultHttpClient() {
- return newDefaultHttpClient(
- SSLSocketFactory.getSocketFactory(), newDefaultHttpParams(), ProxySelector.getDefault());
- }
-
- /** Returns a new instance of the default HTTP parameters we use. */
- static HttpParams newDefaultHttpParams() {
- HttpParams params = new BasicHttpParams();
- // Turn off stale checking. Our connections break all the time anyway,
- // and it's not worth it to pay the penalty of checking every time.
- HttpConnectionParams.setStaleCheckingEnabled(params, false);
- HttpConnectionParams.setSocketBufferSize(params, 8192);
- ConnManagerParams.setMaxTotalConnections(params, 200);
- ConnManagerParams.setMaxConnectionsPerRoute(params, new ConnPerRouteBean(20));
- return params;
- }
-
- /**
- * Creates a new instance of the Apache HTTP client that is used by the
- * {@link #ApacheHttpTransport()} constructor.
- *
- * @param socketFactory SSL socket factory
- * @param params HTTP parameters
- * @param proxySelector HTTP proxy selector to use {@link ProxySelectorRoutePlanner} or
- * {@code null} for {@link DefaultHttpRoutePlanner}
- * @return new instance of the Apache HTTP client
+ * @since 2.0
*/
- static DefaultHttpClient newDefaultHttpClient(
- SSLSocketFactory socketFactory, HttpParams params, ProxySelector proxySelector) {
- // See http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html
- SchemeRegistry registry = new SchemeRegistry();
- registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
- registry.register(new Scheme("https", socketFactory, 443));
- ClientConnectionManager connectionManager = new ThreadSafeClientConnManager(params, registry);
- DefaultHttpClient defaultHttpClient = new DefaultHttpClient(connectionManager, params);
- defaultHttpClient.setHttpRequestRetryHandler(new DefaultHttpRequestRetryHandler(0, false));
- if (proxySelector != null) {
- defaultHttpClient.setRoutePlanner(new ProxySelectorRoutePlanner(registry, proxySelector));
- }
- return defaultHttpClient;
+ public static HttpClient newDefaultHttpClient() {
+ // Set socket buffer sizes to 8192
+ SocketConfig socketConfig =
+ SocketConfig.custom()
+ .setRcvBufSize(8192)
+ .setSndBufSize(8192)
+ .build();
+
+ PoolingHttpClientConnectionManager connectionManager =
+ new PoolingHttpClientConnectionManager(-1, TimeUnit.MILLISECONDS);
+ // Disable the stale connection check (previously configured in the HttpConnectionParams
+ connectionManager.setValidateAfterInactivity(-1);
+
+ return HttpClientBuilder.create()
+ .useSystemProperties()
+ .setSSLSocketFactory(SSLConnectionSocketFactory.getSocketFactory())
+ .setDefaultSocketConfig(socketConfig)
+ .setMaxConnTotal(200)
+ .setMaxConnPerRoute(20)
+ .setRoutePlanner(new SystemDefaultRoutePlanner(ProxySelector.getDefault()))
+ .setConnectionManager(connectionManager)
+ .disableRedirectHandling()
+ .disableAutomaticRetries()
+ .build();
}
@Override
@@ -233,8 +185,10 @@ protected ApacheHttpRequest buildRequest(String method, String url) {
* @since 1.4
*/
@Override
- public void shutdown() {
- httpClient.getConnectionManager().shutdown();
+ public void shutdown() throws IOException {
+ if (httpClient instanceof CloseableHttpClient) {
+ ((CloseableHttpClient) httpClient).close();
+ }
}
/**
@@ -245,171 +199,4 @@ public void shutdown() {
public HttpClient getHttpClient() {
return httpClient;
}
-
- /**
- * Builder for {@link ApacheHttpTransport}.
- *
- *
- * Implementation is not thread-safe.
- *
- *
- * @since 1.13
- */
- public static final class Builder {
-
- /** SSL socket factory. */
- private SSLSocketFactory socketFactory = SSLSocketFactory.getSocketFactory();
-
- /** HTTP parameters. */
- private HttpParams params = newDefaultHttpParams();
-
- /**
- * HTTP proxy selector to use {@link ProxySelectorRoutePlanner} or {@code null} for
- * {@link DefaultHttpRoutePlanner}.
- */
- private ProxySelector proxySelector = ProxySelector.getDefault();
-
- /**
- * Sets the HTTP proxy to use {@link DefaultHttpRoutePlanner} or {@code null} to use
- * {@link #setProxySelector(ProxySelector)} with {@link ProxySelector#getDefault()}.
- *
- *
- * By default it is {@code null}, which uses the proxy settings from system
- * properties.
- *
- *
- *
- * For example:
- *
- *
- *
- setProxy(new HttpHost("127.0.0.1", 8080))
- *
- */
- public Builder setProxy(HttpHost proxy) {
- ConnRouteParams.setDefaultProxy(params, proxy);
- if (proxy != null) {
- proxySelector = null;
- }
- return this;
- }
-
- /**
- * Sets the HTTP proxy selector to use {@link ProxySelectorRoutePlanner} or {@code null} for
- * {@link DefaultHttpRoutePlanner}.
- *
- *
- * By default it is {@link ProxySelector#getDefault()} which uses the proxy settings from system
- * properties.
- *
- */
- public Builder setProxySelector(ProxySelector proxySelector) {
- this.proxySelector = proxySelector;
- if (proxySelector != null) {
- ConnRouteParams.setDefaultProxy(params, null);
- }
- return this;
- }
- /**
- * Sets the SSL socket factory based on root certificates in a Java KeyStore.
- *
- *
- *
- * @param certificateStream certificate stream
- * @since 1.14
- */
- public Builder trustCertificatesFromStream(InputStream certificateStream)
- throws GeneralSecurityException, IOException {
- KeyStore trustStore = SecurityUtils.getJavaKeyStore();
- trustStore.load(null, null);
- SecurityUtils.loadKeyStoreFromCertificates(
- trustStore, SecurityUtils.getX509CertificateFactory(), certificateStream);
- return trustCertificates(trustStore);
- }
-
- /**
- * Sets the SSL socket factory based on a root certificate trust store.
- *
- * @param trustStore certificate trust store (use for example {@link SecurityUtils#loadKeyStore}
- * or {@link SecurityUtils#loadKeyStoreFromCertificates})
- *
- * @since 1.14
- */
- public Builder trustCertificates(KeyStore trustStore) throws GeneralSecurityException {
- SSLContext sslContext = SslUtils.getTlsSslContext();
- SslUtils.initSslContext(sslContext, trustStore, SslUtils.getPkixTrustManagerFactory());
- return setSocketFactory(new SSLSocketFactoryExtension(sslContext));
- }
-
- /**
- * {@link Beta}
- * Disables validating server SSL certificates by setting the SSL socket factory using
- * {@link SslUtils#trustAllSSLContext()} for the SSL context and
- * {@link SSLSocketFactory#ALLOW_ALL_HOSTNAME_VERIFIER} for the host name verifier.
- *
- *
- * Be careful! Disabling certificate validation is dangerous and should only be done in testing
- * environments.
- *
- */
- @Beta
- public Builder doNotValidateCertificate() throws GeneralSecurityException {
- socketFactory = new SSLSocketFactoryExtension(SslUtils.trustAllSSLContext());
- socketFactory.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
- return this;
- }
-
- /** Sets the SSL socket factory ({@link SSLSocketFactory#getSocketFactory()} by default). */
- public Builder setSocketFactory(SSLSocketFactory socketFactory) {
- this.socketFactory = Preconditions.checkNotNull(socketFactory);
- return this;
- }
-
- /** Returns the SSL socket factory ({@link SSLSocketFactory#getSocketFactory()} by default). */
- public SSLSocketFactory getSSLSocketFactory() {
- return socketFactory;
- }
-
- /** Returns the HTTP parameters. */
- public HttpParams getHttpParams() {
- return params;
- }
-
- /** Returns a new instance of {@link ApacheHttpTransport} based on the options. */
- public ApacheHttpTransport build() {
- return new ApacheHttpTransport(newDefaultHttpClient(socketFactory, params, proxySelector));
- }
- }
}
diff --git a/google-http-client-apache/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java b/google-http-client-apache/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java
deleted file mode 100644
index 3d507371b..000000000
--- a/google-http-client-apache/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2013 Google Inc.
- *
- * 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;
-
-import java.io.IOException;
-import java.net.Socket;
-import java.net.UnknownHostException;
-import java.security.KeyManagementException;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.UnrecoverableKeyException;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSocket;
-import org.apache.http.conn.ssl.SSLSocketFactory;
-
-/**
- * Implementation of SSL socket factory that extends Apache's implementation to provide
- * functionality missing from the Android SDK that is available in Apache HTTP Client.
- *
- * @author Yaniv Inbar
- */
-final class SSLSocketFactoryExtension extends SSLSocketFactory {
-
- /** Wrapped Java SSL socket factory. */
- private final javax.net.ssl.SSLSocketFactory socketFactory;
-
- /**
- * @param sslContext SSL context
- */
- SSLSocketFactoryExtension(SSLContext sslContext) throws KeyManagementException,
- UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException {
- super((KeyStore) null);
- socketFactory = sslContext.getSocketFactory();
- }
-
- @Override
- public Socket createSocket() throws IOException {
- return socketFactory.createSocket();
- }
-
- @Override
- public Socket createSocket(Socket socket, String host, int port, boolean autoClose)
- throws IOException, UnknownHostException {
- SSLSocket sslSocket = (SSLSocket) socketFactory.createSocket(socket, host, port, autoClose);
- getHostnameVerifier().verify(host, sslSocket);
- return sslSocket;
- }
-}
diff --git a/google-http-client-apache/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java b/google-http-client-apache/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java
index 07f6c29c7..ef46084fe 100644
--- a/google-http-client-apache/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java
+++ b/google-http-client-apache/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java
@@ -14,48 +14,73 @@
package com.google.api.client.http.apache;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+import com.google.api.client.http.LowLevelHttpResponse;
import com.google.api.client.util.ByteArrayStreamingContent;
import com.google.api.client.util.StringUtils;
-import junit.framework.TestCase;
+import java.io.IOException;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.http.Header;
+import org.apache.http.HttpClientConnection;
+import org.apache.http.HttpException;
+import org.apache.http.HttpRequest;
+import org.apache.http.HttpRequestInterceptor;
import org.apache.http.HttpResponse;
import org.apache.http.HttpVersion;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpUriRequest;
-import org.apache.http.client.params.ClientPNames;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
-import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
-import org.apache.http.params.CoreConnectionPNames;
-import org.apache.http.params.HttpParams;
-import org.apache.http.params.HttpProtocolParams;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicHttpResponse;
+import org.apache.http.protocol.HttpContext;
+import org.apache.http.protocol.HttpRequestExecutor;
+import org.junit.Test;
/**
* Tests {@link ApacheHttpTransport}.
*
* @author Yaniv Inbar
*/
-public class ApacheHttpTransportTest extends TestCase {
+public class ApacheHttpTransportTest {
+ @Test
public void testApacheHttpTransport() {
ApacheHttpTransport transport = new ApacheHttpTransport();
- DefaultHttpClient httpClient = (DefaultHttpClient) transport.getHttpClient();
- checkDefaultHttpClient(httpClient);
- checkHttpClient(httpClient);
+ checkHttpTransport(transport);
}
+ @Test
public void testApacheHttpTransportWithParam() {
- ApacheHttpTransport transport = new ApacheHttpTransport(new DefaultHttpClient());
- checkHttpClient(transport.getHttpClient());
+ ApacheHttpTransport transport = new ApacheHttpTransport(HttpClients.custom().build());
+ checkHttpTransport(transport);
}
+ @Test
public void testNewDefaultHttpClient() {
- checkDefaultHttpClient(ApacheHttpTransport.newDefaultHttpClient());
+ HttpClient client = ApacheHttpTransport.newDefaultHttpClient();
+ checkHttpClient(client);
}
+ private void checkHttpTransport(ApacheHttpTransport transport) {
+ assertNotNull(transport);
+ HttpClient client = transport.getHttpClient();
+ checkHttpClient(client);
+ }
+
+ private void checkHttpClient(HttpClient client) {
+ assertNotNull(client);
+ // TODO(chingor): Is it possible to test this effectively? The newer HttpClient implementations
+ // are read-only and we're testing that we built the client with the right configuration
+ }
+
+ @Test
public void testRequestsWithContent() throws Exception {
HttpClient mockClient = mock(HttpClient.class);
HttpResponse mockResponse = mock(HttpResponse.class);
@@ -103,19 +128,51 @@ private void execute(ApacheHttpRequest request) throws Exception {
request.execute();
}
- private void checkDefaultHttpClient(DefaultHttpClient client) {
- HttpParams params = client.getParams();
- assertTrue(client.getConnectionManager() instanceof ThreadSafeClientConnManager);
- assertEquals(8192, params.getIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, -1));
- DefaultHttpRequestRetryHandler retryHandler =
- (DefaultHttpRequestRetryHandler) client.getHttpRequestRetryHandler();
- assertEquals(0, retryHandler.getRetryCount());
- assertFalse(retryHandler.isRequestSentRetryEnabled());
+ @Test
+ public void testRequestShouldNotFollowRedirects() throws IOException {
+ final AtomicInteger requestsAttempted = new AtomicInteger(0);
+ HttpRequestExecutor requestExecutor = new HttpRequestExecutor() {
+ @Override
+ public HttpResponse execute(HttpRequest request, HttpClientConnection conn,
+ HttpContext context) throws IOException, HttpException {
+ HttpResponse resp = new BasicHttpResponse(HttpVersion.HTTP_1_1, 302, null);
+ resp.addHeader("location", "https://google.com/path");
+ requestsAttempted.incrementAndGet();
+ return resp;
+ }
+ };
+ HttpClient client = HttpClients.custom().setRequestExecutor(requestExecutor).build();
+ ApacheHttpTransport transport = new ApacheHttpTransport(client);
+ ApacheHttpRequest request = transport.buildRequest("GET", "https://google.com");
+ LowLevelHttpResponse response = request.execute();
+ assertEquals(1, requestsAttempted.get());
+ assertEquals(302, response.getStatusCode());
}
- private void checkHttpClient(HttpClient client) {
- HttpParams params = client.getParams();
- assertFalse(params.getBooleanParameter(ClientPNames.HANDLE_REDIRECTS, true));
- assertEquals(HttpVersion.HTTP_1_1, HttpProtocolParams.getVersion(params));
+ @Test
+ public void testRequestCanSetHeaders() {
+ final AtomicBoolean interceptorCalled = new AtomicBoolean(false);
+ HttpClient client = HttpClients.custom().addInterceptorFirst(new HttpRequestInterceptor() {
+ @Override
+ public void process(HttpRequest request, HttpContext context)
+ throws HttpException, IOException {
+ Header header = request.getFirstHeader("foo");
+ assertNotNull("Should have found header", header);
+ assertEquals("bar", header.getValue());
+ interceptorCalled.set(true);
+ throw new IOException("cancelling request");
+ }
+ }).build();
+
+ ApacheHttpTransport transport = new ApacheHttpTransport(client);
+ ApacheHttpRequest request = transport.buildRequest("GET", "https://google.com");
+ request.addHeader("foo", "bar");
+ try {
+ LowLevelHttpResponse response = request.execute();
+ fail("should not actually make the request");
+ } catch (IOException exception) {
+ assertEquals("cancelling request", exception.getMessage());
+ }
+ assertTrue("Expected to have called our test interceptor", interceptorCalled.get());
}
}
diff --git a/google-http-client-bom/pom.xml b/google-http-client-bom/pom.xml
index 381a72528..fbf36651d 100644
--- a/google-http-client-bom/pom.xml
+++ b/google-http-client-bom/pom.xml
@@ -73,7 +73,7 @@
com.google.http-clientgoogle-http-client-apache
- 1.27.1-SNAPSHOT
+ 2.0.1-SNAPSHOTcom.google.http-client
diff --git a/google-http-client/pom.xml b/google-http-client/pom.xml
index b036147b7..8243c83d0 100644
--- a/google-http-client/pom.xml
+++ b/google-http-client/pom.xml
@@ -165,14 +165,9 @@
mockito-alltest
-
- org.apache.httpcomponents
- httpclient
- commons-codeccommons-codec
- providedcom.google.j2objc
diff --git a/pom.xml b/pom.xml
index 8ec73aa68..84c905f42 100644
--- a/pom.xml
+++ b/pom.xml
@@ -178,22 +178,22 @@
com.google.http-clientgoogle-http-client
- ${project.version}
+ ${project.http-client.version}com.google.http-clientgoogle-http-client-apache
- ${project.version}
+ ${project.http-client.version}com.google.http-clientgoogle-http-client-appengine
- ${project.version}
+ ${project.http-client.version}com.google.http-clientgoogle-http-client-android
- ${project.version}
+ ${project.http-client.version}com.google.http-client
@@ -203,37 +203,37 @@
com.google.http-clientgoogle-http-client-gson
- ${project.version}
+ ${project.http-client.version}com.google.http-clientgoogle-http-client-jackson
- ${project.version}
+ ${project.http-client.version}com.google.http-clientgoogle-http-client-jackson2
- ${project.version}
+ ${project.http-client.version}com.google.http-clientgoogle-http-client-jdo
- ${project.version}
+ ${project.http-client.version}com.google.http-clientgoogle-http-client-xml
- ${project.version}
+ ${project.http-client.version}com.google.http-clientgoogle-http-client-findbugs
- ${project.version}
+ ${project.http-client.version}com.google.http-clientgoogle-http-client-test
- ${project.version}
+ ${project.http-client.version}org.mockito
@@ -509,7 +509,7 @@
com.google.http-clientgoogle-http-client-findbugs
- ${project.version}
+ ${project.http-client.version}
@@ -564,6 +564,7 @@
- google-api-java-client/google-api-client-assembly/android-properties (make the filenames match the version here)
- Internally, update the default features.json file
-->
+ 1.27.1-SNAPSHOT1.9.64UTF-83.0.2
diff --git a/versions.txt b/versions.txt
index ba1abcf45..dab7c58cc 100644
--- a/versions.txt
+++ b/versions.txt
@@ -6,7 +6,7 @@ google-http-client-bom:1.27.0:1.27.1-SNAPSHOT
google-http-client-parent:1.27.0:1.27.1-SNAPSHOT
google-http-client-android:1.27.0:1.27.1-SNAPSHOT
google-http-client-android-test:1.27.0:1.27.1-SNAPSHOT
-google-http-client-apache:1.27.0:1.27.1-SNAPSHOT
+google-http-client-apache:2.0.0:2.0.1-SNAPSHOT
google-http-client-apache-legacy:1.27.0:1.27.1-SNAPSHOT
google-http-client-appengine:1.27.0:1.27.1-SNAPSHOT
google-http-client-assembly:1.27.0:1.27.1-SNAPSHOT
From 990c534f0e5103a142b0639c12c90cb990a00cfd Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Fri, 4 Jan 2019 14:50:10 -0800
Subject: [PATCH 038/983] Remove commons-codec dependency (#563)
* Replace string utf8 helpers
* Use guava for base64 encoding/decoding
* Remove commons-codec dependencies
* Fix urlsafe string encoding
* Add tests for null edge cases for StringUtils
---
google-http-client-assembly/pom.xml | 4 +-
google-http-client/pom.xml | 67 -------------------
.../com/google/api/client/util/Base64.java | 44 ++++++------
.../google/api/client/util/StringUtils.java | 23 +++----
.../api/client/util/StringUtilsTest.java | 8 +++
pom.xml | 7 --
6 files changed, 41 insertions(+), 112 deletions(-)
diff --git a/google-http-client-assembly/pom.xml b/google-http-client-assembly/pom.xml
index 691062532..91af0998a 100644
--- a/google-http-client-assembly/pom.xml
+++ b/google-http-client-assembly/pom.xml
@@ -79,7 +79,7 @@
false${project.build.directory}/libs
- android,opengl-api,xmlParserAPIs,commons-codec,json
+ android,opengl-api,xmlParserAPIs,json
@@ -92,7 +92,7 @@
sourcesfalse${project.build.directory}/libs-sources
- android,opengl-api,xmlParserAPIs,commons-codec,json
+ android,opengl-api,xmlParserAPIs,json
diff --git a/google-http-client/pom.xml b/google-http-client/pom.xml
index 8243c83d0..a160df1d0 100644
--- a/google-http-client/pom.xml
+++ b/google-http-client/pom.xml
@@ -23,7 +23,6 @@
http://download.oracle.com/javase/7/docs/api/
https://google.github.io/guava/releases/${project.guava.version}/api/docs/
- https://commons.apache.org/proper/commons-codec/archives/${project.commons-codec.version}/apidocs/
${project.name} ${project.version}${project.artifactId} ${project.version}
@@ -41,68 +40,6 @@
-
-
- org.sonatype.plugins
- jarjar-maven-plugin
- 1.9
-
-
- package
-
- jarjar
-
-
-
- commons-codec:commons-codec
- com.google.guava:guava
-
-
-
- org.apache.commons.codec.**
- com.google.api.client.repackaged.org.apache.commons.codec.@1
-
-
- com.google.common.**
- com.google.api.client.repackaged.com.google.common.@1
-
-
- com.google.api.client.**
-
-
-
-
-
-
-
- maven-antrun-plugin
- 1.8
-
-
-
- scrub
- package
-
- run
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- maven-jar-plugin
@@ -165,10 +102,6 @@
mockito-alltest
-
- commons-codec
- commons-codec
- com.google.j2objcj2objc-annotations
diff --git a/google-http-client/src/main/java/com/google/api/client/util/Base64.java b/google-http-client/src/main/java/com/google/api/client/util/Base64.java
index f93b0c095..ac3650f0a 100644
--- a/google-http-client/src/main/java/com/google/api/client/util/Base64.java
+++ b/google-http-client/src/main/java/com/google/api/client/util/Base64.java
@@ -14,16 +14,11 @@
package com.google.api.client.util;
+import com.google.common.io.BaseEncoding;
+import com.google.common.io.BaseEncoding.DecodingException;
+
/**
- * Proxy for version 1.6 (or newer) of the Apache Commons Codec
- * {@link org.apache.commons.codec.binary.Base64} implementation.
- *
- *
- * This is needed in order to support platforms like Android which already include an older version
- * of the Apache Commons Codec (Android includes version 1.3). To avoid a dependency library
- * conflict, this library includes a reduced private copy of version 1.6 (or newer) of the Apache
- * Commons Codec (using a tool like jarjar).
- *
+ * Proxy for handling Base64 encoding/decoding.
*
* @since 1.8
* @author Yaniv Inbar
@@ -36,10 +31,9 @@ public class Base64 {
* @param binaryData binary data to encode or {@code null} for {@code null} result
* @return byte[] containing Base64 characters in their UTF-8 representation or {@code null} for
* {@code null} input
- * @see org.apache.commons.codec.binary.Base64#encodeBase64(byte[])
*/
public static byte[] encodeBase64(byte[] binaryData) {
- return org.apache.commons.codec.binary.Base64.encodeBase64(binaryData);
+ return StringUtils.getBytesUtf8(encodeBase64String(binaryData));
}
/**
@@ -47,10 +41,9 @@ public static byte[] encodeBase64(byte[] binaryData) {
*
* @param binaryData binary data to encode or {@code null} for {@code null} result
* @return String containing Base64 characters or {@code null} for {@code null} input
- * @see org.apache.commons.codec.binary.Base64#encodeBase64String(byte[])
*/
public static String encodeBase64String(byte[] binaryData) {
- return org.apache.commons.codec.binary.Base64.encodeBase64String(binaryData);
+ return BaseEncoding.base64().encode(binaryData);
}
@@ -61,10 +54,9 @@ public static String encodeBase64String(byte[] binaryData) {
* @param binaryData binary data to encode or {@code null} for {@code null} result
* @return byte[] containing Base64 characters in their UTF-8 representation or {@code null} for
* {@code null} input
- * @see org.apache.commons.codec.binary.Base64#encodeBase64URLSafe(byte[])
*/
public static byte[] encodeBase64URLSafe(byte[] binaryData) {
- return org.apache.commons.codec.binary.Base64.encodeBase64URLSafe(binaryData);
+ return StringUtils.getBytesUtf8(encodeBase64URLSafeString(binaryData));
}
/**
@@ -73,32 +65,38 @@ public static byte[] encodeBase64URLSafe(byte[] binaryData) {
*
* @param binaryData binary data to encode or {@code null} for {@code null} result
* @return String containing Base64 characters or {@code null} for {@code null} input
- * @see org.apache.commons.codec.binary.Base64#encodeBase64URLSafeString(byte[])
*/
public static String encodeBase64URLSafeString(byte[] binaryData) {
- return org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString(binaryData);
+ return BaseEncoding.base64Url().omitPadding().encode(binaryData);
}
/**
- * Decodes Base64 data into octets.
+ * Decodes Base64 data into octets. Note that this method handles both URL-safe and
+ * non-URL-safe base 64 encoded inputs.
*
* @param base64Data Byte array containing Base64 data or {@code null} for {@code null} result
* @return Array containing decoded data or {@code null} for {@code null} input
- * @see org.apache.commons.codec.binary.Base64#decodeBase64(byte[])
*/
public static byte[] decodeBase64(byte[] base64Data) {
- return org.apache.commons.codec.binary.Base64.decodeBase64(base64Data);
+ return decodeBase64(StringUtils.newStringUtf8(base64Data));
}
/**
- * Decodes a Base64 String into octets.
+ * Decodes a Base64 String into octets. Note that this method handles both URL-safe and
+ * non-URL-safe base 64 encoded strings.
*
* @param base64String String containing Base64 data or {@code null} for {@code null} result
* @return Array containing decoded data or {@code null} for {@code null} input
- * @see org.apache.commons.codec.binary.Base64#decodeBase64(String)
*/
public static byte[] decodeBase64(String base64String) {
- return org.apache.commons.codec.binary.Base64.decodeBase64(base64String);
+ try {
+ return BaseEncoding.base64().decode(base64String);
+ } catch (IllegalArgumentException e) {
+ if (e.getCause() instanceof DecodingException) {
+ return BaseEncoding.base64Url().decode(base64String);
+ }
+ throw e;
+ }
}
private Base64() {
diff --git a/google-http-client/src/main/java/com/google/api/client/util/StringUtils.java b/google-http-client/src/main/java/com/google/api/client/util/StringUtils.java
index 8d0c92532..80b1273cc 100644
--- a/google-http-client/src/main/java/com/google/api/client/util/StringUtils.java
+++ b/google-http-client/src/main/java/com/google/api/client/util/StringUtils.java
@@ -15,19 +15,12 @@
package com.google.api.client.util;
import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
/**
* Utilities for strings.
*
- *
- * Some of these methods are a proxy for version 1.6 (or newer) of the Apache Commons Codec
- * {@link StringUtils} implementation. This is needed in order to support platforms like Android
- * which already include an older version of the Apache Commons Codec (Android includes version
- * 1.3). To avoid a dependency library conflict, this library includes a reduced private copy of
- * version 1.6 (or newer) of the Apache Commons Codec (using a tool like jarjar).
- *
- *
* @since 1.8
* @author Yaniv Inbar
*/
@@ -48,13 +41,15 @@ public class StringUtils {
* @return encoded bytes, or null if the input string was null
* @throws IllegalStateException Thrown when the charset is missing, which should be never
* according the the Java specification.
- * @see Standard charsets
- * @see org.apache.commons.codec.binary.StringUtils#getBytesUtf8(String)
* @since 1.8
*/
public static byte[] getBytesUtf8(String string) {
- return org.apache.commons.codec.binary.StringUtils.getBytesUtf8(string);
+ if (string == null) {
+ return null;
+ }
+ return string.getBytes(StandardCharsets.UTF_8);
}
/**
@@ -66,11 +61,13 @@ public static byte[] getBytesUtf8(String string) {
* charset, or null if the input byte array was null.
* @throws IllegalStateException Thrown when a {@link UnsupportedEncodingException} is caught,
* which should never happen since the charset is required.
- * @see org.apache.commons.codec.binary.StringUtils#newStringUtf8(byte[])
* @since 1.8
*/
public static String newStringUtf8(byte[] bytes) {
- return org.apache.commons.codec.binary.StringUtils.newStringUtf8(bytes);
+ if (bytes == null) {
+ return null;
+ }
+ return new String(bytes, StandardCharsets.UTF_8);
}
private StringUtils() {
diff --git a/google-http-client/src/test/java/com/google/api/client/util/StringUtilsTest.java b/google-http-client/src/test/java/com/google/api/client/util/StringUtilsTest.java
index 0f7887197..3606f3ba3 100644
--- a/google-http-client/src/test/java/com/google/api/client/util/StringUtilsTest.java
+++ b/google-http-client/src/test/java/com/google/api/client/util/StringUtilsTest.java
@@ -40,7 +40,15 @@ public void testToBytesUtf8() {
Assert.assertArrayEquals(SAMPLE_UTF8, StringUtils.getBytesUtf8(SAMPLE));
}
+ public void testToBytesUtf8Null() {
+ assertNull(StringUtils.getBytesUtf8(null));
+ }
+
public void testFromBytesUtf8() {
assertEquals(SAMPLE, StringUtils.newStringUtf8(SAMPLE_UTF8));
}
+
+ public void testFromBytesUtf8Null() {
+ assertNull(StringUtils.newStringUtf8(null));
+ }
}
diff --git a/pom.xml b/pom.xml
index 84c905f42..546342f52 100644
--- a/pom.xml
+++ b/pom.xml
@@ -150,11 +150,6 @@
httpclient${project.httpclient.version}
-
- commons-codec
- commons-codec
- ${project.commons-codec.version}
- com.google.guavaguava
@@ -436,7 +431,6 @@
http://fasterxml.github.com/jackson-core/javadoc/${project.jackson-core2.version}/
https://www.javadoc.io/doc/com.google.code.gson/gson/${project.gson.version}
https://google.github.io/guava/releases/${project.guava.version}/api/docs/
- https://commons.apache.org/proper/commons-codec/archives/${project.commons-codec.version}/apidocs/
Google HTTP Client Library for Java ${project.version}com.google.api.client.findbugs:com.google.api.client.test.:com.google.api.services
@@ -575,7 +569,6 @@
26.0-android1.1.4c1.1.1
- 1.114.5.52.3-eb3.2.2
From 10ced26c2125642b88df1702ceddf64088bf1257 Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Tue, 8 Jan 2019 10:22:02 -0800
Subject: [PATCH 039/983] Move OpenCensusUtils to com.google.api.client.http
(#567)
* Move OpenCensusUtils to com.google.api.client.http to avoid circular dependency between packages
* Make OpenCensusUtils package private for now
---
.../main/java/com/google/api/client/http/HttpRequest.java | 1 -
.../google/api/client/{util => http}/OpenCensusUtils.java | 8 +++-----
.../api/client/{util => http}/OpenCensusUtilsTest.java | 2 +-
3 files changed, 4 insertions(+), 7 deletions(-)
rename google-http-client/src/main/java/com/google/api/client/{util => http}/OpenCensusUtils.java (97%)
rename google-http-client/src/test/java/com/google/api/client/{util => http}/OpenCensusUtilsTest.java (99%)
diff --git a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
index 1c68d9036..ef1427e22 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
@@ -18,7 +18,6 @@
import com.google.api.client.util.IOUtils;
import com.google.api.client.util.LoggingStreamingContent;
import com.google.api.client.util.ObjectParser;
-import com.google.api.client.util.OpenCensusUtils;
import com.google.api.client.util.Preconditions;
import com.google.api.client.util.Sleeper;
import com.google.api.client.util.StreamingContent;
diff --git a/google-http-client/src/main/java/com/google/api/client/util/OpenCensusUtils.java b/google-http-client/src/main/java/com/google/api/client/http/OpenCensusUtils.java
similarity index 97%
rename from google-http-client/src/main/java/com/google/api/client/util/OpenCensusUtils.java
rename to google-http-client/src/main/java/com/google/api/client/http/OpenCensusUtils.java
index a636dc7cc..a52ace894 100644
--- a/google-http-client/src/main/java/com/google/api/client/util/OpenCensusUtils.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/OpenCensusUtils.java
@@ -12,11 +12,9 @@
* the License.
*/
-package com.google.api.client.util;
+package com.google.api.client.http;
-import com.google.api.client.http.HttpHeaders;
-import com.google.api.client.http.HttpRequest;
-import com.google.api.client.http.HttpStatusCodes;
+import com.google.api.client.util.Preconditions;
import com.google.common.annotations.VisibleForTesting;
import io.opencensus.contrib.http.util.HttpPropagationUtil;
@@ -42,7 +40,7 @@
* @author Hailong Wen
* @since 1.28
*/
-public class OpenCensusUtils {
+class OpenCensusUtils {
private static final Logger logger = Logger.getLogger(OpenCensusUtils.class.getName());
diff --git a/google-http-client/src/test/java/com/google/api/client/util/OpenCensusUtilsTest.java b/google-http-client/src/test/java/com/google/api/client/http/OpenCensusUtilsTest.java
similarity index 99%
rename from google-http-client/src/test/java/com/google/api/client/util/OpenCensusUtilsTest.java
rename to google-http-client/src/test/java/com/google/api/client/http/OpenCensusUtilsTest.java
index f3c850ca7..d88f34d6a 100644
--- a/google-http-client/src/test/java/com/google/api/client/util/OpenCensusUtilsTest.java
+++ b/google-http-client/src/test/java/com/google/api/client/http/OpenCensusUtilsTest.java
@@ -12,7 +12,7 @@
* the License.
*/
-package com.google.api.client.util;
+package com.google.api.client.http;
import com.google.api.client.http.HttpHeaders;
From 28f1cd66912e9b0a07d2ffc2d5c9452b78da7fe1 Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Tue, 8 Jan 2019 10:44:03 -0800
Subject: [PATCH 040/983] OpenCensusUtils does need to be public (#569)
---
.../main/java/com/google/api/client/http/OpenCensusUtils.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/google-http-client/src/main/java/com/google/api/client/http/OpenCensusUtils.java b/google-http-client/src/main/java/com/google/api/client/http/OpenCensusUtils.java
index a52ace894..99812b5d9 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/OpenCensusUtils.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/OpenCensusUtils.java
@@ -40,7 +40,7 @@
* @author Hailong Wen
* @since 1.28
*/
-class OpenCensusUtils {
+public class OpenCensusUtils {
private static final Logger logger = Logger.getLogger(OpenCensusUtils.class.getName());
From 132edb77c6544a5bd01f2db02e6ebcbb389e2e91 Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Tue, 8 Jan 2019 10:57:55 -0800
Subject: [PATCH 041/983] Annotation OpenCensusUtils as beta. (#570)
We are depending upon pre-1.0 apis from opencensus. We need to allow for
the possibility of needing to change the API here.
---
.../main/java/com/google/api/client/http/OpenCensusUtils.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/google-http-client/src/main/java/com/google/api/client/http/OpenCensusUtils.java b/google-http-client/src/main/java/com/google/api/client/http/OpenCensusUtils.java
index 99812b5d9..dec8c3a48 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/OpenCensusUtils.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/OpenCensusUtils.java
@@ -14,6 +14,7 @@
package com.google.api.client.http;
+import com.google.api.client.util.Beta;
import com.google.api.client.util.Preconditions;
import com.google.common.annotations.VisibleForTesting;
@@ -35,11 +36,13 @@
import javax.annotation.Nullable;
/**
+ * {@link Beta}
* Utilities for Census monitoring and tracing.
*
* @author Hailong Wen
* @since 1.28
*/
+@Beta
public class OpenCensusUtils {
private static final Logger logger = Logger.getLogger(OpenCensusUtils.class.getName());
From c8c44d9c5fd5ed7191501001be05a406f9f2db73 Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Thu, 10 Jan 2019 10:06:47 -0800
Subject: [PATCH 042/983] Code style cleanup (#571)
* Code clarity fixes from import
* Java suggestion: UnknownHostException is subtype of IOException
* Java suggestion: params is only assigned during initialization
* Java suggestion: simpler equivalent code
* Java suggestion: empty array is faster than presized array
* Java suggestion: JDK case-related methods depend dangerously on implicit default locale
* Java suggestion: method list type can be inferred
* Java suggestion: remove redundant toString() call on string
* Java suggestion: use immutable collections API instead of singleton collection APIs
* Java suggestion: make final tracer/idGenerator only assigned during initialization
* Java suggestion: make final tracer only assigned during initialization
* Java style: group overloads together
* Update maven-checkstyle-plugin for Java 7 syntax
---
.../http/apache/ApacheHttpResponse.java | 8 +--
.../http/apache/ApacheHttpTransport.java | 53 +++++++++----------
.../api/client/http/apache/ContentEntity.java | 5 ++
.../apache/SSLSocketFactoryExtension.java | 3 +-
.../api/client/http/apache/ContentEntity.java | 5 ++
...ttpBackOffUnsuccessfulResponseHandler.java | 10 ++--
.../google/api/client/http/HttpRequest.java | 2 +-
.../api/client/http/OpenCensusUtils.java | 11 ++--
.../google/api/client/http/UriTemplate.java | 2 +-
.../com/google/api/client/util/FieldInfo.java | 11 ++--
pom.xml | 20 +++++--
.../dailymotion-simple-cmdline-sample/pom.xml | 5 +-
12 files changed, 78 insertions(+), 57 deletions(-)
diff --git a/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpResponse.java b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpResponse.java
index 0b2e9cef5..5e8e427aa 100644
--- a/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpResponse.java
+++ b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpResponse.java
@@ -89,10 +89,6 @@ public String getStatusLine() {
return statusLine == null ? null : statusLine.toString();
}
- public String getHeaderValue(String name) {
- return response.getLastHeader(name).getValue();
- }
-
@Override
public int getHeaderCount() {
return allHeaders.length;
@@ -103,6 +99,10 @@ public String getHeaderName(int index) {
return allHeaders[index].getName();
}
+ public String getHeaderValue(String name) {
+ return response.getLastHeader(name).getValue();
+ }
+
@Override
public String getHeaderValue(int index) {
return allHeaders[index].getValue();
diff --git a/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
index 50e74dc87..82ce559bb 100644
--- a/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
+++ b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
@@ -131,23 +131,34 @@ public ApacheHttpTransport(HttpClient httpClient) {
params.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, false);
}
+ /** Returns a new instance of the default HTTP parameters we use. */
+ static HttpParams newDefaultHttpParams() {
+ HttpParams params = new BasicHttpParams();
+ // Turn off stale checking. Our connections break all the time anyway,
+ // and it's not worth it to pay the penalty of checking every time.
+ HttpConnectionParams.setStaleCheckingEnabled(params, false);
+ HttpConnectionParams.setSocketBufferSize(params, 8192);
+ ConnManagerParams.setMaxTotalConnections(params, 200);
+ ConnManagerParams.setMaxConnectionsPerRoute(params, new ConnPerRouteBean(20));
+ return params;
+ }
+
/**
- * Creates a new instance of the Apache HTTP client that is used by the
- * {@link #ApacheHttpTransport()} constructor.
+ * Creates a new instance of the Apache HTTP client that is used by the {@link
+ * #ApacheHttpTransport()} constructor.
+ *
+ *
Use this constructor if you want to customize the default Apache HTTP client. Settings:
*
- *
- * Use this constructor if you want to customize the default Apache HTTP client. Settings:
- *
*
- *
The client connection manager is set to {@link ThreadSafeClientConnManager}.
- *
The socket buffer size is set to 8192 using
- * {@link HttpConnectionParams#setSocketBufferSize}.
- *
- *
The route planner uses {@link ProxySelectorRoutePlanner} with
- * {@link ProxySelector#getDefault()}, which uses the proxy settings from system
- * properties.
+ *
The client connection manager is set to {@link ThreadSafeClientConnManager}.
+ *
The socket buffer size is set to 8192 using {@link
+ * HttpConnectionParams#setSocketBufferSize}.
+ *
The retry mechanism is turned off by setting {@code new
+ * DefaultHttpRequestRetryHandler(0, false)}.
+ *
The route planner uses {@link ProxySelectorRoutePlanner} with {@link
+ * ProxySelector#getDefault()}, which uses the proxy settings from system
+ * properties.
*
*
* @return new instance of the Apache HTTP client
@@ -158,18 +169,6 @@ public static DefaultHttpClient newDefaultHttpClient() {
SSLSocketFactory.getSocketFactory(), newDefaultHttpParams(), ProxySelector.getDefault());
}
- /** Returns a new instance of the default HTTP parameters we use. */
- static HttpParams newDefaultHttpParams() {
- HttpParams params = new BasicHttpParams();
- // Turn off stale checking. Our connections break all the time anyway,
- // and it's not worth it to pay the penalty of checking every time.
- HttpConnectionParams.setStaleCheckingEnabled(params, false);
- HttpConnectionParams.setSocketBufferSize(params, 8192);
- ConnManagerParams.setMaxTotalConnections(params, 200);
- ConnManagerParams.setMaxConnectionsPerRoute(params, new ConnPerRouteBean(20));
- return params;
- }
-
/**
* Creates a new instance of the Apache HTTP client that is used by the
* {@link #ApacheHttpTransport()} constructor.
@@ -258,7 +257,7 @@ public static final class Builder {
private SSLSocketFactory socketFactory = SSLSocketFactory.getSocketFactory();
/** HTTP parameters. */
- private HttpParams params = newDefaultHttpParams();
+ private final HttpParams params = newDefaultHttpParams();
/**
* HTTP proxy selector to use {@link ProxySelectorRoutePlanner} or {@code null} for
diff --git a/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ContentEntity.java b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ContentEntity.java
index 6ae45b742..293f8a908 100644
--- a/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ContentEntity.java
+++ b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ContentEntity.java
@@ -41,22 +41,27 @@ final class ContentEntity extends AbstractHttpEntity {
this.streamingContent = Preconditions.checkNotNull(streamingContent);
}
+ @Override
public InputStream getContent() {
throw new UnsupportedOperationException();
}
+ @Override
public long getContentLength() {
return contentLength;
}
+ @Override
public boolean isRepeatable() {
return false;
}
+ @Override
public boolean isStreaming() {
return true;
}
+ @Override
public void writeTo(OutputStream out) throws IOException {
if (contentLength != 0) {
streamingContent.writeTo(out);
diff --git a/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java
index 3d507371b..809849fcb 100644
--- a/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java
+++ b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java
@@ -16,7 +16,6 @@
import java.io.IOException;
import java.net.Socket;
-import java.net.UnknownHostException;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
@@ -53,7 +52,7 @@ public Socket createSocket() throws IOException {
@Override
public Socket createSocket(Socket socket, String host, int port, boolean autoClose)
- throws IOException, UnknownHostException {
+ throws IOException {
SSLSocket sslSocket = (SSLSocket) socketFactory.createSocket(socket, host, port, autoClose);
getHostnameVerifier().verify(host, sslSocket);
return sslSocket;
diff --git a/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ContentEntity.java b/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ContentEntity.java
index 6ae45b742..293f8a908 100644
--- a/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ContentEntity.java
+++ b/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ContentEntity.java
@@ -41,22 +41,27 @@ final class ContentEntity extends AbstractHttpEntity {
this.streamingContent = Preconditions.checkNotNull(streamingContent);
}
+ @Override
public InputStream getContent() {
throw new UnsupportedOperationException();
}
+ @Override
public long getContentLength() {
return contentLength;
}
+ @Override
public boolean isRepeatable() {
return false;
}
+ @Override
public boolean isStreaming() {
return true;
}
+ @Override
public void writeTo(OutputStream out) throws IOException {
if (contentLength != 0) {
streamingContent.writeTo(out);
diff --git a/google-http-client/src/main/java/com/google/api/client/http/HttpBackOffUnsuccessfulResponseHandler.java b/google-http-client/src/main/java/com/google/api/client/http/HttpBackOffUnsuccessfulResponseHandler.java
index 82f35fad9..b9875273f 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/HttpBackOffUnsuccessfulResponseHandler.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/HttpBackOffUnsuccessfulResponseHandler.java
@@ -19,7 +19,6 @@
import com.google.api.client.util.Beta;
import com.google.api.client.util.Preconditions;
import com.google.api.client.util.Sleeper;
-
import java.io.IOException;
/**
@@ -131,13 +130,12 @@ public HttpBackOffUnsuccessfulResponseHandler setSleeper(Sleeper sleeper) {
/**
* {@inheritDoc}
*
- *
- * Handles the request with {@link BackOff}. That means that if back-off is required a call to
+ *
Handles the request with {@link BackOff}. That means that if back-off is required a call to
* {@link Sleeper#sleep(long)} will be made.
- *
*/
- public boolean handleResponse(
- HttpRequest request, HttpResponse response, boolean supportsRetry) throws IOException {
+ @Override
+ public boolean handleResponse(HttpRequest request, HttpResponse response, boolean supportsRetry)
+ throws IOException {
if (!supportsRetry) {
return false;
}
diff --git a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
index ef1427e22..c6c21768d 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
@@ -222,7 +222,7 @@ static String executeAndGetValueOfSomeCustomHeader(HttpRequest request) {
private Sleeper sleeper = Sleeper.DEFAULT;
/** OpenCensus tracing component. */
- private Tracer tracer = OpenCensusUtils.getTracer();
+ private final Tracer tracer = OpenCensusUtils.getTracer();
/**
* @param transport HTTP transport
diff --git a/google-http-client/src/main/java/com/google/api/client/http/OpenCensusUtils.java b/google-http-client/src/main/java/com/google/api/client/http/OpenCensusUtils.java
index dec8c3a48..1de900725 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/OpenCensusUtils.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/OpenCensusUtils.java
@@ -18,6 +18,7 @@
import com.google.api.client.util.Preconditions;
import com.google.common.annotations.VisibleForTesting;
+import com.google.common.collect.ImmutableList;
import io.opencensus.contrib.http.util.HttpPropagationUtil;
import io.opencensus.trace.BlankSpan;
import io.opencensus.trace.EndSpanOptions;
@@ -29,7 +30,6 @@
import io.opencensus.trace.Tracing;
import io.opencensus.trace.propagation.TextFormat;
-import java.util.Collections;
import java.util.concurrent.atomic.AtomicLong;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -57,12 +57,12 @@ public class OpenCensusUtils {
* OpenCensus tracing component. When no OpenCensus implementation is provided, it will return a
* no-op tracer.
*/
- private static Tracer tracer = Tracing.getTracer();
+ private static final Tracer tracer = Tracing.getTracer();
/**
* Sequence id generator for message event.
*/
- private static AtomicLong idGenerator = new AtomicLong();
+ private static final AtomicLong idGenerator = new AtomicLong();
/**
* Whether spans should be recorded locally. Defaults to true.
@@ -253,8 +253,9 @@ public void put(HttpHeaders carrier, String key, String value) {
}
try {
- Tracing.getExportComponent().getSampledSpanStore().registerSpanNamesForCollection(
- Collections.singletonList(SPAN_NAME_HTTP_REQUEST_EXECUTE));
+ Tracing.getExportComponent()
+ .getSampledSpanStore()
+ .registerSpanNamesForCollection(ImmutableList.of(SPAN_NAME_HTTP_REQUEST_EXECUTE));
} catch (Exception e) {
logger.log(
Level.WARNING, "Cannot register default OpenCensus span names for collection.", e);
diff --git a/google-http-client/src/main/java/com/google/api/client/http/UriTemplate.java b/google-http-client/src/main/java/com/google/api/client/http/UriTemplate.java
index 8cedf7e45..433fb9d39 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/UriTemplate.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/UriTemplate.java
@@ -360,7 +360,7 @@ public static String expand(String pathUri, Object parameters,
private static String getSimpleValue(String name, String value, CompositeOutput compositeOutput) {
if (compositeOutput.requiresVarAssignment()) {
- return String.format("%s=%s", name, compositeOutput.getEncodedValue(value.toString()));
+ return String.format("%s=%s", name, compositeOutput.getEncodedValue(value));
}
return compositeOutput.getEncodedValue(value);
}
diff --git a/google-http-client/src/main/java/com/google/api/client/util/FieldInfo.java b/google-http-client/src/main/java/com/google/api/client/util/FieldInfo.java
index 0e50c0aba..ac7cdd422 100644
--- a/google-http-client/src/main/java/com/google/api/client/util/FieldInfo.java
+++ b/google-http-client/src/main/java/com/google/api/client/util/FieldInfo.java
@@ -14,6 +14,7 @@
package com.google.api.client.util;
+import com.google.common.base.Ascii;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -141,14 +142,14 @@ public static FieldInfo of(Field field) {
* Creates list of setter methods for a field only in declaring class.
*/
private Method[] settersMethodForField(Field field) {
- List methods = new ArrayList();
+ List methods = new ArrayList<>();
for (Method method : field.getDeclaringClass().getDeclaredMethods()) {
- if (method.getName().toLowerCase().equals("set" + field.getName().toLowerCase())
+ if (Ascii.toLowerCase(method.getName()).equals("set" + field.getName().toLowerCase())
&& method.getParameterTypes().length == 1) {
methods.add(method);
}
}
- return methods.toArray(new Method[methods.size()]);
+ return methods.toArray(new Method[0]);
}
/**
@@ -231,9 +232,7 @@ public void setValue(Object obj, Object value) {
try {
method.invoke(obj, value);
return;
- } catch (IllegalAccessException e) {
- // try to set field directly
- } catch (InvocationTargetException e) {
+ } catch (IllegalAccessException | InvocationTargetException e) {
// try to set field directly
}
}
diff --git a/pom.xml b/pom.xml
index 546342f52..679b6d7cc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -361,8 +361,9 @@
+ org.apache.maven.pluginsmaven-checkstyle-plugin
- 2.6
+ 3.0.0org.codehaus.mojo
@@ -482,9 +483,9 @@
org.apache.maven.pluginsmaven-checkstyle-plugin
- checkstyle.xml
+ ${project.root-directory}/checkstyle.xmltrue
- ${basedir}/../checkstyle-suppressions.xml
+ ${project.root-directory}/checkstyle-suppressions.xml
@@ -576,6 +577,7 @@
3.2.14.0.30.18.0
+ ..
@@ -612,5 +614,17 @@
+
+
+ root-directory
+
+
+ checkstyle-suppressions.xml
+
+
+
+ .
+
+
diff --git a/samples/dailymotion-simple-cmdline-sample/pom.xml b/samples/dailymotion-simple-cmdline-sample/pom.xml
index fb0c6b121..ef0e1233e 100644
--- a/samples/dailymotion-simple-cmdline-sample/pom.xml
+++ b/samples/dailymotion-simple-cmdline-sample/pom.xml
@@ -35,11 +35,12 @@
maven-checkstyle-plugin
- 2.6
+ 3.0.0
- ../checkstyle.xml
+ ../../checkstyle.xmltruefalse
+ ../../checkstyle-suppressions.xml
From 2ee8e9958ef4e7854eea7c5d82218588aed27a2d Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Tue, 15 Jan 2019 12:30:53 -0800
Subject: [PATCH 043/983] Release google-http-java-client v1.28.0 (#574)
* Release v1.28.0
* Fix google-http-client-apache version for 2.0.0 release
* Update VERSION constant
---
google-http-client-android-test/pom.xml | 6 ++--
google-http-client-android/pom.xml | 4 +--
google-http-client-apache-legacy/pom.xml | 4 +--
google-http-client-apache/pom.xml | 4 +--
google-http-client-appengine/pom.xml | 4 +--
google-http-client-assembly/pom.xml | 4 +--
google-http-client-bom/README.md | 2 +-
google-http-client-bom/pom.xml | 28 +++++++--------
google-http-client-findbugs/pom.xml | 4 +--
google-http-client-gson/pom.xml | 4 +--
google-http-client-jackson/pom.xml | 4 +--
google-http-client-jackson2/pom.xml | 4 +--
google-http-client-jdo/pom.xml | 4 +--
google-http-client-protobuf/pom.xml | 4 +--
google-http-client-test/pom.xml | 4 +--
google-http-client-xml/pom.xml | 4 +--
google-http-client/pom.xml | 4 +--
.../google/api/client/http/HttpRequest.java | 2 +-
pom.xml | 4 +--
.../dailymotion-simple-cmdline-sample/pom.xml | 2 +-
versions.txt | 34 +++++++++----------
21 files changed, 67 insertions(+), 67 deletions(-)
diff --git a/google-http-client-android-test/pom.xml b/google-http-client-android-test/pom.xml
index 06d65d2f8..bf9a80e98 100644
--- a/google-http-client-android-test/pom.xml
+++ b/google-http-client-android-test/pom.xml
@@ -4,7 +4,7 @@
google-http-clientgoogle-http-client-android-testTest project for google-http-client-android.
- 1.27.1-SNAPSHOT
+ 1.28.0apk
@@ -53,7 +53,7 @@
com.google.http-clientgoogle-http-client-android
- 1.27.1-SNAPSHOT
+ 1.28.0android
@@ -72,7 +72,7 @@
com.google.http-clientgoogle-http-client-test
- 1.27.1-SNAPSHOT
+ 1.28.0junit
diff --git a/google-http-client-android/pom.xml b/google-http-client-android/pom.xml
index 509d7aab0..9aaa26c77 100644
--- a/google-http-client-android/pom.xml
+++ b/google-http-client-android/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.1-SNAPSHOT
+ 1.28.0../pom.xmlgoogle-http-client-android
- 1.27.1-SNAPSHOT
+ 1.28.0Android Platform Extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-apache-legacy/pom.xml b/google-http-client-apache-legacy/pom.xml
index 8c19415a0..a7423ca0c 100644
--- a/google-http-client-apache-legacy/pom.xml
+++ b/google-http-client-apache-legacy/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.1-SNAPSHOT
+ 1.28.0../pom.xmlgoogle-http-client-apache
- 1.27.1-SNAPSHOT
+ 1.28.0Legacy Apache HTTP transport for the Google HTTP Client Library for Java.
diff --git a/google-http-client-apache/pom.xml b/google-http-client-apache/pom.xml
index bafdc0375..4dd86c5d1 100644
--- a/google-http-client-apache/pom.xml
+++ b/google-http-client-apache/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.1-SNAPSHOT
+ 1.28.0../pom.xmlgoogle-http-client-apache
- 2.0.1-SNAPSHOT
+ 2.0.0Apache HTTP transport for the Google HTTP Client Library for Java.
diff --git a/google-http-client-appengine/pom.xml b/google-http-client-appengine/pom.xml
index a5272e118..752b5aecf 100644
--- a/google-http-client-appengine/pom.xml
+++ b/google-http-client-appengine/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.1-SNAPSHOT
+ 1.28.0../pom.xmlgoogle-http-client-appengine
- 1.27.1-SNAPSHOT
+ 1.28.0Google App Engine extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-assembly/pom.xml b/google-http-client-assembly/pom.xml
index 91af0998a..01b4649b3 100644
--- a/google-http-client-assembly/pom.xml
+++ b/google-http-client-assembly/pom.xml
@@ -4,12 +4,12 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.1-SNAPSHOT
+ 1.28.0../pom.xmlcom.google.http-clientgoogle-http-client-assembly
- 1.27.1-SNAPSHOT
+ 1.28.0pomAssembly for the Google HTTP Client Library for Java
diff --git a/google-http-client-bom/README.md b/google-http-client-bom/README.md
index 4932f09d8..7a7f8fa39 100644
--- a/google-http-client-bom/README.md
+++ b/google-http-client-bom/README.md
@@ -12,7 +12,7 @@ To use it in Maven, add the following to your `pom.xml`:
com.google.http-clientgoogle-http-client-bom
- 1.27.0
+ 1.28.0pomimport
diff --git a/google-http-client-bom/pom.xml b/google-http-client-bom/pom.xml
index fbf36651d..2fa1220c8 100644
--- a/google-http-client-bom/pom.xml
+++ b/google-http-client-bom/pom.xml
@@ -3,7 +3,7 @@
4.0.0com.google.http-clientgoogle-http-client-bom
- 1.27.1-SNAPSHOT
+ 1.28.0pomGoogle HTTP Client Library for Java BOM
@@ -63,67 +63,67 @@
com.google.http-clientgoogle-http-client
- 1.27.1-SNAPSHOT
+ 1.28.0com.google.http-clientgoogle-http-client-android
- 1.27.1-SNAPSHOT
+ 1.28.0com.google.http-clientgoogle-http-client-apache
- 2.0.1-SNAPSHOT
+ 2.0.0com.google.http-clientgoogle-http-client-appengine
- 1.27.1-SNAPSHOT
+ 1.28.0com.google.http-clientgoogle-http-client-assembly
- 1.27.1-SNAPSHOT
+ 1.28.0com.google.http-clientgoogle-http-client-findbugs
- 1.27.1-SNAPSHOT
+ 1.28.0com.google.http-clientgoogle-http-client-gson
- 1.27.1-SNAPSHOT
+ 1.28.0com.google.http-clientgoogle-http-client-jackson
- 1.27.1-SNAPSHOT
+ 1.28.0com.google.http-clientgoogle-http-client-jackson2
- 1.27.1-SNAPSHOT
+ 1.28.0com.google.http-clientgoogle-http-client-jdo
- 1.27.1-SNAPSHOT
+ 1.28.0com.google.http-clientgoogle-http-client-protobuf
- 1.27.1-SNAPSHOT
+ 1.28.0com.google.http-clientgoogle-http-client-test
- 1.27.1-SNAPSHOT
+ 1.28.0com.google.http-clientgoogle-http-client-xml
- 1.27.1-SNAPSHOT
+ 1.28.0
diff --git a/google-http-client-findbugs/pom.xml b/google-http-client-findbugs/pom.xml
index f785f9f02..4c82f073d 100644
--- a/google-http-client-findbugs/pom.xml
+++ b/google-http-client-findbugs/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.1-SNAPSHOT
+ 1.28.0../pom.xmlgoogle-http-client-findbugs
- 1.27.1-SNAPSHOT
+ 1.28.0Google APIs Client Library Findbugs custom plugin.
diff --git a/google-http-client-gson/pom.xml b/google-http-client-gson/pom.xml
index 7905ce151..0e8a6199b 100644
--- a/google-http-client-gson/pom.xml
+++ b/google-http-client-gson/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.1-SNAPSHOT
+ 1.28.0../pom.xmlgoogle-http-client-gson
- 1.27.1-SNAPSHOT
+ 1.28.0GSON extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-jackson/pom.xml b/google-http-client-jackson/pom.xml
index b800f633a..68df2e688 100644
--- a/google-http-client-jackson/pom.xml
+++ b/google-http-client-jackson/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.1-SNAPSHOT
+ 1.28.0../pom.xmlgoogle-http-client-jackson
- 1.27.1-SNAPSHOT
+ 1.28.0Jackson extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-jackson2/pom.xml b/google-http-client-jackson2/pom.xml
index 73c04749c..e3fa416ab 100644
--- a/google-http-client-jackson2/pom.xml
+++ b/google-http-client-jackson2/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.1-SNAPSHOT
+ 1.28.0../pom.xmlgoogle-http-client-jackson2
- 1.27.1-SNAPSHOT
+ 1.28.0Jackson 2 extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-jdo/pom.xml b/google-http-client-jdo/pom.xml
index f0303f451..644961cb6 100644
--- a/google-http-client-jdo/pom.xml
+++ b/google-http-client-jdo/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.1-SNAPSHOT
+ 1.28.0../pom.xmlgoogle-http-client-jdo
- 1.27.1-SNAPSHOT
+ 1.28.0JDO extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-protobuf/pom.xml b/google-http-client-protobuf/pom.xml
index 0a98346ac..b2a79d6f5 100644
--- a/google-http-client-protobuf/pom.xml
+++ b/google-http-client-protobuf/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.1-SNAPSHOT
+ 1.28.0../pom.xmlgoogle-http-client-protobuf
- 1.27.1-SNAPSHOT
+ 1.28.0Protocol Buffer extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-test/pom.xml b/google-http-client-test/pom.xml
index e7c843615..f6349777d 100644
--- a/google-http-client-test/pom.xml
+++ b/google-http-client-test/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.1-SNAPSHOT
+ 1.28.0../pom.xmlgoogle-http-client-test
- 1.27.1-SNAPSHOT
+ 1.28.0Shared classes used for testing of artifacts in the Google HTTP Client Library for Java.
diff --git a/google-http-client-xml/pom.xml b/google-http-client-xml/pom.xml
index f731ce066..039f71d54 100644
--- a/google-http-client-xml/pom.xml
+++ b/google-http-client-xml/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.1-SNAPSHOT
+ 1.28.0../pom.xmlgoogle-http-client-xml
- 1.27.1-SNAPSHOT
+ 1.28.0XML extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client/pom.xml b/google-http-client/pom.xml
index a160df1d0..8050e7c1d 100644
--- a/google-http-client/pom.xml
+++ b/google-http-client/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.1-SNAPSHOT
+ 1.28.0../pom.xmlgoogle-http-client
- 1.27.1-SNAPSHOT
+ 1.28.0Google HTTP Client Library for Java
Google HTTP Client Library for Java. Functionality that works on all supported Java platforms,
diff --git a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
index c6c21768d..91a9c8a01 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
@@ -56,7 +56,7 @@ public final class HttpRequest {
*
* @since 1.8
*/
- public static final String VERSION = "1.27.0";
+ public static final String VERSION = "1.28.0";
/**
* User agent suffix for all requests.
diff --git a/pom.xml b/pom.xml
index 679b6d7cc..ad6b61d08 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.1-SNAPSHOT
+ 1.28.0pomParent for the Google HTTP Client Library for Java
@@ -559,7 +559,7 @@
- google-api-java-client/google-api-client-assembly/android-properties (make the filenames match the version here)
- Internally, update the default features.json file
-->
- 1.27.1-SNAPSHOT
+ 1.28.01.9.64UTF-83.0.2
diff --git a/samples/dailymotion-simple-cmdline-sample/pom.xml b/samples/dailymotion-simple-cmdline-sample/pom.xml
index ef0e1233e..4adcc5ebd 100644
--- a/samples/dailymotion-simple-cmdline-sample/pom.xml
+++ b/samples/dailymotion-simple-cmdline-sample/pom.xml
@@ -4,7 +4,7 @@
com.google.http-clientgoogle-http-client-parent
- 1.27.1-SNAPSHOT
+ 1.28.0../../pom.xmldailymotion-simple-cmdline-sample
diff --git a/versions.txt b/versions.txt
index dab7c58cc..1c1c0257e 100644
--- a/versions.txt
+++ b/versions.txt
@@ -1,20 +1,20 @@
# Format:
# module:released-version:current-version
-google-http-client:1.27.0:1.27.1-SNAPSHOT
-google-http-client-bom:1.27.0:1.27.1-SNAPSHOT
-google-http-client-parent:1.27.0:1.27.1-SNAPSHOT
-google-http-client-android:1.27.0:1.27.1-SNAPSHOT
-google-http-client-android-test:1.27.0:1.27.1-SNAPSHOT
-google-http-client-apache:2.0.0:2.0.1-SNAPSHOT
-google-http-client-apache-legacy:1.27.0:1.27.1-SNAPSHOT
-google-http-client-appengine:1.27.0:1.27.1-SNAPSHOT
-google-http-client-assembly:1.27.0:1.27.1-SNAPSHOT
-google-http-client-findbugs:1.27.0:1.27.1-SNAPSHOT
-google-http-client-gson:1.27.0:1.27.1-SNAPSHOT
-google-http-client-jackson:1.27.0:1.27.1-SNAPSHOT
-google-http-client-jackson2:1.27.0:1.27.1-SNAPSHOT
-google-http-client-jdo:1.27.0:1.27.1-SNAPSHOT
-google-http-client-protobuf:1.27.0:1.27.1-SNAPSHOT
-google-http-client-test:1.27.0:1.27.1-SNAPSHOT
-google-http-client-xml:1.27.0:1.27.1-SNAPSHOT
+google-http-client:1.28.0:1.28.0
+google-http-client-bom:1.28.0:1.28.0
+google-http-client-parent:1.28.0:1.28.0
+google-http-client-android:1.28.0:1.28.0
+google-http-client-android-test:1.28.0:1.28.0
+google-http-client-apache:2.0.0:2.0.0
+google-http-client-apache-legacy:1.28.0:1.28.0
+google-http-client-appengine:1.28.0:1.28.0
+google-http-client-assembly:1.28.0:1.28.0
+google-http-client-findbugs:1.28.0:1.28.0
+google-http-client-gson:1.28.0:1.28.0
+google-http-client-jackson:1.28.0:1.28.0
+google-http-client-jackson2:1.28.0:1.28.0
+google-http-client-jdo:1.28.0:1.28.0
+google-http-client-protobuf:1.28.0:1.28.0
+google-http-client-test:1.28.0:1.28.0
+google-http-client-xml:1.28.0:1.28.0
From 676ca71d0a545187a0e1d54ff5424595c76c571f Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Tue, 15 Jan 2019 12:44:32 -0800
Subject: [PATCH 044/983] Bump next snapshot (#575)
---
google-http-client-android-test/pom.xml | 6 ++--
google-http-client-android/pom.xml | 4 +--
google-http-client-apache-legacy/pom.xml | 4 +--
google-http-client-apache/pom.xml | 4 +--
google-http-client-appengine/pom.xml | 4 +--
google-http-client-assembly/pom.xml | 4 +--
google-http-client-bom/pom.xml | 28 +++++++--------
google-http-client-findbugs/pom.xml | 4 +--
google-http-client-gson/pom.xml | 4 +--
google-http-client-jackson/pom.xml | 4 +--
google-http-client-jackson2/pom.xml | 4 +--
google-http-client-jdo/pom.xml | 4 +--
google-http-client-protobuf/pom.xml | 4 +--
google-http-client-test/pom.xml | 4 +--
google-http-client-xml/pom.xml | 4 +--
google-http-client/pom.xml | 4 +--
pom.xml | 4 +--
.../dailymotion-simple-cmdline-sample/pom.xml | 2 +-
versions.txt | 34 +++++++++----------
19 files changed, 65 insertions(+), 65 deletions(-)
diff --git a/google-http-client-android-test/pom.xml b/google-http-client-android-test/pom.xml
index bf9a80e98..c4a464ae8 100644
--- a/google-http-client-android-test/pom.xml
+++ b/google-http-client-android-test/pom.xml
@@ -4,7 +4,7 @@
google-http-clientgoogle-http-client-android-testTest project for google-http-client-android.
- 1.28.0
+ 1.28.1-SNAPSHOTapk
@@ -53,7 +53,7 @@
com.google.http-clientgoogle-http-client-android
- 1.28.0
+ 1.28.1-SNAPSHOTandroid
@@ -72,7 +72,7 @@
com.google.http-clientgoogle-http-client-test
- 1.28.0
+ 1.28.1-SNAPSHOTjunit
diff --git a/google-http-client-android/pom.xml b/google-http-client-android/pom.xml
index 9aaa26c77..a3408c357 100644
--- a/google-http-client-android/pom.xml
+++ b/google-http-client-android/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.28.0
+ 1.28.1-SNAPSHOT../pom.xmlgoogle-http-client-android
- 1.28.0
+ 1.28.1-SNAPSHOTAndroid Platform Extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-apache-legacy/pom.xml b/google-http-client-apache-legacy/pom.xml
index a7423ca0c..303a04479 100644
--- a/google-http-client-apache-legacy/pom.xml
+++ b/google-http-client-apache-legacy/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.28.0
+ 1.28.1-SNAPSHOT../pom.xmlgoogle-http-client-apache
- 1.28.0
+ 1.28.1-SNAPSHOTLegacy Apache HTTP transport for the Google HTTP Client Library for Java.
diff --git a/google-http-client-apache/pom.xml b/google-http-client-apache/pom.xml
index 4dd86c5d1..05770a37c 100644
--- a/google-http-client-apache/pom.xml
+++ b/google-http-client-apache/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.28.0
+ 1.28.1-SNAPSHOT../pom.xmlgoogle-http-client-apache
- 2.0.0
+ 2.0.1-SNAPSHOTApache HTTP transport for the Google HTTP Client Library for Java.
diff --git a/google-http-client-appengine/pom.xml b/google-http-client-appengine/pom.xml
index 752b5aecf..ae03f7995 100644
--- a/google-http-client-appengine/pom.xml
+++ b/google-http-client-appengine/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.28.0
+ 1.28.1-SNAPSHOT../pom.xmlgoogle-http-client-appengine
- 1.28.0
+ 1.28.1-SNAPSHOTGoogle App Engine extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-assembly/pom.xml b/google-http-client-assembly/pom.xml
index 01b4649b3..77cd50430 100644
--- a/google-http-client-assembly/pom.xml
+++ b/google-http-client-assembly/pom.xml
@@ -4,12 +4,12 @@
com.google.http-clientgoogle-http-client-parent
- 1.28.0
+ 1.28.1-SNAPSHOT../pom.xmlcom.google.http-clientgoogle-http-client-assembly
- 1.28.0
+ 1.28.1-SNAPSHOTpomAssembly for the Google HTTP Client Library for Java
diff --git a/google-http-client-bom/pom.xml b/google-http-client-bom/pom.xml
index 2fa1220c8..9db216c9c 100644
--- a/google-http-client-bom/pom.xml
+++ b/google-http-client-bom/pom.xml
@@ -3,7 +3,7 @@
4.0.0com.google.http-clientgoogle-http-client-bom
- 1.28.0
+ 1.28.1-SNAPSHOTpomGoogle HTTP Client Library for Java BOM
@@ -63,67 +63,67 @@
com.google.http-clientgoogle-http-client
- 1.28.0
+ 1.28.1-SNAPSHOTcom.google.http-clientgoogle-http-client-android
- 1.28.0
+ 1.28.1-SNAPSHOTcom.google.http-clientgoogle-http-client-apache
- 2.0.0
+ 2.0.1-SNAPSHOTcom.google.http-clientgoogle-http-client-appengine
- 1.28.0
+ 1.28.1-SNAPSHOTcom.google.http-clientgoogle-http-client-assembly
- 1.28.0
+ 1.28.1-SNAPSHOTcom.google.http-clientgoogle-http-client-findbugs
- 1.28.0
+ 1.28.1-SNAPSHOTcom.google.http-clientgoogle-http-client-gson
- 1.28.0
+ 1.28.1-SNAPSHOTcom.google.http-clientgoogle-http-client-jackson
- 1.28.0
+ 1.28.1-SNAPSHOTcom.google.http-clientgoogle-http-client-jackson2
- 1.28.0
+ 1.28.1-SNAPSHOTcom.google.http-clientgoogle-http-client-jdo
- 1.28.0
+ 1.28.1-SNAPSHOTcom.google.http-clientgoogle-http-client-protobuf
- 1.28.0
+ 1.28.1-SNAPSHOTcom.google.http-clientgoogle-http-client-test
- 1.28.0
+ 1.28.1-SNAPSHOTcom.google.http-clientgoogle-http-client-xml
- 1.28.0
+ 1.28.1-SNAPSHOT
diff --git a/google-http-client-findbugs/pom.xml b/google-http-client-findbugs/pom.xml
index 4c82f073d..c72fcc834 100644
--- a/google-http-client-findbugs/pom.xml
+++ b/google-http-client-findbugs/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.28.0
+ 1.28.1-SNAPSHOT../pom.xmlgoogle-http-client-findbugs
- 1.28.0
+ 1.28.1-SNAPSHOTGoogle APIs Client Library Findbugs custom plugin.
diff --git a/google-http-client-gson/pom.xml b/google-http-client-gson/pom.xml
index 0e8a6199b..675414f79 100644
--- a/google-http-client-gson/pom.xml
+++ b/google-http-client-gson/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.28.0
+ 1.28.1-SNAPSHOT../pom.xmlgoogle-http-client-gson
- 1.28.0
+ 1.28.1-SNAPSHOTGSON extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-jackson/pom.xml b/google-http-client-jackson/pom.xml
index 68df2e688..dbd8ce974 100644
--- a/google-http-client-jackson/pom.xml
+++ b/google-http-client-jackson/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.28.0
+ 1.28.1-SNAPSHOT../pom.xmlgoogle-http-client-jackson
- 1.28.0
+ 1.28.1-SNAPSHOTJackson extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-jackson2/pom.xml b/google-http-client-jackson2/pom.xml
index e3fa416ab..967e94dbf 100644
--- a/google-http-client-jackson2/pom.xml
+++ b/google-http-client-jackson2/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.28.0
+ 1.28.1-SNAPSHOT../pom.xmlgoogle-http-client-jackson2
- 1.28.0
+ 1.28.1-SNAPSHOTJackson 2 extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-jdo/pom.xml b/google-http-client-jdo/pom.xml
index 644961cb6..f17e19d43 100644
--- a/google-http-client-jdo/pom.xml
+++ b/google-http-client-jdo/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.28.0
+ 1.28.1-SNAPSHOT../pom.xmlgoogle-http-client-jdo
- 1.28.0
+ 1.28.1-SNAPSHOTJDO extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-protobuf/pom.xml b/google-http-client-protobuf/pom.xml
index b2a79d6f5..e82606716 100644
--- a/google-http-client-protobuf/pom.xml
+++ b/google-http-client-protobuf/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.28.0
+ 1.28.1-SNAPSHOT../pom.xmlgoogle-http-client-protobuf
- 1.28.0
+ 1.28.1-SNAPSHOTProtocol Buffer extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client-test/pom.xml b/google-http-client-test/pom.xml
index f6349777d..d025a3c0c 100644
--- a/google-http-client-test/pom.xml
+++ b/google-http-client-test/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.28.0
+ 1.28.1-SNAPSHOT../pom.xmlgoogle-http-client-test
- 1.28.0
+ 1.28.1-SNAPSHOTShared classes used for testing of artifacts in the Google HTTP Client Library for Java.
diff --git a/google-http-client-xml/pom.xml b/google-http-client-xml/pom.xml
index 039f71d54..43e43311b 100644
--- a/google-http-client-xml/pom.xml
+++ b/google-http-client-xml/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.28.0
+ 1.28.1-SNAPSHOT../pom.xmlgoogle-http-client-xml
- 1.28.0
+ 1.28.1-SNAPSHOTXML extensions to the Google HTTP Client Library for Java.
diff --git a/google-http-client/pom.xml b/google-http-client/pom.xml
index 8050e7c1d..72d6dd4c5 100644
--- a/google-http-client/pom.xml
+++ b/google-http-client/pom.xml
@@ -4,11 +4,11 @@
com.google.http-clientgoogle-http-client-parent
- 1.28.0
+ 1.28.1-SNAPSHOT../pom.xmlgoogle-http-client
- 1.28.0
+ 1.28.1-SNAPSHOTGoogle HTTP Client Library for Java
Google HTTP Client Library for Java. Functionality that works on all supported Java platforms,
diff --git a/pom.xml b/pom.xml
index ad6b61d08..3183185cf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
com.google.http-clientgoogle-http-client-parent
- 1.28.0
+ 1.28.1-SNAPSHOTpomParent for the Google HTTP Client Library for Java
@@ -559,7 +559,7 @@
- google-api-java-client/google-api-client-assembly/android-properties (make the filenames match the version here)
- Internally, update the default features.json file
-->
- 1.28.0
+ 1.28.1-SNAPSHOT1.9.64UTF-83.0.2
diff --git a/samples/dailymotion-simple-cmdline-sample/pom.xml b/samples/dailymotion-simple-cmdline-sample/pom.xml
index 4adcc5ebd..9e1e9d57b 100644
--- a/samples/dailymotion-simple-cmdline-sample/pom.xml
+++ b/samples/dailymotion-simple-cmdline-sample/pom.xml
@@ -4,7 +4,7 @@
com.google.http-clientgoogle-http-client-parent
- 1.28.0
+ 1.28.1-SNAPSHOT../../pom.xmldailymotion-simple-cmdline-sample
diff --git a/versions.txt b/versions.txt
index 1c1c0257e..a6a7fd165 100644
--- a/versions.txt
+++ b/versions.txt
@@ -1,20 +1,20 @@
# Format:
# module:released-version:current-version
-google-http-client:1.28.0:1.28.0
-google-http-client-bom:1.28.0:1.28.0
-google-http-client-parent:1.28.0:1.28.0
-google-http-client-android:1.28.0:1.28.0
-google-http-client-android-test:1.28.0:1.28.0
-google-http-client-apache:2.0.0:2.0.0
-google-http-client-apache-legacy:1.28.0:1.28.0
-google-http-client-appengine:1.28.0:1.28.0
-google-http-client-assembly:1.28.0:1.28.0
-google-http-client-findbugs:1.28.0:1.28.0
-google-http-client-gson:1.28.0:1.28.0
-google-http-client-jackson:1.28.0:1.28.0
-google-http-client-jackson2:1.28.0:1.28.0
-google-http-client-jdo:1.28.0:1.28.0
-google-http-client-protobuf:1.28.0:1.28.0
-google-http-client-test:1.28.0:1.28.0
-google-http-client-xml:1.28.0:1.28.0
+google-http-client:1.28.0:1.28.1-SNAPSHOT
+google-http-client-bom:1.28.0:1.28.1-SNAPSHOT
+google-http-client-parent:1.28.0:1.28.1-SNAPSHOT
+google-http-client-android:1.28.0:1.28.1-SNAPSHOT
+google-http-client-android-test:1.28.0:1.28.1-SNAPSHOT
+google-http-client-apache:2.0.0:2.0.1-SNAPSHOT
+google-http-client-apache-legacy:1.28.0:1.28.1-SNAPSHOT
+google-http-client-appengine:1.28.0:1.28.1-SNAPSHOT
+google-http-client-assembly:1.28.0:1.28.1-SNAPSHOT
+google-http-client-findbugs:1.28.0:1.28.1-SNAPSHOT
+google-http-client-gson:1.28.0:1.28.1-SNAPSHOT
+google-http-client-jackson:1.28.0:1.28.1-SNAPSHOT
+google-http-client-jackson2:1.28.0:1.28.1-SNAPSHOT
+google-http-client-jdo:1.28.0:1.28.1-SNAPSHOT
+google-http-client-protobuf:1.28.0:1.28.1-SNAPSHOT
+google-http-client-test:1.28.0:1.28.1-SNAPSHOT
+google-http-client-xml:1.28.0:1.28.1-SNAPSHOT
From 0a0e2051abb3c355f72c93e791d22511eca186e2 Mon Sep 17 00:00:00 2001
From: ajaaym <34161822+ajaaym@users.noreply.github.com>
Date: Sun, 10 Feb 2019 10:05:34 -0500
Subject: [PATCH 045/983] upgrade surefire plugin to fix SUREFIRE-1588 (#580)
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 3183185cf..1ef953dcb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -354,7 +354,7 @@
maven-surefire-plugin
- 2.19.1
+ 3.0.0-M3-Xmx1024msponge_log
From 09ccdf5b91562f88e598a4b7103a6425bfcea08f Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Sun, 10 Feb 2019 07:05:54 -0800
Subject: [PATCH 046/983] Update README.md with Java 7 support (#577)
---
README.md | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/README.md b/README.md
index 424e5b071..468a5efa7 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ content. The JSON and XML libraries are also fully pluggable, and they include s
The library supports the following Java environments:
-- Java 6 (or higher)
+- Java 7 (or higher)
- Android 4.0 (Ice Cream Sandwich) (or higher)
- GoogleAppEngine Google App Engine
@@ -47,16 +47,3 @@ Java 11 | [
-
-## Notice: Ending Java 6 Support
-
-Please note: since Java 6 extended support is being ended this December by Oracle, we will begin
-ending Java 6 support in early 2019, with release 1.28.0 as a tentative goal. Users may stay still
-use these libraries in Java 6 projects for some time, but going forward we will not ensure that
-these libraries work in such an environment. After 1.28.0, our supported versions will include Java
-7 and onward.
-
-For Android users, we will continue our 4.0 support.
-
-For questions or concerns, please file an issue in the GitHub repository.
-
From 16a0ec5edbe9f7a8dbfafeb04f4d63ecf958c274 Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Sun, 10 Feb 2019 07:06:07 -0800
Subject: [PATCH 047/983] Fix handling interrupted uploads (#572)
* Add failing test for an interrupted POST with response
* Try to parse the response if we get an IOException when writing content
* Adding missing unit test for handling IOException on socket close
---
.../client/http/javanet/NetHttpRequest.java | 15 +++
.../http/javanet/NetHttpRequestTest.java | 115 ++++++++++++++++++
2 files changed, 130 insertions(+)
diff --git a/google-http-client/src/main/java/com/google/api/client/http/javanet/NetHttpRequest.java b/google-http-client/src/main/java/com/google/api/client/http/javanet/NetHttpRequest.java
index cd92cac11..58850b794 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/javanet/NetHttpRequest.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/javanet/NetHttpRequest.java
@@ -117,6 +117,12 @@ LowLevelHttpResponse execute(final OutputWriter outputWriter) throws IOException
writeContentToOutputStream(outputWriter, out);
threw = false;
+ } catch (IOException e) {
+ // If we've gotten a response back, continue on and try to parse the response. Otherwise,
+ // re-throw the IOException
+ if (!hasReponse(connection)) {
+ throw e;
+ }
} finally {
try {
out.close();
@@ -150,6 +156,15 @@ LowLevelHttpResponse execute(final OutputWriter outputWriter) throws IOException
}
}
+ private boolean hasReponse(HttpURLConnection connection) {
+ try {
+ return connection.getResponseCode() > 0;
+ } catch (IOException e) {
+ // There's some exception trying to parse the response
+ return false;
+ }
+ }
+
private void writeContentToOutputStream(final OutputWriter outputWriter, final OutputStream out)
throws IOException {
if (writeTimeout == 0) {
diff --git a/google-http-client/src/test/java/com/google/api/client/http/javanet/NetHttpRequestTest.java b/google-http-client/src/test/java/com/google/api/client/http/javanet/NetHttpRequestTest.java
index 6839dfd76..d1a3e03cc 100644
--- a/google-http-client/src/test/java/com/google/api/client/http/javanet/NetHttpRequestTest.java
+++ b/google-http-client/src/test/java/com/google/api/client/http/javanet/NetHttpRequestTest.java
@@ -2,6 +2,7 @@
import com.google.api.client.http.HttpContent;
import com.google.api.client.http.InputStreamContent;
+import com.google.api.client.http.LowLevelHttpResponse;
import com.google.api.client.http.javanet.NetHttpRequest.OutputWriter;
import com.google.api.client.testing.http.HttpTesting;
import com.google.api.client.testing.http.javanet.MockHttpURLConnection;
@@ -82,4 +83,118 @@ private static void postWithTimeout(int timeout) throws Exception {
request.execute(new SleepingOutputWriter(5000L));
}
+ @Test
+ public void testInterruptedWriteWithResponse() throws Exception {
+ MockHttpURLConnection connection = new MockHttpURLConnection(new URL(HttpTesting.SIMPLE_URL)) {
+ @Override
+ public OutputStream getOutputStream() throws IOException {
+ return new OutputStream() {
+ @Override
+ public void write(int b) throws IOException {
+ throw new IOException("Error writing request body to server");
+ }
+ };
+ }
+ };
+ connection.setResponseCode(401);
+ connection.setRequestMethod("POST");
+ NetHttpRequest request = new NetHttpRequest(connection);
+ InputStream is = NetHttpRequestTest.class.getClassLoader().getResourceAsStream("file.txt");
+ HttpContent content = new InputStreamContent("text/plain", is);
+ request.setStreamingContent(content);
+
+ LowLevelHttpResponse response = request.execute();
+ assertEquals(401, response.getStatusCode());
+ }
+
+ @Test
+ public void testInterruptedWriteWithoutResponse() throws Exception {
+ MockHttpURLConnection connection = new MockHttpURLConnection(new URL(HttpTesting.SIMPLE_URL)) {
+ @Override
+ public OutputStream getOutputStream() throws IOException {
+ return new OutputStream() {
+ @Override
+ public void write(int b) throws IOException {
+ throw new IOException("Error writing request body to server");
+ }
+ };
+ }
+ };
+ connection.setRequestMethod("POST");
+ NetHttpRequest request = new NetHttpRequest(connection);
+ InputStream is = NetHttpRequestTest.class.getClassLoader().getResourceAsStream("file.txt");
+ HttpContent content = new InputStreamContent("text/plain", is);
+ request.setStreamingContent(content);
+
+ try {
+ request.execute();
+ fail("Expected to throw an IOException");
+ } catch (IOException e) {
+ assertEquals("Error writing request body to server", e.getMessage());
+ }
+ }
+
+ @Test
+ public void testInterruptedWriteErrorOnResponse() throws Exception {
+ MockHttpURLConnection connection = new MockHttpURLConnection(new URL(HttpTesting.SIMPLE_URL)) {
+ @Override
+ public OutputStream getOutputStream() throws IOException {
+ return new OutputStream() {
+ @Override
+ public void write(int b) throws IOException {
+ throw new IOException("Error writing request body to server");
+ }
+ };
+ }
+
+ @Override
+ public int getResponseCode() throws IOException {
+ throw new IOException("Error parsing response code");
+ }
+ };
+ connection.setRequestMethod("POST");
+ NetHttpRequest request = new NetHttpRequest(connection);
+ InputStream is = NetHttpRequestTest.class.getClassLoader().getResourceAsStream("file.txt");
+ HttpContent content = new InputStreamContent("text/plain", is);
+ request.setStreamingContent(content);
+
+ try {
+ request.execute();
+ fail("Expected to throw an IOException");
+ } catch (IOException e) {
+ assertEquals("Error writing request body to server", e.getMessage());
+ }
+ }
+
+ @Test
+ public void testErrorOnClose() throws Exception {
+ MockHttpURLConnection connection = new MockHttpURLConnection(new URL(HttpTesting.SIMPLE_URL)) {
+ @Override
+ public OutputStream getOutputStream() throws IOException {
+ return new OutputStream() {
+ @Override
+ public void write(int b) throws IOException {
+ return;
+ }
+
+ @Override
+ public void close() throws IOException {
+ throw new IOException("Error during close");
+ }
+ };
+ }
+ };
+ connection.setRequestMethod("POST");
+ NetHttpRequest request = new NetHttpRequest(connection);
+ InputStream is = NetHttpRequestTest.class.getClassLoader().getResourceAsStream("file.txt");
+ HttpContent content = new InputStreamContent("text/plain", is);
+ request.setStreamingContent(content);
+
+ try {
+ request.execute();
+ fail("Expected to throw an IOException");
+ } catch (IOException e) {
+ assertEquals("Error during close", e.getMessage());
+ }
+ }
}
From 970e998ee5e8445aae5ae24b4c3438cc184be242 Mon Sep 17 00:00:00 2001
From: Jeff Ching
Date: Sun, 10 Feb 2019 07:19:01 -0800
Subject: [PATCH 048/983] Cleanup assembly process. (#565)
* Build the dependencies report at package time.
* Pull dependencies.html files from the built modules
* Add google-http-client-apache properties
* Fix apache version
* Parameterize all the properties files
* Since we are repackaging jars here, we need to include the license files as we originally were.
---
google-http-client-assembly/assembly.xml | 93 ++-
.../dependencies/css/maven-base.css | 151 ----
.../dependencies/css/maven-theme.css | 141 ----
.../dependencies/css/print.css | 7 -
.../dependencies/css/site.css | 1 -
...ogle-http-client-android-dependencies.html | 588 --------------
...le-http-client-appengine-dependencies.html | 619 --------------
.../google-http-client-dependencies.html | 758 ------------------
.../google-http-client-gson-dependencies.html | 544 -------------
...ogle-http-client-jackson-dependencies.html | 544 -------------
...gle-http-client-jackson2-dependencies.html | 544 -------------
.../google-http-client-jdo-dependencies.html | 712 ----------------
...gle-http-client-protobuf-dependencies.html | 485 -----------
.../google-http-client-xml-dependencies.html | 519 ------------
.../dependencies/images/close.gif | Bin 279 -> 0 bytes
.../dependencies/images/collapsed.gif | Bin 53 -> 0 bytes
.../dependencies/images/expanded.gif | Bin 52 -> 0 bytes
.../dependencies/images/external.png | Bin 230 -> 0 bytes
.../dependencies/images/icon_error_sml.gif | Bin 1010 -> 0 bytes
.../dependencies/images/icon_info_sml.gif | Bin 606 -> 0 bytes
.../dependencies/images/icon_success_sml.gif | Bin 990 -> 0 bytes
.../dependencies/images/icon_warning_sml.gif | Bin 576 -> 0 bytes
.../images/logos/build-by-maven-black.png | Bin 2294 -> 0 bytes
.../images/logos/build-by-maven-white.png | Bin 2260 -> 0 bytes
.../images/logos/maven-feather.png | Bin 3330 -> 0 bytes
.../dependencies/images/newwindow.png | Bin 220 -> 0 bytes
.../APACHE-LICENSE.txt | 0
.../BSD-LICENSE.txt | 0
.../licenses/CDDL-LICENSE.txt | 119 +++
.../xpp3_LICENSE.txt | 0
google-http-client-assembly/pom.xml | 29 +-
.../google-http-client-apache.jar.properties | 1 +
.../gson.jar.properties} | 0
.../jackson-core-asl.jar.properties} | 0
.../jackson-core.jar.properties} | 0
.../protobuf-java.jar.properties} | 0
pom.xml | 18 +-
37 files changed, 236 insertions(+), 5637 deletions(-)
delete mode 100644 google-http-client-assembly/dependencies/css/maven-base.css
delete mode 100644 google-http-client-assembly/dependencies/css/maven-theme.css
delete mode 100644 google-http-client-assembly/dependencies/css/print.css
delete mode 100644 google-http-client-assembly/dependencies/css/site.css
delete mode 100644 google-http-client-assembly/dependencies/google-http-client-android-dependencies.html
delete mode 100644 google-http-client-assembly/dependencies/google-http-client-appengine-dependencies.html
delete mode 100644 google-http-client-assembly/dependencies/google-http-client-dependencies.html
delete mode 100644 google-http-client-assembly/dependencies/google-http-client-gson-dependencies.html
delete mode 100644 google-http-client-assembly/dependencies/google-http-client-jackson-dependencies.html
delete mode 100644 google-http-client-assembly/dependencies/google-http-client-jackson2-dependencies.html
delete mode 100644 google-http-client-assembly/dependencies/google-http-client-jdo-dependencies.html
delete mode 100644 google-http-client-assembly/dependencies/google-http-client-protobuf-dependencies.html
delete mode 100644 google-http-client-assembly/dependencies/google-http-client-xml-dependencies.html
delete mode 100644 google-http-client-assembly/dependencies/images/close.gif
delete mode 100644 google-http-client-assembly/dependencies/images/collapsed.gif
delete mode 100644 google-http-client-assembly/dependencies/images/expanded.gif
delete mode 100644 google-http-client-assembly/dependencies/images/external.png
delete mode 100644 google-http-client-assembly/dependencies/images/icon_error_sml.gif
delete mode 100644 google-http-client-assembly/dependencies/images/icon_info_sml.gif
delete mode 100644 google-http-client-assembly/dependencies/images/icon_success_sml.gif
delete mode 100644 google-http-client-assembly/dependencies/images/icon_warning_sml.gif
delete mode 100644 google-http-client-assembly/dependencies/images/logos/build-by-maven-black.png
delete mode 100644 google-http-client-assembly/dependencies/images/logos/build-by-maven-white.png
delete mode 100644 google-http-client-assembly/dependencies/images/logos/maven-feather.png
delete mode 100644 google-http-client-assembly/dependencies/images/newwindow.png
rename google-http-client-assembly/{dependencies => licenses}/APACHE-LICENSE.txt (100%)
rename google-http-client-assembly/{dependencies => licenses}/BSD-LICENSE.txt (100%)
create mode 100644 google-http-client-assembly/licenses/CDDL-LICENSE.txt
rename google-http-client-assembly/{dependencies => licenses}/xpp3_LICENSE.txt (100%)
create mode 100644 google-http-client-assembly/properties/google-http-client-apache.jar.properties
rename google-http-client-assembly/{android-properties/gson-2.1.jar.properties => properties/gson.jar.properties} (100%)
rename google-http-client-assembly/{android-properties/jackson-core-asl-1.9.13.jar.properties => properties/jackson-core-asl.jar.properties} (100%)
rename google-http-client-assembly/{android-properties/jackson-core-2.9.6.jar.properties => properties/jackson-core.jar.properties} (100%)
rename google-http-client-assembly/{android-properties/protobuf-java-2.6.1.jar.properties => properties/protobuf-java.jar.properties} (100%)
diff --git a/google-http-client-assembly/assembly.xml b/google-http-client-assembly/assembly.xml
index e20b89d80..be1385815 100644
--- a/google-http-client-assembly/assembly.xml
+++ b/google-http-client-assembly/assembly.xml
@@ -25,6 +25,7 @@
truegoogle-http-java-client
+
properties/google-http-client.jar.propertiesgoogle-http-client-${project.version}.jar.properties
@@ -37,6 +38,12 @@
google-http-java-client/libstrue
+
+ properties/google-http-client-apache.jar.properties
+ google-http-client-apache-${project.http-client-apache.version}.jar.properties
+ google-http-java-client/libs
+ true
+ properties/google-http-client-gson.jar.propertiesgoogle-http-client-gson-${project.version}.jar.properties
@@ -73,21 +80,93 @@
google-http-java-client/libstrue
+
+ properties/gson.jar.properties
+ gson-${project.gson.version}.jar.properties
+ google-http-java-client/libs
+ true
+
+
+ properties/jackson-core.jar.properties
+ jackson-core-${project.jackson-core2.version}.jar.properties
+ google-http-java-client/libs
+ true
+
+
+ properties/jackson-core-asl.jar.properties
+ jackson-core-asl-${project.jackson-core-asl.version}.jar.properties
+ google-http-java-client/libs
+ true
+
+
+ properties/protobuf-java.jar.properties
+ protobuf-java-${project.protobuf-java.version}.jar.properties
+ google-http-java-client/libs
+ true
+
+
+
+ ../google-http-client/target/site/dependencies.html
+ google-http-client-dependencies.html
+ google-http-java-client/dependencies
+
+
+ ../google-http-client-android/target/site/dependencies.html
+ google-http-client-android-dependencies.html
+ google-http-java-client/dependencies
+
+
+ ../google-http-client-apache/target/site/dependencies.html
+ google-http-client-apache-dependencies.html
+ google-http-java-client/dependencies
+
+
+ ../google-http-client-gson/target/site/dependencies.html
+ google-http-client-gson-dependencies.html
+ google-http-java-client/dependencies
+
+
+ ../google-http-client-jackson/target/site/dependencies.html
+ google-http-client-jackson-dependencies.html
+ google-http-java-client/dependencies
+
+
+ ../google-http-client-jackson2/target/site/dependencies.html
+ google-http-client-jackson2-dependencies.html
+ google-http-java-client/dependencies
+
+
+ ../google-http-client-jdo/target/site/dependencies.html
+ google-http-client-jdo-dependencies.html
+ google-http-java-client/dependencies
+
+
+ ../google-http-client-protobuf/target/site/dependencies.html
+ google-http-client-protobuf-dependencies.html
+ google-http-java-client/dependencies
+
+
+ ../google-http-client-xml/target/site/dependencies.html
+ google-http-client-xml-dependencies.html
+ google-http-java-client/dependencies
+
- dependencies
- google-http-java-client/dependencies
- true
+ target/site/css
+ google-http-java-client/dependencies/css
- target/libs
- google-http-java-client/libs
+ target/site/images
+ google-http-java-client/dependencies/images
+
+
+ licenses
+ google-oauth-java-client/dependencies
- android-properties
+ target/libsgoogle-http-java-client/libs
- truetarget/libs-sources
diff --git a/google-http-client-assembly/dependencies/css/maven-base.css b/google-http-client-assembly/dependencies/css/maven-base.css
deleted file mode 100644
index 584ba23be..000000000
--- a/google-http-client-assembly/dependencies/css/maven-base.css
+++ /dev/null
@@ -1,151 +0,0 @@
-body {
- margin: 0px;
- padding: 0px;
-}
-img {
- border:none;
-}
-table {
- padding:0px;
- width: 100%;
- margin-left: -2px;
- margin-right: -2px;
-}
-acronym {
- cursor: help;
- border-bottom: 1px dotted #feb;
-}
-table.bodyTable th, table.bodyTable td {
- padding: 2px 4px 2px 4px;
- vertical-align: top;
-}
-div.clear{
- clear:both;
- visibility: hidden;
-}
-div.clear hr{
- display: none;
-}
-#bannerLeft, #bannerRight {
- font-size: xx-large;
- font-weight: bold;
-}
-#bannerLeft img, #bannerRight img {
- margin: 0px;
-}
-.xleft, #bannerLeft img {
- float:left;
-}
-.xright, #bannerRight {
- float:right;
-}
-#banner {
- padding: 0px;
-}
-#banner img {
- border: none;
-}
-#breadcrumbs {
- padding: 3px 10px 3px 10px;
-}
-#leftColumn {
- width: 170px;
- float:left;
- overflow: auto;
-}
-#bodyColumn {
- margin-right: 1.5em;
- margin-left: 197px;
-}
-#legend {
- padding: 8px 0 8px 0;
-}
-#navcolumn {
- padding: 8px 4px 0 8px;
-}
-#navcolumn h5 {
- margin: 0;
- padding: 0;
- font-size: small;
-}
-#navcolumn ul {
- margin: 0;
- padding: 0;
- font-size: small;
-}
-#navcolumn li {
- list-style-type: none;
- background-image: none;
- background-repeat: no-repeat;
- background-position: 0 0.4em;
- padding-left: 16px;
- list-style-position: outside;
- line-height: 1.2em;
- font-size: smaller;
-}
-#navcolumn li.expanded {
- background-image: url(../images/expanded.gif);
-}
-#navcolumn li.collapsed {
- background-image: url(../images/collapsed.gif);
-}
-#poweredBy {
- text-align: center;
-}
-#navcolumn img {
- margin-top: 10px;
- margin-bottom: 3px;
-}
-#poweredBy img {
- display:block;
- margin: 20px 0 20px 17px;
-}
-#search img {
- margin: 0px;
- display: block;
-}
-#search #q, #search #btnG {
- border: 1px solid #999;
- margin-bottom:10px;
-}
-#search form {
- margin: 0px;
-}
-#lastPublished {
- font-size: x-small;
-}
-.navSection {
- margin-bottom: 2px;
- padding: 8px;
-}
-.navSectionHead {
- font-weight: bold;
- font-size: x-small;
-}
-.section {
- padding: 4px;
-}
-#footer {
- padding: 3px 10px 3px 10px;
- font-size: x-small;
-}
-#breadcrumbs {
- font-size: x-small;
- margin: 0pt;
-}
-.source {
- padding: 12px;
- margin: 1em 7px 1em 7px;
-}
-.source pre {
- margin: 0px;
- padding: 0px;
-}
-#navcolumn img.imageLink, .imageLink {
- padding-left: 0px;
- padding-bottom: 0px;
- padding-top: 0px;
- padding-right: 2px;
- border: 0px;
- margin: 0px;
-}
diff --git a/google-http-client-assembly/dependencies/css/maven-theme.css b/google-http-client-assembly/dependencies/css/maven-theme.css
deleted file mode 100644
index c982168bf..000000000
--- a/google-http-client-assembly/dependencies/css/maven-theme.css
+++ /dev/null
@@ -1,141 +0,0 @@
-body {
- padding: 0px 0px 10px 0px;
-}
-body, td, select, input, li{
- font-family: Verdana, Helvetica, Arial, sans-serif;
- font-size: 13px;
-}
-code{
- font-family: Courier, monospace;
- font-size: 13px;
-}
-a {
- text-decoration: none;
-}
-a:link {
- color:#36a;
-}
-a:visited {
- color:#47a;
-}
-a:active, a:hover {
- color:#69c;
-}
-#legend li.externalLink {
- background: url(../images/external.png) left top no-repeat;
- padding-left: 18px;
-}
-a.externalLink, a.externalLink:link, a.externalLink:visited, a.externalLink:active, a.externalLink:hover {
- background: url(../images/external.png) right center no-repeat;
- padding-right: 18px;
-}
-#legend li.newWindow {
- background: url(../images/newwindow.png) left top no-repeat;
- padding-left: 18px;
-}
-a.newWindow, a.newWindow:link, a.newWindow:visited, a.newWindow:active, a.newWindow:hover {
- background: url(../images/newwindow.png) right center no-repeat;
- padding-right: 18px;
-}
-h2 {
- padding: 4px 4px 4px 6px;
- border: 1px solid #999;
- color: #900;
- background-color: #ddd;
- font-weight:900;
- font-size: x-large;
-}
-h3 {
- padding: 4px 4px 4px 6px;
- border: 1px solid #aaa;
- color: #900;
- background-color: #eee;
- font-weight: normal;
- font-size: large;
-}
-h4 {
- padding: 4px 4px 4px 6px;
- border: 1px solid #bbb;
- color: #900;
- background-color: #fff;
- font-weight: normal;
- font-size: large;
-}
-h5 {
- padding: 4px 4px 4px 6px;
- color: #900;
- font-size: normal;
-}
-p {
- line-height: 1.3em;
- font-size: small;
-}
-#breadcrumbs {
- border-top: 1px solid #aaa;
- border-bottom: 1px solid #aaa;
- background-color: #ccc;
-}
-#leftColumn {
- margin: 10px 0 0 5px;
- border: 1px solid #999;
- background-color: #eee;
-}
-#navcolumn h5 {
- font-size: smaller;
- border-bottom: 1px solid #aaaaaa;
- padding-top: 2px;
- color: #000;
-}
-
-table.bodyTable th {
- color: white;
- background-color: #bbb;
- text-align: left;
- font-weight: bold;
-}
-
-table.bodyTable th, table.bodyTable td {
- font-size: 1em;
-}
-
-table.bodyTable tr.a {
- background-color: #ddd;
-}
-
-table.bodyTable tr.b {
- background-color: #eee;
-}
-
-.source {
- border: 1px solid #999;
-}
-dl {
- padding: 4px 4px 4px 6px;
- border: 1px solid #aaa;
- background-color: #ffc;
-}
-dt {
- color: #900;
-}
-#organizationLogo img, #projectLogo img, #projectLogo span{
- margin: 8px;
-}
-#banner {
- border-bottom: 1px solid #fff;
-}
-.errormark, .warningmark, .donemark, .infomark {
- background: url(../images/icon_error_sml.gif) no-repeat;
-}
-
-.warningmark {
- background-image: url(../images/icon_warning_sml.gif);
-}
-
-.donemark {
- background-image: url(../images/icon_success_sml.gif);
-}
-
-.infomark {
- background-image: url(../images/icon_info_sml.gif);
-}
-
diff --git a/google-http-client-assembly/dependencies/css/print.css b/google-http-client-assembly/dependencies/css/print.css
deleted file mode 100644
index 26ad7f0b5..000000000
--- a/google-http-client-assembly/dependencies/css/print.css
+++ /dev/null
@@ -1,7 +0,0 @@
-#banner, #footer, #leftcol, #breadcrumbs, .docs #toc, .docs .courtesylinks, #leftColumn, #navColumn {
- display: none !important;
-}
-#bodyColumn, body.docs div.docs {
- margin: 0 !important;
- border: none !important
-}
diff --git a/google-http-client-assembly/dependencies/css/site.css b/google-http-client-assembly/dependencies/css/site.css
deleted file mode 100644
index 055e7e286..000000000
--- a/google-http-client-assembly/dependencies/css/site.css
+++ /dev/null
@@ -1 +0,0 @@
-/* You can override this file with your own styles */
\ No newline at end of file
diff --git a/google-http-client-assembly/dependencies/google-http-client-android-dependencies.html b/google-http-client-assembly/dependencies/google-http-client-android-dependencies.html
deleted file mode 100644
index 694fd327c..000000000
--- a/google-http-client-assembly/dependencies/google-http-client-android-dependencies.html
+++ /dev/null
@@ -1,588 +0,0 @@
-
-
-
-
-
- Project Dependencies
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Last Published: 2018-08-20
- | Version: ${project.version}
-
The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:
The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:
Description: The codec package contains simple encoder and decoders for
- various formats such as Base64 and Hexadecimal. In addition to these
- widely used encoders and decoders, the codec package also maintains a
- collection of phonetic encoding utilities.
Description: There is currently no description associated with this project.
-
Project License: No license is defined for this project.
-
xpp3:xpp3:jar:1.1.4c (provided)
-
-
-
MXP1: Xml Pull Parser 3rd Edition (XPP3)
-
-
-
Description: MXP1 is a stable XmlPull parsing engine that is based on ideas from XPP and in particular XPP2 but completely revised and rewritten to take the best advantage of latest JIT JVMs such as Hotspot in JDK 1.4+.
Description: JSON (JavaScript Object Notation) is a lightweight data-interchange format.
- It is easy for humans to read and write. It is easy for machines to parse and generate.
- It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition
- - December 1999. JSON is a text format that is completely language independent but uses
- conventions that are familiar to programmers of the C-family of languages, including C, C++, C#,
- Java, JavaScript, Perl, Python, and many others.
- These properties make JSON an ideal data-interchange language.
Description: Google HTTP Client Library for Java. Functionality that works on all supported Java platforms,
- including Java 5 (or higher) desktop (SE) and web (EE), Android, and Google App Engine.
Apache Software License, version 1.1: MXP1: Xml Pull Parser 3rd Edition (XPP3)
-
Public Domain: MXP1: Xml Pull Parser 3rd Edition (XPP3)
-
Unknown: xmlParserAPIs
-
Apache License, Version 2.0: Apache HttpClient, Apache HttpCore
-
provided without support or warranty: JSON (JavaScript Object Notation)
-
Apache 2.0: Google Android Java ME Library (Khronos), Google Android Library
-
The Apache Software License, Version 2.0: Android Platform Extensions to the Google HTTP Client Library for Java., Commons Codec, Commons Logging, FindBugs-jsr305, Google HTTP Client Library for Java, J2ObjC Annotations
-
Indiana University Extreme! Lab Software License, vesion 1.1.1: MXP1: Xml Pull Parser 3rd Edition (XPP3)
The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:
Description: Google HTTP Client Library for Java. Functionality that works on all supported Java platforms,
- including Java 5 (or higher) desktop (SE) and web (EE), Android, and Google App Engine.
Description: The codec package contains simple encoder and decoders for
- various formats such as Base64 and Hexadecimal. In addition to these
- widely used encoders and decoders, the codec package also maintains a
- collection of phonetic encoding utilities.
Description: Guava is a suite of core and expanded libraries that include
- utility classes, google's collections, io classes, and much
- much more.
-
- Guava has only one code dependency - javax.annotation,
- per the JSR-305 spec.
Google App Engine Terms of Service: appengine-api-1.0-sdk, appengine-api-stubs, appengine-testing
-
Apache License, Version 2.0: Apache HttpClient, Apache HttpCore
-
Common Public License Version 1.0: JUnit
-
The Apache Software License, Version 2.0: Apache Commons Logging, Commons Codec, FindBugs-jsr305, Google App Engine extensions to the Google HTTP Client Library for Java., Google HTTP Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, Shared classes used for testing of artifacts in the Google HTTP Client Library for Java.
The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:
The following is a list of provided dependencies for this project. These dependencies are required to compile the application, but should be provided by default when using the library:
Description: Google HTTP Client Library for Java. Functionality that works on all supported Java platforms,
- including Java 5 (or higher) desktop (SE) and web (EE), Android, and Google App Engine.
Description: There is currently no description associated with this project.
-
Project License: No license is defined for this project.
-
xpp3:xpp3:jar:1.1.4c (provided)
-
-
-
MXP1: Xml Pull Parser 3rd Edition (XPP3)
-
-
-
Description: MXP1 is a stable XmlPull parsing engine that is based on ideas from XPP and in particular XPP2 but completely revised and rewritten to take the best advantage of latest JIT JVMs such as Hotspot in JDK 1.4+.
Description: Guava is a suite of core and expanded libraries that include
- utility classes, google's collections, io classes, and much
- much more.
-
- Guava has only one code dependency - javax.annotation,
- per the JSR-305 spec.
Description: The codec package contains simple encoder and decoders for
- various formats such as Base64 and Hexadecimal. In addition to these
- widely used encoders and decoders, the codec package also maintains a
- collection of phonetic encoding utilities.
Apache Software License, version 1.1: MXP1: Xml Pull Parser 3rd Edition (XPP3)
-
Public Domain: MXP1: Xml Pull Parser 3rd Edition (XPP3)
-
Unknown: xmlParserAPIs
-
Apache License, Version 2.0: Apache HttpClient, Apache HttpCore
-
Common Public License Version 1.0: JUnit
-
Apache 2.0: Google Android Java ME Library (Khronos), Google Android Library, error-prone annotations
-
The Apache Software License, Version 2.0: Commons Codec, Commons Logging, FindBugs-jsr305, Google HTTP Client Library for Java, Guava Testing Library, Guava: Google Core Libraries for Java, J2ObjC Annotations, Truth Core, java-diff-utils
-
The MIT License: Mockito
-
Indiana University Extreme! Lab Software License, vesion 1.1.1: MXP1: Xml Pull Parser 3rd Edition (XPP3)
Description: Google HTTP Client Library for Java. Functionality that works on all supported Java platforms,
- including Java 5 (or higher) desktop (SE) and web (EE), Android, and Google App Engine.
Description: The codec package contains simple encoder and decoders for
- various formats such as Base64 and Hexadecimal. In addition to these
- widely used encoders and decoders, the codec package also maintains a
- collection of phonetic encoding utilities.
Description: Guava is a suite of core and expanded libraries that include
- utility classes, google's collections, io classes, and much
- much more.
-
- Guava has only one code dependency - javax.annotation,
- per the JSR-305 spec.
Apache License, Version 2.0: Apache HttpClient, Apache HttpCore
-
Common Public License Version 1.0: JUnit
-
The Apache Software License, Version 2.0: Apache Commons Logging, Commons Codec, FindBugs-jsr305, GSON extensions to the Google HTTP Client Library for Java., Google HTTP Client Library for Java, Gson, Guava: Google Core Libraries for Java, J2ObjC Annotations, Shared classes used for testing of artifacts in the Google HTTP Client Library for Java.
Description: Google HTTP Client Library for Java. Functionality that works on all supported Java platforms,
- including Java 5 (or higher) desktop (SE) and web (EE), Android, and Google App Engine.
Description: The codec package contains simple encoder and decoders for
- various formats such as Base64 and Hexadecimal. In addition to these
- widely used encoders and decoders, the codec package also maintains a
- collection of phonetic encoding utilities.
Description: Guava is a suite of core and expanded libraries that include
- utility classes, google's collections, io classes, and much
- much more.
-
- Guava has only one code dependency - javax.annotation,
- per the JSR-305 spec.
Apache License, Version 2.0: Apache HttpClient, Apache HttpCore
-
Common Public License Version 1.0: JUnit
-
The Apache Software License, Version 2.0: Apache Commons Logging, Commons Codec, FindBugs-jsr305, Google HTTP Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, Jackson, Jackson extensions to the Google HTTP Client Library for Java., Shared classes used for testing of artifacts in the Google HTTP Client Library for Java.
Description: Google HTTP Client Library for Java. Functionality that works on all supported Java platforms,
- including Java 5 (or higher) desktop (SE) and web (EE), Android, and Google App Engine.
Description: The codec package contains simple encoder and decoders for
- various formats such as Base64 and Hexadecimal. In addition to these
- widely used encoders and decoders, the codec package also maintains a
- collection of phonetic encoding utilities.
Description: Guava is a suite of core and expanded libraries that include
- utility classes, google's collections, io classes, and much
- much more.
-
- Guava has only one code dependency - javax.annotation,
- per the JSR-305 spec.
Apache License, Version 2.0: Apache HttpClient, Apache HttpCore
-
Common Public License Version 1.0: JUnit
-
The Apache Software License, Version 2.0: Apache Commons Logging, Commons Codec, FindBugs-jsr305, Google HTTP Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, Jackson 2 extensions to the Google HTTP Client Library for Java., Jackson-core, Shared classes used for testing of artifacts in the Google HTTP Client Library for Java.
Description: Google HTTP Client Library for Java. Functionality that works on all supported Java platforms,
- including Java 5 (or higher) desktop (SE) and web (EE), Android, and Google App Engine.
Description: The codec package contains simple encoder and decoders for
- various formats such as Base64 and Hexadecimal. In addition to these
- widely used encoders and decoders, the codec package also maintains a
- collection of phonetic encoding utilities.
Description: The Java Data Objects 2 (JDO) API is a standard interface-based Java model abstraction of persistence, developed as Java Specification Request 243 under the auspices of the Java Community Process.
Description: There is currently no description associated with this project.
-
Project License: No license is defined for this project.
-
org.datanucleus:datanucleus-core:jar:3.2.2 (test)
-
-
-
DataNucleus Core
-
-
-
Description: DataNucleus Core provides the primary components of a heterogenous Java persistence solution.
- It supports persistence API's being layered on top of the core functionality.
Description: Guava is a suite of core and expanded libraries that include
- utility classes, google's collections, io classes, and much
- much more.
-
- Guava has only one code dependency - javax.annotation,
- per the JSR-305 spec.
Apache License, Version 2.0: Apache HttpClient, Apache HttpCore
-
Common Public License Version 1.0: JUnit
-
The Apache Software License, Version 2.0: Apache Commons Logging, Commons Codec, DataNucleus Core, DataNucleus JDO API plugin, DataNucleus RDBMS, FindBugs-jsr305, Google HTTP Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, JDO extensions to the Google HTTP Client Library for Java., Shared classes used for testing of artifacts in the Google HTTP Client Library for Java.
-
The GNU General Public License, Version 2: MySQL Connector/J
Description: Google HTTP Client Library for Java. Functionality that works on all supported Java platforms,
- including Java 5 (or higher) desktop (SE) and web (EE), Android, and Google App Engine.
Description: The codec package contains simple encoder and decoders for
- various formats such as Base64 and Hexadecimal. In addition to these
- widely used encoders and decoders, the codec package also maintains a
- collection of phonetic encoding utilities.
Apache License, Version 2.0: Apache HttpClient, Apache HttpCore
-
Common Public License Version 1.0: JUnit
-
The Apache Software License, Version 2.0: Apache Commons Logging, Commons Codec, FindBugs-jsr305, Google HTTP Client Library for Java, J2ObjC Annotations, Protocol Buffer extensions to the Google HTTP Client Library for Java.
Description: Google HTTP Client Library for Java. Functionality that works on all supported Java platforms,
- including Java 5 (or higher) desktop (SE) and web (EE), Android, and Google App Engine.
Description: The codec package contains simple encoder and decoders for
- various formats such as Base64 and Hexadecimal. In addition to these
- widely used encoders and decoders, the codec package also maintains a
- collection of phonetic encoding utilities.
Description: MXP1 is a stable XmlPull parsing engine that is based on ideas from XPP and in particular XPP2 but completely revised and rewritten to take the best advantage of latest JIT JVMs such as Hotspot in JDK 1.4+.
Description: Guava is a suite of core and expanded libraries that include
- utility classes, google's collections, io classes, and much
- much more.
-
- Guava has only one code dependency - javax.annotation,
- per the JSR-305 spec.
Apache Software License, version 1.1: MXP1: Xml Pull Parser 3rd Edition (XPP3)
-
Public Domain: MXP1: Xml Pull Parser 3rd Edition (XPP3)
-
Apache License, Version 2.0: Apache HttpClient, Apache HttpCore
-
Common Public License Version 1.0: JUnit
-
The Apache Software License, Version 2.0: Apache Commons Logging, Commons Codec, FindBugs-jsr305, Google HTTP Client Library for Java, Guava: Google Core Libraries for Java, J2ObjC Annotations, XML extensions to the Google HTTP Client Library for Java.
-
Indiana University Extreme! Lab Software License, vesion 1.1.1: MXP1: Xml Pull Parser 3rd Edition (XPP3)
-
-
-
diff --git a/google-http-client-assembly/dependencies/images/close.gif b/google-http-client-assembly/dependencies/images/close.gif
deleted file mode 100644
index 1c26bbc5264fcc943ad7b5a0f1a84daece211f34..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 279
zcmZ?wbhEHb6kyFkwP}e}6+mLp=yE)H5&?6cps==O-j2#K*@61O)i|`#U%|*xTD17#Qg5
z>nkWI$ji$M2ng`=^D}^ygDj#2&;c6F0P+h1n~g(5frm~PL&uV$l`S$eFDwzBDbhJD
v>}Bvw*Al_tWna1PC9OaGVdk23i}vRhZI{iR^*V|n<^22a#~T_O9T}_vbswrX
diff --git a/google-http-client-assembly/dependencies/images/collapsed.gif b/google-http-client-assembly/dependencies/images/collapsed.gif
deleted file mode 100644
index 6e710840640c1bfd9dd76ce7fef56f1004092508..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 53
ycmZ?wbhEHbWM^P!XkdT>#h)yUTnvm1Iv_qshJlI4r7uBZ*YkPFU8d4p4Aua}2?(?R
diff --git a/google-http-client-assembly/dependencies/images/expanded.gif b/google-http-client-assembly/dependencies/images/expanded.gif
deleted file mode 100644
index 0fef3d89e0df1f8bc49a0cd827f2607c7d7fd2f0..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 52
xcmZ?wbhEHbWM^P!XkdT>#h)yUTnvm1Iv_qshJlH@g}+fUi&t{amUB!D)&R0C2fzRT
diff --git a/google-http-client-assembly/dependencies/images/external.png b/google-http-client-assembly/dependencies/images/external.png
deleted file mode 100644
index 3f999fc88b360074e41f38c3b4bc06ccb3bb7cf8..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 230
zcmeAS@N?(olHy`uVBq!ia0vp^+(699!3-oX?^2ToQY`6?zK#qG>ra@ocD)4hB}-f*
zN`mv#O3D+9QW+dm@{>{(JaZG%Q-e|yQz{EjrrH1%@dWsUxR#cd{{R1fCIbVIy!atN
z8e~{WkY6y6%iy53@(Yk3;OXKRQgJIOfsI*BO@UFsfhWLBc>*(#PB?Jn2*(o!76E4F
z2oaVU3``tH+Kgs0GI5+@Tg}d)z%jd%F@?{8!SRZ5b1yT80-FZIMn)zc2Ca66y`pzY
R*nwsJMCn#OVEqF*oew~oaAu*+mN;-=y?VHT3tIe$XQqrDo-uB_a
z!$aaK`z6))OKGn34?nwc^SuifkIL#EmDgV_qjg-#8v*0u4q4%1moUw{LZ54UeCgzNF^jX`uv-XK+9g@yFrG9?@
z!9&5&Tgk*j(b!GF&{N4I-Owl3GNQ;Kslp@APSw&&&ux9d>WxL~{EYoKm2KHvv3+ax
zZUYB?Ae*8JnchZheXeEaa>@87?_fB*jV>(`erUx0B6j@wa!KnN)QWMO1rn9HC8
zQU}Tt3>@bftT|;oHYhlHH8T8tc{qL2LBC1&wnQeg^-S05<#H=J%;q~&KX!$OXH$lP
zifQJ#9>L8|xhAVRHT-xPa*}7JK>(A*!AmL!CQC~j>707p+C5b#ib-SZ5@wfn#-0y8
zor_pb3M^%mkXhlduwjw4dk@RWhYZ<*tSUAV9x3eYyi#^d39lH{872xT#>g14FgCZb
z+Lvv}DClhGVU*`8y(Qe}(9I>Lw<6->0~Q`zX3oMH2272dBARI`0wDzxS_G8b_H+a`
TZ#n2*^y*Bf^Krq04Gh)*dSnrT
diff --git a/google-http-client-assembly/dependencies/images/icon_info_sml.gif b/google-http-client-assembly/dependencies/images/icon_info_sml.gif
deleted file mode 100644
index c6cb9ad7ce438a798426703e86a7ffc197d51dbb..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 606
zcmZ?wbhEHb!Rj)7jHhhdgsOUdoQoueZi?7
z>>gViTe&E#V48n=mrru5S3;v}WQB8hiDz7$TU2Fg8RZkU)J)l4H+4sO@7jjxJ4?G(<~7c1nYFul=C0P+d#d`@bj{yi
z-npcE!T#Qb2PP~z)H;3B%r(bntUlH>Y2~CvyV|C%UbyM>vTf&9?!2&e&!siHFV0_c
zVB`KP8}?n^dg$7Yqc`@PxOMQ%-NWbZ9Xfk=)1K2OFF!hV;r{6>kIr6ua^~ve%eS9j
zy7lbD`I|4_et!J??bq+WzI^-n`RfmdkOIfh!pgqYwSCK`t~@$#!^!1aj_y2mzyI{@?vuB79>2N$==JkApPs$`_~ygc*YCf)diVLp
z{pXKfy#M&+`?nvze*gIk#Q*;N0|qHLXbBUFKUo+V7>XElKuSSz!oa?}p{S|3rL`#`
zEj=M8CWV#D$GthOu#hRgfH^NPHz`Z6or!6tudIJkhF|)EqL_SUmH;#E=*;vU)ut4d
z*}1MJ+3|6yK5|W*0YQlwY}}E_93D;*P3)($(!#iHyj&dYc$?gAB*f@)n?~7Mn)5Ze
zB*b!gs&gB@F*e|Da`5(ac688Lp~TGAEh5PBlHo`4aV}w%hy?;49h(#+>`NXTD0Bjy;4ci{C-1K14rU#4Xoa9{m6qopA9n0cn|!>ecYkij
zwyX=!4*mH3EoqLqSGiVbyFqxD(bS8XSDu{6U1jZO70Ic@{~t&7=B^
zBD)NOoAkU&Gy^LQJ5PtV?u{&65}4ZUmfYbweP{LTy^YnAGv=AGa7*6wj}%~b0?7r5!@qH7P%p1*$L
z@#{ODxoUwG+WsY)zWExj-aqxpQS(e!bx&6L`u)?tfB$~}{{8*?cVO&*V`-G2NeC$Z
zWMO1r=w{FXnGVVm3>>=|#5rX=HY{-DP?VFNPL-%m%>B+*~5-k^-+4*MLFr;tQ0}^rlS-^!^Q`Mx1hrB$jwn&hk~Xk=#Nl+_9Nu|Y$D
G!5RQ;-6)O#
diff --git a/google-http-client-assembly/dependencies/images/icon_warning_sml.gif b/google-http-client-assembly/dependencies/images/icon_warning_sml.gif
deleted file mode 100644
index 873bbb52cb9768103c27fbb9a9bac16ac615fce5..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 576
zcmZ?wbhEHbB!Sy%bj7w
z8LP{2I!WYbmF&-Ixi?j6tD|K1XR2M#l>Aw*aXL%wXS3nYW}{zi=4WzsU5r%E6qx+#
za{AThd85YVOsT`KDUrWsBtGknIa3>Sy(4;AS@f^Dxt>-=XPXm#FD(1Lr2hBv=9?3X
zZS^!XrNw@)>eiN((2|w-y>{aB1+99DGMA?}+UTggT+(Z*rf8+5x~aWVOGcurtl;&U
zIa)H3IvwvQjJBn`YHj9iKlB7`)(M#!e{yWMO1rC}Yq8NrU2qfqia6SyOXMYa1sM
zM_a34eqyRfcQbQJY;^IYGTuzaxglKLqNQEA}OiQec+sQ#rUUjLqg_MpsPmY43
zsgmVV8EHK$eV-B~6*UcAW2+w%1e4o&9#aAczLGF}PmMg|6J0Ey4q
A)Bpeg
diff --git a/google-http-client-assembly/dependencies/images/logos/build-by-maven-black.png b/google-http-client-assembly/dependencies/images/logos/build-by-maven-black.png
deleted file mode 100644
index 919fd0f66a7f713920dd7422035db1c9d484351d..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 2294
zcmVKOG`!VuDc=fnx$+R6#>c^>b&wcOS?|$!`a}U6ptjU_J
zlBA}l*3{J0)YMd0R~Hr*dU$xO^ie1jhYlTLS+=C4#MRYRCX#twGUSD6Il$6AA+=UAlkY(ZF;m4037Yc>v&!1mPsNXdliHV74&z>zUEv=}iC@U)i
zfc^XTJ3BiAKvYyzczAd~K){|od(ip)`}f`5-HnZnv$L~Hzqq=(y7Kb!>gsAwPfu@e
z@3gcu0LabFC4?{xBNPh18Fpy3+Tr2hfq{Yc_V$w}PjVdhGtMTH$zU){PfznaPmK)?
z4KH52=;-KZX=#a#jlFZ{PF7YH!!Q{c8Taqs=Xt)UsK{tE{@>vc{2Hgh!NL0adH}e0
z@19Df^78Tm0ES@zz{SO7Zf@=upJ1_AP_bIAgpih&mWqmsojZ4GG#a&9{f)&Au~_Wm
z<0F^L4;(mPHk)-io!M*-3JMa7#VIK%EBy%}_$g6IPEM9cBvPp~K0f}{t5+6_rMbEJ
z(xpqcZ{G$0j^p<2+vnuu^bN3MdU`rLJ3Br;9ss7MrVbuFxUjHLQBhGX6WriQ5|M*_w
z@5bUDdV71dTCG;AO-@dx@4a~OA{y)K>k+2N$jAo|9?w
z?b_+nr`2k;!{M;o?Qh<^`R=>#RtFA0KR<`Vfh)Li;|5+X!otGn&U<@%H*VaBDU;Gf
zr_<5=()7Iqfmk>yLj`}084`48Zf?d|M~)mpOHfeI{QNv2WMN?;Dk=&9GBY#LVzb%$
z`};Aq6GAK&OK4~)&U*g*IT{xh7M8K~%9SgtQ-;OG#ZeC5ym=F=X|vf(9h#b&K7RZN
z05+S=X0xGjU|@g-%ePwl!GC`7t=5VDruDp`t9rXwq=tAb*88KQqo~N`a#V_oixKzA
z%F4dJzL1cRy1F{CSUfW`qfjWeZ{Hpm7>H$yNF>V6&c<>vGBOgU_w@7}J9g~o(WA6z
z#sgc0B0VlH4i&T6{Pyiz)FUDys6$s*7rnXCi!3z)!0DGJ5eITHyM2Q|E@qtti{QRD
z*nbiZg+h^&lY>QINl6I+oH}*N-Q67kYHMqqoSd*@fE67^695Pa36aTU0HD+95)%{g
zFw)c0Gcqy&K&4WxG906$qk6p_b=txpgmiazqaGF(M)NU+!{3cPsc^{*a`Ja$nXfZ@
zhsL%N4whw0OG`2M6&4oG&CQ8KBHBPHC@3f>C|I^a>__(qFp!^RU
zV`F0uhl6EVxm><`_ijATmoHz|)ztxjL?XdmSuB<(Po5A$mM!w}C3kdS~ef}W>dub-Hhz&fI`vJ#oXvTST@?6qsxN=r)tz|+%n^XARiL+I)0
z!HGL|?4Z?OC@z>ppO+fmk
zEDIk1FgrV2R8&O&@;qNwR)+h@$;nZx)dqvXVzG2}b>-#d_4oHa!G&Dp59OYMg
zd;9A2I}{29&+|ObzkB!Y^XJcKjE;^*({SomlT)I^E^_90Q{xPG;bvU;38ml
zcng&pTZhKxAmAX-{xuvUBO`bZu-omWrKK8;X6fkl>(@`5I6;GyySuwkDCBv*tE;QE
zwH1kg)0Ijk1~{Qms8A@Vadob6a=9D}VUx-9>C-1l1S|^dcDq`w#&Z*k#hB*+K%>#n
z=0$)zo8T)X1Ujc}V+Omw8!O@%0GKp7%(fp1ER{;7QYogYiHQlT)w*&q5{X2iP;A
ziQ~ALnVErs0SsXP;O*^=-E5ssr_<^1YYGSmz*119QvKuu*JMrBk
diff --git a/google-http-client-assembly/dependencies/images/logos/build-by-maven-white.png b/google-http-client-assembly/dependencies/images/logos/build-by-maven-white.png
deleted file mode 100644
index 7d44c9c2e5742bdf8649ad282f83208f1da9b982..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 2260
zcmV;_2rKuAP)4hTLUyOQ{PVbVY5&Y3g!&hN~bnR7}ZgkXUt
ziC%zU0gf+&kEv>t|d$x|zXw1mS0D%1b{8z7DF%0wW-8(XBFc`A3vVI|O
z^!N97baWg(eE86zLn4uA_wL=Zb@+UKU|=8sJb3V6XlSUctSl!dhm4xd=KJ^W|8h2q
zR4NS%3yX+|NKQ`f?d=7Cf`Wo)&z=E5TU%REQIXYZefjbwRvsQ6zIyfQojZ3l8V#{v
zv)R(q)39Vr2GBPsa+apV2%%fIZY3ln0Kl+1Y8c*(xe3X6sWFH9kH*UDDLl)ZN`}u~;f9D%P!A2LK5P2`MQl
z(b3TuDUC++_U+qm01k;n!Z1u+TwGjS+}X2d^Yil+3Pn;B-~q
z{Qdm_z{kf&EEb1^gw)j3R904!x}#RBj~+c578Vv16olc}xpQZGd;7k9`>@WHD_2M|
z{%VB2fNVCK&1U^_rTW_bx`C@MK&%ZR^ybZ*=;&yb
zN);0mV>X+~OA`|lRVtNAr7A8i#zL)DyJycHxm+$5izO0?QmM?$%p@6le0*H3R;yI1
z=;-LCrlu1oPI!8HIypHhmCA~Wig|;>WHON!GbSbmcN`jxhJ=GssnlpRR;zVzaF8J4
z>+3sJhW@0w{LH6-`(Afr<9kMWBXoSUM7Dox&JGJtojOI96z3EG
z*uH)HWN?qO7x!`hzQnzLg5JL3Ui^ps%X$n4`+YK2S-yNZo>gC8kJmXUC#D?-i_a7IlwdR(Kkw#T>s)<(
zJ!ZVTycREBO!{t;H9|r{F#q)FQ_`LjAsBnPnnKk2PZ;V3*7{M#@%jyBNObh|^_fg2
zd|f0I3eTTEPf=83VhUbHWgRft|{%MRRMp6H>seM7wV6&k5Vn7H0DDSDT_wn(;aaUDU
zWi%QoiptK;CgqIWB$bwy78Mm?w@oI~&6_tPBO~$kExCLno}10)mX;RGM?^%-PjqOt
zTFi(#=@4C7NJmxEVK7l6G0yhEp_Lq9)1fj}S-2%Mdrv$L~tStVt%xVSheDG9e5EX$6J
zj8GIMm&=bIKaK;TqoYG05D0}r0!Kqb1E0?q2n1`_uAR{_f0E{OgnR$~y~Sd|+0n_#
z2@6L?MsUQ^H0|QzLJoDKqobtlneyk|8`Sp{cp}PUC5RRQ^8?;2;Iss$eWk%*n3$Nr
z(73v~e)3}s219#$yTM=(2n6o#?!LahxUO>?H!v`O%bZ*;$Ideh!!Qg0h{fVXix$lf
i91DLtEx@rr0RIK2cl{g~?Z1Nn0000}s
diff --git a/google-http-client-assembly/dependencies/images/logos/maven-feather.png b/google-http-client-assembly/dependencies/images/logos/maven-feather.png
deleted file mode 100644
index b5ada836e9eb4af4db810f648b013933e72c8fbe..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 3330
zcmX9>c{JN;_x~o5Ac>t)`_^PEV{L6MNl>(?QcG&7ly=N-Xep}HlEki6%d`xGQff?J
zZ3V5?nxMK^TW!%rlc2Oi#TE&YeBaFbd(OGfJqdI`
zc>}=J0{}qD0)QP*?7suRWeWiKhXeo)6#$?b`+NA18vvk_kGT^3lRrj~)ZiX~E=7&X
z2SKm_0zsnO+$cbVdd$U-?NJjv4pVQ1Nhjly1q-WLl67`_;z%v-QHPc;g_!S~IRE^{
z!-r;4Azogl1_mw!0>pbvoPqVZ9U2s5dwy6sHa1p4L7^@xJ3CvqEtc6=V;Sjo`SKw`
zH=oaUc5x93g$)f2RLqLwrQCI9Ez?$q{#(_7txem8O7-r(E=u3NrnVzb>g3;N!E`D4
z$F(MEarBhUUxI^!j~_>3u~Bhx7JsSR*w|dSa6vbc*_R&srRM|ftV?XHdFb}1C$WrQ
zvCqw{t=r+KeZT{28=Et|SGiR|Ew_)PCPc7HL$FRx^tIjT!gS^&HZAG+)pJ^j_L!yB
z-&JbQI5tJZ0TS}9l}GV-#=yY9@UZdW!+Wo8V)3OP+M~kh8Cox&UgiEXkb|OHrtnt7
z^5^7qoPgd(mzSp^UljFw^Ea1#($jleS~zn<*Qt%~?;g8p7T$+e1_e6_0RivD9i_fn
zntBj|S0D{TF>ZC0BjrC=O}^<#pa0LS&uvarfWzp2`pUd__f_%7YV~7dt=r6SgMYpk
zjT&tozdBVDfMU+}3PBKu{I@a0eE%y;<26%LfpraXnsz78oRL+ASlucsJ9Ov}^-cnR
z?X0S*D(PH#SsA1;IVGjHr-u@pc=<9LQ|*-QU~8*d0k5yGUszbEsHmW5uYUjj;c@h|
zc=i>Ql~f4Q{2jFogTeH_k#4q)N#10=x?L3lT5fn+n;f?)a5}#)D(b9?5F`jW*8R2B
zY10|kzu50Yt-pEkr?pP=J)v#j+39IETXnv??EKOqdr`^I$PR$!+i*wr^07q=V|W
zRr`cRLkwol7wvCgY>XVWV#HBVP$e>vs8#}bhe8j(d*@G*O1g5TCFF^jnVIZQvS`z%
z5v0FEpQe3XqLbN{Z+4@!!}?n1jYn$VqUAWElr$a=d)NRcr?dxiBP0c$a4eq)C6kW}
zg`-#3YZthl;XEcu_;g!xn!}4v15@n5*WxOpB14=8A8Dk>`K
z>FLRD7bsziv>lNxci1YB3`T!HV#jF&kvayv7^9-Sg&l|eQ^qB(FU%g~JDx-!K6@(Waovi+Tc$s`@s@Sv*
z9p0C*!~5#c{h1>d>@N5DL);Ea=d|PU4}@o
zGdG0Ng%R<9V_jn-yfB3nD7kxXb8!sMIXlJ1WeD*5?60hT&XSa)+yVTVl9iP_o8v^w8_0650v?-3$V0uILqsvdAu+2y6|YCewgNhga^h4Y-lNq0Cah}ivo
zpoq6EpmWSceZAoF%B5UfVPU3op{AfPhFM{FSFJMU!)c~SDTMch@trf6$~-E;5xn-d
z<8`e~UPj0w%vDYVje(iQii)`c=wzHbR6^djAF^dnW5A}!CD-JMWyVHEkW;BwukLPq
z9nsR%B=!TuB0vQ|DPO#J@zkle(n^?>&z)~)XSMt|Ks2+uT9af6QEqK-hanLX5&&xP
z-l-<%m`WTuBR<~hh#iYkQxoQNXtTFvX)i0JF_1Iu5Wn+7^XJlfPFX+T%IM9_7+4B=%5Y=a!X6S`QV)~knSitusE`|vEgD?+D*SdgtN-v
z@2!tnPsQ$W9OoldXg5!7EGfyuKEmbk%8!pz518D&%P>a8*ji>n+N5Y15QI!N3aw76
zk?~TlC_r^z21V(@jrIB2O=fW{*e;OxLwTOl%b7{65NYoUzv46uU?y1WK`h1$gXk#s
zGM!NC1T6)2&vea(*Gjoe-Y0OseT68UKVi7GtWs>+{mTm3?9wmCl9JqVL7fcIg7PHy
zS|uV8fd^!W2I;)j*_@ml#-BrjgIWH)bTI&Jf1fXAax!YjYcdmoW44Np%MhjRZR?D*fO!{1UqRj~p#EAohT=T-17$$k6AmQb(
zr9h0V!aUsY=NL_BPmf|~=n=+2*+gqRK=3w1+z;yxltfUx%}G^AqM7qBoD>Zu#))>h
z(O-H}7=Go_Xv&X~RNksk#{u}JDqbNyJIauD&lJ!>cpV`%&T(-`&1Vx}=
z8{BIG$r-+Li5}_#{j}s%FlGk$jM1|WKp=Pv|*T=m!~I+rUjJ3F@7W!gumQD8RFwVZryr0
zG6IWssk0)%eJuVTRDtKPo&xDaOWF|RzCnozye=JYW-)oDFHKrbK}AL7sWkcH57B~D
zWIZ`=QNK#g)SEJB!`69JGO3P=r08pDX))Bb6t@_;R!2TlYhv>Ek*cIBeDucB
zNbDTV5C(L01Ze7}3Kc7OC~(zLdAV~G`9N+1xB3ie(wD=k6U
z@g3gU065J9XPq{lyp>keB&(ixxdnV8$%i$asL6b0O)JUdYtCpuubGB*DbEFHXlQtp
zXgMTG%@{+j0dI{Adnj6-$)BcQylA>}r~l(e_1pE-*`Eac5PAGF#EWMIO6;2ECZAeo
ziPF85kd7Ft6f{I>ZQIUbf5YND4#d%gJpKl~IaM@Xl!bUvZj*0lQRvUOOhugnVG
zMF7OiLdS5a+otCLNQI8V^8vu3ka8NP_S>32`v3S)2n{Pe(fRVLdLST=H+AiBqCTY3
zZWI=>Zsgp=`Z%jG=8)QMYZO=@1A#!)z2kiwpnq3DhkpUGZV&>CeaB0vA>Y6+Mrd+|
zrA52d@P7Qe=6m=0Lz-`5yrGM(x*9Y0sP7_5T2*v`@~JgS7L3#>yY-7x_MJ+9`9JqyEa*$Q0
ziiL%hken<6A7+&3D;!0f@qP3TvIRVoufv)c8?&aw&B~1Y(02aUpDjK7B)cSkx8QDV
zQMj_M+x+$UXOfa)nmweB@KP^Xm2R7$9(p;LCnufvW}*eG4R>Eak)Ei}%-KE8gsec^
zj=HuX
z(qyBjd`DTC3ZeF2!np?{CKA-DtE=Op^zuqOJMFU}UTntQB1KKp81%{!bT~6heKA2v
zt?`kF-Zi+k^YcNCz>V!+^RbV}r|Gp2j0+=crL`N5t}4tX=Ugo&7+C6ua?F4oX!wQ+)83@^vkY
zDLFc>n(A(&_r09T&@t7l6XQ+b#6#=gA#14-D;h1Uq<(+=C8$D8`D^qmZ
z9NOcdL`OIEho{GDl585|eQ0-*j0e6Rr=PNtyozBAqJr
diff --git a/google-http-client-assembly/dependencies/images/newwindow.png b/google-http-client-assembly/dependencies/images/newwindow.png
deleted file mode 100644
index 6287f72bd08a870908e7361d98c35ee0d6dcbc82..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 220
zcmeAS@N?(olHy`uVBq!ia0vp^+(699!3-oX?^2ToQY`6?zK#qG>ra@ocD)4hB}-f*
zN`mv#O3D+9QW+dm@{>{(JaZG%Q-e|yQz{EjrrH1%@dWsUxR#cd&SYTt4+aeuCvSob
zD+%%o1`04ZXs!GLj7%Iec?BF2%&y2ZFfeUwWbk2P5nvW+xWT~4#-PT{uyM;F);OSv44$rjF6*2U
FngH~|K)3(^
diff --git a/google-http-client-assembly/dependencies/APACHE-LICENSE.txt b/google-http-client-assembly/licenses/APACHE-LICENSE.txt
similarity index 100%
rename from google-http-client-assembly/dependencies/APACHE-LICENSE.txt
rename to google-http-client-assembly/licenses/APACHE-LICENSE.txt
diff --git a/google-http-client-assembly/dependencies/BSD-LICENSE.txt b/google-http-client-assembly/licenses/BSD-LICENSE.txt
similarity index 100%
rename from google-http-client-assembly/dependencies/BSD-LICENSE.txt
rename to google-http-client-assembly/licenses/BSD-LICENSE.txt
diff --git a/google-http-client-assembly/licenses/CDDL-LICENSE.txt b/google-http-client-assembly/licenses/CDDL-LICENSE.txt
new file mode 100644
index 000000000..1154e0aee
--- /dev/null
+++ b/google-http-client-assembly/licenses/CDDL-LICENSE.txt
@@ -0,0 +1,119 @@
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
+
+1. Definitions.
+
+1.1. Contributor means each individual or entity that creates or contributes to the creation of Modifications.
+
+1.2. Contributor Version means the combination of the Original Software, prior Modifications used by a Contributor (if any), and the Modifications made by that particular Contributor.
+
+1.3. Covered Software means (a) the Original Software, or (b) Modifications, or (c) the combination of files containing Original Software with files containing Modifications, in each case including portions thereof.
+
+1.4. Executable means the Covered Software in any form other than Source Code.
+
+1.5. Initial Developer means the individual or entity that first makes Original Software available under this License.
+
+1.6. Larger Work means a work which combines Covered Software or portions thereof with code not governed by the terms of this License.
+
+1.7. License means this document.
+
+1.8. Licensable means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein.
+
+1.9. Modifications means the Source Code and Executable form of any of the following:
+
+A. Any file that results from an addition to, deletion from or modification of the contents of a file containing Original Software or previous Modifications;
+
+B. Any new file that contains any part of the Original Software or previous Modification; or
+
+C. Any new file that is contributed or otherwise made available under the terms of this License.
+
+1.10. Original Software means the Source Code and Executable form of computer software code that is originally released under this License.
+
+1.11. Patent Claims means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor.
+
+1.12. Source Code means (a) the common form of computer software code in which modifications are made and (b) associated documentation included in or with such code.
+
+1.13. You (or Your) means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, You includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, control means (a)�the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b)�ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.
+
+2. License Grants.
+
+2.1. The Initial Developer Grant.
+Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, the Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license:
+(a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer, to use, reproduce, modify, display, perform, sublicense and distribute the Original Software (or portions thereof), with or without Modifications, and/or as part of a Larger Work; and
+(b) under Patent Claims infringed by the making, using or selling of Original Software, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Software (or portions thereof).
+(c) The licenses granted in Sections�2.1(a) and (b) are effective on the date Initial Developer first distributes or otherwise makes the Original Software available to a third party under the terms of this License.
+(d) Notwithstanding Section�2.1(b) above, no patent license is granted: (1)�for code that You delete from the Original Software, or (2)�for infringements caused by: (i)�the modification of the Original Software, or (ii)�the combination of the Original Software with other software or devices.
+
+2.2. Contributor Grant.
+Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license:
+(a) under intellectual property rights (other than patent or trademark) Licensable by Contributor to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof), either on an unmodified basis, with other Modifications, as Covered Software and/or as part of a Larger Work; and
+(b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: (1)�Modifications made by that Contributor (or portions thereof); and (2)�the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination).
+(c) The licenses granted in Sections�2.2(a) and 2.2(b) are effective on the date Contributor first distributes or otherwise makes the Modifications available to a third party.
+(d) Notwithstanding Section�2.2(b) above, no patent license is granted: (1)�for any code that Contributor has deleted from the Contributor Version; (2)�for infringements caused by: (i)�third party modifications of Contributor Version, or (ii)�the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or (3)�under Patent Claims infringed by Covered Software in the absence of Modifications made by that Contributor.
+
+3. Distribution Obligations.
+
+3.1. Availability of Source Code.
+
+Any Covered Software that You distribute or otherwise make available in Executable form must also be made available in Source Code form and that Source Code form must be distributed only under the terms of this License. You must include a copy of this License with every copy of the Source Code form of the Covered Software You distribute or otherwise make available. You must inform recipients of any such Covered Software in Executable form as to how they can obtain such Covered Software in Source Code form in a reasonable manner on or through a medium customarily used for software exchange.
+
+3.2. Modifications.
+
+The Modifications that You create or to which You contribute are governed by the terms of this License. You represent that You believe Your Modifications are Your original creation(s) and/or You have sufficient rights to grant the rights conveyed by this License.
+
+3.3. Required Notices.
+You must include a notice in each of Your Modifications that identifies You as the Contributor of the Modification. You may not remove or alter any copyright, patent or trademark notices contained within the Covered Software, or any notices of licensing or any descriptive text giving attribution to any Contributor or the Initial Developer.
+
+3.4. Application of Additional Terms.
+You may not offer or impose any terms on any Covered Software in Source Code form that alters or restricts the applicable version of this License or the recipients rights hereunder. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, you may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear that any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer.
+
+3.5. Distribution of Executable Versions.
+You may distribute the Executable form of the Covered Software under the terms of this License or under the terms of a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable form does not attempt to limit or alter the recipients rights in the Source Code form from the rights set forth in this License. If You distribute the Covered Software in Executable form under a different license, You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer.
+
+3.6. Larger Works.
+You may create a Larger Work by combining Covered Software with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Software.
+
+4. Versions of the License.
+
+4.1. New Versions.
+Sun Microsystems, Inc. is the initial license steward and may publish revised and/or new versions of this License from time to time. Each version will be given a distinguishing version number. Except as provided in Section 4.3, no one other than the license steward has the right to modify this License.
+
+4.2. Effect of New Versions.
+
+You may always continue to use, distribute or otherwise make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. If the Initial Developer includes a notice in the Original Software prohibiting it from being distributed or otherwise made available under any subsequent version of the License, You must distribute and make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. Otherwise, You may also choose to use, distribute or otherwise make the Covered Software available under the terms of any subsequent version of the License published by the license steward.
+4.3. Modified Versions.
+
+When You are an Initial Developer and You want to create a new license for Your Original Software, You may create and use a modified version of this License if You: (a)�rename the license and remove any references to the name of the license steward (except to note that the license differs from this License); and (b)�otherwise make it clear that the license contains terms which differ from this License.
+
+5. DISCLAIMER OF WARRANTY.
+
+COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN AS IS BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+6. TERMINATION.
+
+6.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive.
+
+6.2. If You assert a patent infringement claim (excluding declaratory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You assert such claim is referred to as Participant) alleging that the Participant Software (meaning the Contributor Version where the Participant is a Contributor or the Original Software where the Participant is the Initial Developer) directly or indirectly infringes any patent, then any and all rights granted directly or indirectly to You by such Participant, the Initial Developer (if the Initial Developer is not the Participant) and all Contributors under Sections�2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively and automatically at the expiration of such 60 day notice period, unless if within such 60 day period You withdraw Your claim with respect to the Participant Software against such Participant either unilaterally or pursuant to a written agreement with Participant.
+
+6.3. In the event of termination under Sections�6.1 or 6.2 above, all end user licenses that have been validly granted by You or any distributor hereunder prior to termination (excluding licenses granted to You by any distributor) shall survive termination.
+
+7. LIMITATION OF LIABILITY.
+
+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTYS NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
+
+8. U.S. GOVERNMENT END USERS.
+
+The Covered Software is a commercial item, as that term is defined in 48�C.F.R.�2.101 (Oct. 1995), consisting of commercial computer software (as that term is defined at 48 C.F.R. �252.227-7014(a)(1)) and commercial computer software documentation as such terms are used in 48�C.F.R.�12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Software with only those rights set forth herein. This U.S. Government Rights clause is in lieu of, and supersedes, any other FAR, DFAR, or other clause or provision that addresses Government rights in computer software under this License.
+
+9. MISCELLANEOUS.
+
+This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by the law of the jurisdiction specified in a notice contained within the Original Software (except to the extent applicable law, if any, provides otherwise), excluding such jurisdictions conflict-of-law provisions. Any litigation relating to this License shall be subject to the jurisdiction of the courts located in the jurisdiction and venue specified in a notice contained within the Original Software, with the losing party responsible for costs, including, without limitation, court costs and reasonable attorneys fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. You agree that You alone are responsible for compliance with the United States export administration regulations (and the export control laws and regulation of any other countries) when You use, distribute or otherwise make available any Covered Software.
+
+10. RESPONSIBILITY FOR CLAIMS.
+
+As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability.
+
+NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL)
+The GlassFish code released under the CDDL shall be governed by the laws of the State of California (excluding conflict-of-law provisions). Any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California and the state courts of the State of California, with venue lying in Santa Clara County, California.
+
+
+
diff --git a/google-http-client-assembly/dependencies/xpp3_LICENSE.txt b/google-http-client-assembly/licenses/xpp3_LICENSE.txt
similarity index 100%
rename from google-http-client-assembly/dependencies/xpp3_LICENSE.txt
rename to google-http-client-assembly/licenses/xpp3_LICENSE.txt
diff --git a/google-http-client-assembly/pom.xml b/google-http-client-assembly/pom.xml
index 77cd50430..66977db1d 100644
--- a/google-http-client-assembly/pom.xml
+++ b/google-http-client-assembly/pom.xml
@@ -20,15 +20,15 @@
com.google.http-client
- google-http-client-appengine
+ google-http-client-androidcom.google.http-client
- google-http-client-android
+ google-http-client-apachecom.google.http-client
- google-http-client-protobuf
+ google-http-client-appenginecom.google.http-client
@@ -46,6 +46,10 @@
com.google.http-clientgoogle-http-client-jdo
+
+ com.google.http-client
+ google-http-client-protobuf
+ com.google.http-clientgoogle-http-client-xml
@@ -53,19 +57,6 @@
-
-
-
- maven-assembly-plugin
-
-
- assembly.xml
-
- google-http-java-client
-
-
-
- maven-dependency-plugin
@@ -108,6 +99,12 @@
+
+
+ assembly.xml
+
+ google-http-java-client
+
diff --git a/google-http-client-assembly/properties/google-http-client-apache.jar.properties b/google-http-client-assembly/properties/google-http-client-apache.jar.properties
new file mode 100644
index 000000000..4046b3a73
--- /dev/null
+++ b/google-http-client-assembly/properties/google-http-client-apache.jar.properties
@@ -0,0 +1 @@
+src=../libs-sources/google-http-client-apache-${project.http-client-apache.version}-sources.jar
diff --git a/google-http-client-assembly/android-properties/gson-2.1.jar.properties b/google-http-client-assembly/properties/gson.jar.properties
similarity index 100%
rename from google-http-client-assembly/android-properties/gson-2.1.jar.properties
rename to google-http-client-assembly/properties/gson.jar.properties
diff --git a/google-http-client-assembly/android-properties/jackson-core-asl-1.9.13.jar.properties b/google-http-client-assembly/properties/jackson-core-asl.jar.properties
similarity index 100%
rename from google-http-client-assembly/android-properties/jackson-core-asl-1.9.13.jar.properties
rename to google-http-client-assembly/properties/jackson-core-asl.jar.properties
diff --git a/google-http-client-assembly/android-properties/jackson-core-2.9.6.jar.properties b/google-http-client-assembly/properties/jackson-core.jar.properties
similarity index 100%
rename from google-http-client-assembly/android-properties/jackson-core-2.9.6.jar.properties
rename to google-http-client-assembly/properties/jackson-core.jar.properties
diff --git a/google-http-client-assembly/android-properties/protobuf-java-2.6.1.jar.properties b/google-http-client-assembly/properties/protobuf-java.jar.properties
similarity index 100%
rename from google-http-client-assembly/android-properties/protobuf-java-2.6.1.jar.properties
rename to google-http-client-assembly/properties/protobuf-java.jar.properties
diff --git a/pom.xml b/pom.xml
index 1ef953dcb..4b3506679 100644
--- a/pom.xml
+++ b/pom.xml
@@ -178,7 +178,7 @@
com.google.http-clientgoogle-http-client-apache
- ${project.http-client.version}
+ ${project.http-client-apache.version}com.google.http-client
@@ -543,12 +543,26 @@
+
+
+ maven-project-info-reports-plugin
+ 3.0.0
+
+
+
+ dependencies
+
+ package
+
+
+ org.sonatype.pluginsnexus-staging-maven-plugin
+
+ 1.27.1-SNAPSHOT1.28.1-SNAPSHOT
+ 2.0.1-SNAPSHOT1.9.64UTF-83.0.2
From 3ad95676107febdf8a5f48659233ef89c078e619 Mon Sep 17 00:00:00 2001
From: ajaaym <34161822+ajaaym@users.noreply.github.com>
Date: Sun, 10 Feb 2019 10:22:27 -0500
Subject: [PATCH 049/983] Add option to return raw stream from response (#579)
* Add option to return raw stream
* fix formatting
---
.../google/api/client/http/HttpRequest.java | 35 +++++++++++++++++++
.../google/api/client/http/HttpResponse.java | 7 +++-
.../api/client/http/HttpResponseTest.java | 23 ++++++++++++
3 files changed, 64 insertions(+), 1 deletion(-)
diff --git a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
index 91a9c8a01..939a4dcdd 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
@@ -224,6 +224,16 @@ static String executeAndGetValueOfSomeCustomHeader(HttpRequest request) {
/** OpenCensus tracing component. */
private final Tracer tracer = OpenCensusUtils.getTracer();
+ /**
+ * Determines whether {@link HttpResponse#getContent()} of this request should return raw
+ * input stream or not.
+ *
+ *
+ * It is {@code false} by default.
+ *
+ */
+ private boolean responseReturnRawInputStream = false;
+
/**
* @param transport HTTP transport
* @param requestMethod HTTP request method or {@code null} for none
@@ -835,6 +845,31 @@ public HttpRequest setSuppressUserAgentSuffix(boolean suppressUserAgentSuffix) {
return this;
}
+ /**
+ * Returns whether {@link HttpResponse#getContent()} should return raw input stream for this
+ * request.
+ *
+ * @since 1.29
+ */
+ public boolean getResponseReturnRawInputStream() {
+ return responseReturnRawInputStream;
+ }
+
+ /**
+ * Sets whether {@link HttpResponse#getContent()} should return raw input stream for this
+ * request.
+ *
+ *
+ * The default value is {@code false}.
+ *
+ *
+ * @since 1.29
+ */
+ public HttpRequest setResponseReturnRawInputStream(boolean responseReturnRawInputStream) {
+ this.responseReturnRawInputStream = responseReturnRawInputStream;
+ return this;
+ }
+
/**
* Execute the HTTP request and returns the HTTP response.
*
diff --git a/google-http-client/src/main/java/com/google/api/client/http/HttpResponse.java b/google-http-client/src/main/java/com/google/api/client/http/HttpResponse.java
index 64e8986b1..01aea6d83 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/HttpResponse.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/HttpResponse.java
@@ -82,6 +82,9 @@ public final class HttpResponse {
/** HTTP request. */
private final HttpRequest request;
+ /** Whether {@link #getContent()} should return raw input stream. */
+ private final boolean returnRawInputStream;
+
/**
* Determines the limit to the content size that will be logged during {@link #getContent()}.
*
@@ -118,6 +121,7 @@ public final class HttpResponse {
HttpResponse(HttpRequest request, LowLevelHttpResponse response) throws IOException {
this.request = request;
+ this.returnRawInputStream = request.getResponseReturnRawInputStream();
contentLoggingLimit = request.getContentLoggingLimit();
loggingEnabled = request.isLoggingEnabled();
this.response = response;
@@ -359,7 +363,8 @@ public InputStream getContent() throws IOException {
try {
// gzip encoding (wrap content with GZipInputStream)
String contentEncoding = this.contentEncoding;
- if (contentEncoding != null && contentEncoding.contains("gzip")) {
+ if (!returnRawInputStream && contentEncoding != null && contentEncoding
+ .contains("gzip")) {
lowLevelResponseContent = new GZIPInputStream(lowLevelResponseContent);
}
// logging (wrap content with LoggingInputStream)
diff --git a/google-http-client/src/test/java/com/google/api/client/http/HttpResponseTest.java b/google-http-client/src/test/java/com/google/api/client/http/HttpResponseTest.java
index 6f6835d88..9a2bd43b6 100644
--- a/google-http-client/src/test/java/com/google/api/client/http/HttpResponseTest.java
+++ b/google-http-client/src/test/java/com/google/api/client/http/HttpResponseTest.java
@@ -29,6 +29,7 @@
import java.text.NumberFormat;
import java.util.Arrays;
import java.util.logging.Level;
+import java.util.zip.GZIPInputStream;
import junit.framework.TestCase;
/**
@@ -400,4 +401,26 @@ public LowLevelHttpResponse execute() throws IOException {
transport.createRequestFactory().buildHeadRequest(HttpTesting.SIMPLE_GENERIC_URL);
request.execute().getContent();
}
+
+ public void testGetContent_gzipEncoding_ReturnRawStream() throws IOException {
+ HttpTransport transport = new MockHttpTransport() {
+ @Override
+ public LowLevelHttpRequest buildRequest(String method, final String url) throws IOException {
+ return new MockLowLevelHttpRequest() {
+ @Override
+ public LowLevelHttpResponse execute() throws IOException {
+ MockLowLevelHttpResponse result = new MockLowLevelHttpResponse();
+ result.setContent("");
+ result.setContentEncoding("gzip");
+ result.setContentType("text/plain");
+ return result;
+ }
+ };
+ }
+ };
+ HttpRequest request =
+ transport.createRequestFactory().buildHeadRequest(HttpTesting.SIMPLE_GENERIC_URL);
+ request.setResponseReturnRawInputStream(true);
+ assertFalse("it should not decompress stream", request.execute().getContent() instanceof GZIPInputStream);
+ }
}
From 7e99da2d5ce71db5dbe0783688490e054bb7e4ac Mon Sep 17 00:00:00 2001
From: Elliotte Rusty Harold
Date: Sun, 10 Feb 2019 10:54:54 -0500
Subject: [PATCH 050/983] remove datanucleus (#480)
---
google-http-client-jdo/pom.xml | 52 ----------------------------------
pom.xml | 19 -------------
2 files changed, 71 deletions(-)
diff --git a/google-http-client-jdo/pom.xml b/google-http-client-jdo/pom.xml
index f17e19d43..35714fb10 100644
--- a/google-http-client-jdo/pom.xml
+++ b/google-http-client-jdo/pom.xml
@@ -45,43 +45,6 @@
-
- org.datanucleus
- datanucleus-maven-plugin
- ${project.datanucleus-maven-plugin.version}
-
- JDO
- true
-
-
-
- org.datanucleus
- datanucleus-core
- ${project.datanucleus-core.version}
- runtime
-
-
- org.datanucleus
- datanucleus-api-jdo
- ${project.datanucleus-api-jdo.version}
- runtime
-
-
- javax.jdo
- jdo2-api
- ${project.jdo2-api.version}
- runtime
-
-
-
-
- process-classes
-
- enhance
-
-
-
-
@@ -103,21 +66,6 @@
javax.jdojdo2-api
-
- org.datanucleus
- datanucleus-core
- test
-
-
- org.datanucleus
- datanucleus-api-jdo
- test
-
-
- org.datanucleus
- datanucleus-rdbms
- test
- mysqlmysql-connector-java
diff --git a/pom.xml b/pom.xml
index 4b3506679..4e7f76fb0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -240,21 +240,6 @@
jdo2-api${project.jdo2-api.version}
-
- org.datanucleus
- datanucleus-core
- ${project.datanucleus-core.version}
-
-
- org.datanucleus
- datanucleus-api-jdo
- ${project.datanucleus-api-jdo.version}
-
-
- org.datanucleus
- datanucleus-rdbms
- ${project.datanucleus-rdbms.version}
- mysqlmysql-connector-java
@@ -588,10 +573,6 @@
1.1.14.5.52.3-eb
- 3.2.2
- 3.2.1
- 3.2.1
- 4.0.30.18.0..
From 76e88f616d4e28bfb0ccef2c6abfe52f6a2d9606 Mon Sep 17 00:00:00 2001
From: Elliotte Rusty Harold
Date: Mon, 11 Feb 2019 08:13:18 -0500
Subject: [PATCH 051/983] ignore Mac Finder metadata (#587)
---
.gitignore | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index 8dd2d40af..542fed8d1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,4 +5,4 @@ bin/
.project
.settings
.classpath
-
+.DS_Store
From cbecf1f27477819e658957b412048870a351c53b Mon Sep 17 00:00:00 2001
From: andrey-qlogic <44769745+andrey-qlogic@users.noreply.github.com>
Date: Wed, 13 Feb 2019 17:50:28 +0300
Subject: [PATCH 052/983] 372: Changed SingleThreadExecutor to
FixedThreadPool(1). (#588)
* 372: Changed SingleThreadExecutor to FixedThreadPool(1).
* 372: Use a deamon thread that the requests do not block jvm shutdown.
---
.../main/java/com/google/api/client/http/HttpRequest.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
index 939a4dcdd..2e949625e 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java
@@ -23,6 +23,7 @@
import com.google.api.client.util.StreamingContent;
import com.google.api.client.util.StringUtils;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
import io.opencensus.common.Scope;
import io.opencensus.contrib.http.util.HttpTraceAttributeConstants;
import io.opencensus.trace.AttributeValue;
@@ -1200,14 +1201,15 @@ public HttpResponse call() throws Exception {
/**
* {@link Beta}
* Executes this request asynchronously using {@link #executeAsync(Executor)} in a single separate
- * thread using {@link Executors#newSingleThreadExecutor()}.
+ * thread using {@link Executors#newFixedThreadPool(1)}.
*
* @return A future for accessing the results of the asynchronous request.
* @since 1.13
*/
@Beta
public Future executeAsync() {
- return executeAsync(Executors.newSingleThreadExecutor());
+ return executeAsync(
+ Executors.newFixedThreadPool(1, new ThreadFactoryBuilder().setDaemon(true).build()));
}
/**
From 8a444b08aa82377e518e787f9cce667d5011ef60 Mon Sep 17 00:00:00 2001
From: Elliotte Rusty Harold
Date: Wed, 13 Feb 2019 09:50:37 -0500
Subject: [PATCH 053/983] fix comment (#590)
---
google-http-client-appengine/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/google-http-client-appengine/pom.xml b/google-http-client-appengine/pom.xml
index ae03f7995..935e3bc7b 100644
--- a/google-http-client-appengine/pom.xml
+++ b/google-http-client-appengine/pom.xml
@@ -36,7 +36,7 @@
-
+
org.codehaus.mojoanimal-sniffer-maven-plugin
From 8e5a7bb52a90e5dc32d570ba91eb19e86af93846 Mon Sep 17 00:00:00 2001
From: andrey-qlogic <44769745+andrey-qlogic@users.noreply.github.com>
Date: Wed, 13 Feb 2019 17:51:28 +0300
Subject: [PATCH 054/983] Implement equals and Hashcode on GenericData (#589)
* 936: Added hashCode(), toString() and equals() methods relaing on classInfo and unknownFields.
* 936: Changes after review.
* 936: Modified unit test.
* 936: Added more unit tests.
* 936: GenericJsonTest fixed because toString was updated in GenericData.
* 936: Changes after review.
* Update GenericData.java
---
.../google/api/client/util/GenericData.java | 23 ++++++++
.../api/client/json/GenericJsonTest.java | 2 +-
.../api/client/util/GenericDataTest.java | 57 ++++++++++++++++++-
3 files changed, 79 insertions(+), 3 deletions(-)
diff --git a/google-http-client/src/main/java/com/google/api/client/util/GenericData.java b/google-http-client/src/main/java/com/google/api/client/util/GenericData.java
index 6d1b5b14a..7596a7b61 100644
--- a/google-http-client/src/main/java/com/google/api/client/util/GenericData.java
+++ b/google-http-client/src/main/java/com/google/api/client/util/GenericData.java
@@ -20,6 +20,7 @@
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
@@ -196,6 +197,28 @@ public final void setUnknownKeys(Map unknownFields) {
this.unknownFields = unknownFields;
}
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) {
+ return true;
+ }
+ if (o == null || !(o instanceof GenericData)) {
+ return false;
+ }
+ GenericData that = (GenericData) o;
+ return super.equals(that) && Objects.equals(this.classInfo, that.classInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), classInfo);
+ }
+
+ @Override
+ public String toString() {
+ return "GenericData{" + "classInfo=" + classInfo.names + ", " + super.toString() + "}";
+ }
+
/**
* Returns the class information.
*
diff --git a/google-http-client/src/test/java/com/google/api/client/json/GenericJsonTest.java b/google-http-client/src/test/java/com/google/api/client/json/GenericJsonTest.java
index 662e6e129..5d56eae40 100644
--- a/google-http-client/src/test/java/com/google/api/client/json/GenericJsonTest.java
+++ b/google-http-client/src/test/java/com/google/api/client/json/GenericJsonTest.java
@@ -26,6 +26,6 @@ public class GenericJsonTest extends TestCase {
public void testToString_noFactory() {
GenericJson data = new GenericJson();
data.put("a", "b");
- assertEquals("{a=b}", data.toString());
+ assertEquals("GenericData{classInfo=[], {a=b}}", data.toString());
}
}
diff --git a/google-http-client/src/test/java/com/google/api/client/util/GenericDataTest.java b/google-http-client/src/test/java/com/google/api/client/util/GenericDataTest.java
index 4daf1bf3f..9dabe8298 100644
--- a/google-http-client/src/test/java/com/google/api/client/util/GenericDataTest.java
+++ b/google-http-client/src/test/java/com/google/api/client/util/GenericDataTest.java
@@ -48,13 +48,66 @@ public void setFieldB(List fieldB) {
}
}
+ private class GenericData1 extends GenericData {
+ public GenericData1() {
+ super(EnumSet.of(Flags.IGNORE_CASE));
+ }
+
+ @Key("FieldA")
+ public String fieldA;
+ }
+
+ private class GenericData2 extends GenericData {
+ public GenericData2() {
+ super(EnumSet.of(Flags.IGNORE_CASE));
+ }
+
+ @Key("FieldA")
+ public String fieldA;
+ }
+
+ public void testEquals_Symmetric() {
+ GenericData actual = new GenericData1();
+ actual.set("fieldA", "bar");
+ GenericData expected = new GenericData2();
+ // Test that objects are equal.
+ expected.set("fieldA", "bar");
+ assertNotSame(expected, actual);
+ assertTrue(expected.equals(expected) && actual.equals(actual));
+ // Test that objects not are equal.
+ expected.set("fieldA", "far");
+ assertFalse(expected.equals(actual) || actual.equals(expected));
+ assertFalse(expected.hashCode() == actual.hashCode());
+ }
+
+ public void testEquals_SymmetricWithSameClass() {
+ GenericData actual = new MyData();
+ actual.set("fieldA", "bar");
+ GenericData expected = new MyData();
+ // Test that objects are equal.
+ expected.set("fieldA", "bar");
+ assertNotSame(expected, actual);
+ assertTrue(expected.equals(expected) && actual.equals(actual));
+ assertTrue(expected.hashCode() == expected.hashCode());
+ }
+
+ public void testNotEquals_SymmetricWithSameClass() {
+ GenericData actual = new MyData();
+ actual.set("fieldA", "bar");
+ GenericData expected = new MyData();
+ // Test that objects are not equal.
+ expected.set("fieldA", "far");
+ assertNotSame(expected, actual);
+ assertFalse(expected.equals(actual) || actual.equals(expected));
+ assertFalse(expected.hashCode() == actual.hashCode());
+ }
public void testClone_changingEntrySet() {
GenericData data = new GenericData();
- assertEquals("{}", data.toString());
+ assertEquals("GenericData{classInfo=[], {}}", data.toString());
GenericData clone = data.clone();
clone.set("foo", "bar");
- assertEquals("{foo=bar}", clone.toString());
+ assertEquals("GenericData{classInfo=[], {foo=bar}}", clone.toString());
}
public void testSetIgnoreCase_unknownKey() {
From a0480abec598976cf8fac525534b3757217b7891 Mon Sep 17 00:00:00 2001
From: Elliotte Rusty Harold
Date: Wed, 13 Feb 2019 09:55:06 -0500
Subject: [PATCH 055/983] Remove old JDO artifact (#584)
* remove google-http-client-jdo that hasn;t been touched in 5 years, has no tests, and does not appear to work
* wip
* more references to JDO
---
google-http-client-assembly/assembly.xml | 11 -
google-http-client-assembly/classpath-include | 2 -
google-http-client-assembly/pom.xml | 4 -
.../google-http-client-jdo.jar.properties | 1 -
google-http-client-assembly/readme.html | 7 -
google-http-client-jdo/pom.xml | 80 ----
.../extensions/jdo/JdoDataStoreFactory.java | 385 ------------------
.../client/extensions/jdo/package-info.java | 22 -
.../jdo/JdoDataStoreFactoryTest.java | 75 ----
pom.xml | 10 -
10 files changed, 597 deletions(-)
delete mode 100644 google-http-client-assembly/properties/google-http-client-jdo.jar.properties
delete mode 100644 google-http-client-jdo/pom.xml
delete mode 100644 google-http-client-jdo/src/main/java/com/google/api/client/extensions/jdo/JdoDataStoreFactory.java
delete mode 100644 google-http-client-jdo/src/main/java/com/google/api/client/extensions/jdo/package-info.java
delete mode 100644 google-http-client-jdo/src/test/java/com/google/api/client/extensions/jdo/JdoDataStoreFactoryTest.java
diff --git a/google-http-client-assembly/assembly.xml b/google-http-client-assembly/assembly.xml
index be1385815..80ee72de1 100644
--- a/google-http-client-assembly/assembly.xml
+++ b/google-http-client-assembly/assembly.xml
@@ -62,12 +62,6 @@
google-http-java-client/libstrue
-
- properties/google-http-client-jdo.jar.properties
- google-http-client-jdo-${project.version}.jar.properties
- google-http-java-client/libs
- true
- properties/google-http-client-protobuf.jar.propertiesgoogle-http-client-protobuf-${project.version}.jar.properties
@@ -135,11 +129,6 @@
google-http-client-jackson2-dependencies.htmlgoogle-http-java-client/dependencies
-
- ../google-http-client-jdo/target/site/dependencies.html
- google-http-client-jdo-dependencies.html
- google-http-java-client/dependencies
- ../google-http-client-protobuf/target/site/dependencies.htmlgoogle-http-client-protobuf-dependencies.html
diff --git a/google-http-client-assembly/classpath-include b/google-http-client-assembly/classpath-include
index 52d9bee51..b72018813 100644
--- a/google-http-client-assembly/classpath-include
+++ b/google-http-client-assembly/classpath-include
@@ -5,7 +5,6 @@
-
@@ -13,7 +12,6 @@
-
diff --git a/google-http-client-assembly/pom.xml b/google-http-client-assembly/pom.xml
index 66977db1d..db005160e 100644
--- a/google-http-client-assembly/pom.xml
+++ b/google-http-client-assembly/pom.xml
@@ -42,10 +42,6 @@
com.google.http-clientgoogle-http-client-jackson2
-
- com.google.http-client
- google-http-client-jdo
- com.google.http-clientgoogle-http-client-protobuf
diff --git a/google-http-client-assembly/properties/google-http-client-jdo.jar.properties b/google-http-client-assembly/properties/google-http-client-jdo.jar.properties
deleted file mode 100644
index 60dae42e1..000000000
--- a/google-http-client-assembly/properties/google-http-client-jdo.jar.properties
+++ /dev/null
@@ -1 +0,0 @@
-src=../libs-sources/google-http-client-jdo-${project.version}-sources.jar
diff --git a/google-http-client-assembly/readme.html b/google-http-client-assembly/readme.html
index 32eff5f54..2dcaa65d2 100644
--- a/google-http-client-assembly/readme.html
+++ b/google-http-client-assembly/readme.html
@@ -41,8 +41,6 @@
Window > Preferences... (or on Mac, Eclipse > Preferences...)
Select Maven
-
check on "Download Artifact Sources"
-
check on "Download Artifact JavaDoc"
+
Check "Download Artifact Sources"
+
Check "Download Artifact JavaDoc"
@@ -46,10 +43,10 @@
Setup Project in Eclipse 3.5/3.6
Import dailymotion-simple-cmdline-sample project
File > Import...
-
Select "General > Existing Project into Workspace" and click
+
Select "Maven > Existing Maven Project" and click
"Next"
-
Click "Browse" next to "Select root directory", find [someDirectory]/google-http-java-client-samples/dailymotion-simple-cmdline-sample
- and click "Next"
+
Click "Browse" next to "Select root directory", find
+ google-http-java-client/samples/dailymotion-simple-cmdline-sample
Click "Finish"
@@ -57,8 +54,7 @@
Setup Project in Eclipse 3.5/3.6
Right-click on project dailymotion-simple-cmdline-sample
The license can be found
here.
- Dependent jars can be found in the
+ Dependency jars can be found in the
libs folder and the corresponding source jars can be found
in the
libs-sources folder.
@@ -110,9 +110,9 @@
Dependencies for all Platforms
Android Dependencies
- The following are the jars from the
- libs folder required for Android applications or a newer
- compatible version:
+ The following jars from the
+ libs folder or newer compatible versions
+ are required for Android applications:
google-http-client-android-${project.version}.jar
@@ -124,9 +124,9 @@
Android Dependencies
wiki for the Android Developer's Guide.
Google App Engine Dependencies
- The following are the jars from the
- libs folder required for Google App Engine applications or
- a newer compatible version:
+ The following jars from the
+ libs folder or newer compatible versions
+ are required for Google App Engine applications.
href='https://developers.google.com/api-client-library/java/google-http-java-client/app-engine'>GoogleAppEngine
wiki for the Google App Engine Developer's Guide.
-
General Purpose Java 5 Environment Dependencies
- The following are the jars from the
- libs folder required for general purpose Java 5
- applications or a newer compatible version:
+
General Purpose Java Environment Dependencies
+ The following jars from the
+ libs folder or newer compatible versions are
+ required for general purpose Java applications :
-
org.codehaus.mojoanimal-sniffer-maven-plugin
@@ -44,7 +42,7 @@
com.google.code.findbugsfindbugs
- 2.0.0
+ 3.0.1xalan
From 2e2b70b6690a0dcbaf6527d4bcfb8a72977ebdf1 Mon Sep 17 00:00:00 2001
From: Elliotte Rusty Harold
Date: Fri, 15 Mar 2019 17:10:38 -0400
Subject: [PATCH 067/983] move apache classes back into google-http-client
(#614)
* move apache classes back into google-http-client
This reverts commit bb32cebad72582ff5dbf609db902f573267a9a6f.
---
clirr-ignored-differences.xml | 8 +++++++-
.../google/api/client/http/apache/ApacheHttpRequest.java | 0
.../google/api/client/http/apache/ApacheHttpResponse.java | 0
.../api/client/http/apache/ApacheHttpTransport.java | 0
.../com/google/api/client/http/apache/ContentEntity.java | 0
.../api/client/http/apache/HttpExtensionMethod.java | 0
.../com/google/api/client/http/apache/package-info.java | 0
7 files changed, 7 insertions(+), 1 deletion(-)
rename {google-http-client-apache => google-http-client}/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java (100%)
rename {google-http-client-apache => google-http-client}/src/main/java/com/google/api/client/http/apache/ApacheHttpResponse.java (100%)
rename {google-http-client-apache => google-http-client}/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java (100%)
rename {google-http-client-apache => google-http-client}/src/main/java/com/google/api/client/http/apache/ContentEntity.java (100%)
rename {google-http-client-apache => google-http-client}/src/main/java/com/google/api/client/http/apache/HttpExtensionMethod.java (100%)
rename {google-http-client-apache => google-http-client}/src/main/java/com/google/api/client/http/apache/package-info.java (100%)
diff --git a/clirr-ignored-differences.xml b/clirr-ignored-differences.xml
index fb3252a38..6421a4fd2 100644
--- a/clirr-ignored-differences.xml
+++ b/clirr-ignored-differences.xml
@@ -1,5 +1,5 @@
-
+
@@ -11,4 +11,10 @@
8001com/google/api/client/http/apache/**
+
+ 7006
+ com/google/api/client/http/apache/**
+ org.apache.http.impl.client.DefaultHttpClient newDefaultHttpClient()
+ org.apache.http.client.HttpClient
+
diff --git a/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java b/google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java
similarity index 100%
rename from google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java
rename to google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java
diff --git a/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpResponse.java b/google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpResponse.java
similarity index 100%
rename from google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpResponse.java
rename to google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpResponse.java
diff --git a/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java b/google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
similarity index 100%
rename from google-http-client-apache/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
rename to google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
diff --git a/google-http-client-apache/src/main/java/com/google/api/client/http/apache/ContentEntity.java b/google-http-client/src/main/java/com/google/api/client/http/apache/ContentEntity.java
similarity index 100%
rename from google-http-client-apache/src/main/java/com/google/api/client/http/apache/ContentEntity.java
rename to google-http-client/src/main/java/com/google/api/client/http/apache/ContentEntity.java
diff --git a/google-http-client-apache/src/main/java/com/google/api/client/http/apache/HttpExtensionMethod.java b/google-http-client/src/main/java/com/google/api/client/http/apache/HttpExtensionMethod.java
similarity index 100%
rename from google-http-client-apache/src/main/java/com/google/api/client/http/apache/HttpExtensionMethod.java
rename to google-http-client/src/main/java/com/google/api/client/http/apache/HttpExtensionMethod.java
diff --git a/google-http-client-apache/src/main/java/com/google/api/client/http/apache/package-info.java b/google-http-client/src/main/java/com/google/api/client/http/apache/package-info.java
similarity index 100%
rename from google-http-client-apache/src/main/java/com/google/api/client/http/apache/package-info.java
rename to google-http-client/src/main/java/com/google/api/client/http/apache/package-info.java
From 2f12c8530a0ef9ec60aa1b6ba37ad3f6bca6087b Mon Sep 17 00:00:00 2001
From: Elliotte Rusty Harold
Date: Fri, 15 Mar 2019 18:48:49 -0400
Subject: [PATCH 068/983] Revert change to return type of
ApacheHttpTransport.newDefaultHttpClient() (#615)
* move apache classes back into google-http-client
* revert unrelated metadata
* revert unrelated metadata
* ignore differences caused by move
* rollback return type change
* Revert "rollback return type change"
This reverts commit bb32cebad72582ff5dbf609db902f573267a9a6f.
* Reapply return type change
This reverts commit 358d94dc852f46c4bd3ab1f55ef8fb04a7b9f1a6.
* revert return type change
---
clirr-ignored-differences.xml | 6 -
.../http/apache/ApacheHttpTransportTest.java | 113 ++-----
.../http/apache/ApacheHttpTransport.java | 316 +++++++++++++++---
.../apache/SSLSocketFactoryExtension.java | 61 ++++
4 files changed, 351 insertions(+), 145 deletions(-)
create mode 100644 google-http-client/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java
diff --git a/clirr-ignored-differences.xml b/clirr-ignored-differences.xml
index 6421a4fd2..bb01b2b4d 100644
--- a/clirr-ignored-differences.xml
+++ b/clirr-ignored-differences.xml
@@ -11,10 +11,4 @@
8001com/google/api/client/http/apache/**
-
- 7006
- com/google/api/client/http/apache/**
- org.apache.http.impl.client.DefaultHttpClient newDefaultHttpClient()
- org.apache.http.client.HttpClient
-
diff --git a/google-http-client-apache/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java b/google-http-client-apache/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java
index ef46084fe..21aa27357 100644
--- a/google-http-client-apache/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java
+++ b/google-http-client-apache/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java
@@ -14,73 +14,48 @@
package com.google.api.client.http.apache;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import com.google.api.client.http.LowLevelHttpResponse;
import com.google.api.client.util.ByteArrayStreamingContent;
import com.google.api.client.util.StringUtils;
-import java.io.IOException;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.http.Header;
-import org.apache.http.HttpClientConnection;
-import org.apache.http.HttpException;
-import org.apache.http.HttpRequest;
-import org.apache.http.HttpRequestInterceptor;
+import junit.framework.TestCase;
import org.apache.http.HttpResponse;
import org.apache.http.HttpVersion;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpUriRequest;
-import org.apache.http.impl.client.HttpClients;
-import org.apache.http.message.BasicHttpResponse;
-import org.apache.http.protocol.HttpContext;
-import org.apache.http.protocol.HttpRequestExecutor;
-import org.junit.Test;
+import org.apache.http.client.params.ClientPNames;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
+import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
+import org.apache.http.params.CoreConnectionPNames;
+import org.apache.http.params.HttpParams;
+import org.apache.http.params.HttpProtocolParams;
/**
* Tests {@link ApacheHttpTransport}.
*
* @author Yaniv Inbar
*/
-public class ApacheHttpTransportTest {
+public class ApacheHttpTransportTest extends TestCase {
- @Test
public void testApacheHttpTransport() {
ApacheHttpTransport transport = new ApacheHttpTransport();
- checkHttpTransport(transport);
+ DefaultHttpClient httpClient = (DefaultHttpClient) transport.getHttpClient();
+ checkDefaultHttpClient(httpClient);
+ checkHttpClient(httpClient);
}
- @Test
public void testApacheHttpTransportWithParam() {
- ApacheHttpTransport transport = new ApacheHttpTransport(HttpClients.custom().build());
- checkHttpTransport(transport);
+ ApacheHttpTransport transport = new ApacheHttpTransport(new DefaultHttpClient());
+ checkHttpClient(transport.getHttpClient());
}
- @Test
public void testNewDefaultHttpClient() {
- HttpClient client = ApacheHttpTransport.newDefaultHttpClient();
- checkHttpClient(client);
+ checkDefaultHttpClient(ApacheHttpTransport.newDefaultHttpClient());
}
- private void checkHttpTransport(ApacheHttpTransport transport) {
- assertNotNull(transport);
- HttpClient client = transport.getHttpClient();
- checkHttpClient(client);
- }
-
- private void checkHttpClient(HttpClient client) {
- assertNotNull(client);
- // TODO(chingor): Is it possible to test this effectively? The newer HttpClient implementations
- // are read-only and we're testing that we built the client with the right configuration
- }
-
- @Test
public void testRequestsWithContent() throws Exception {
HttpClient mockClient = mock(HttpClient.class);
HttpResponse mockResponse = mock(HttpResponse.class);
@@ -98,8 +73,6 @@ public void testRequestsWithContent() throws Exception {
subtestUnsupportedRequestsWithContent(
transport.buildRequest("HEAD", "http://www.test.url"), "HEAD");
- // Test PATCH.
- execute(transport.buildRequest("PATCH", "http://www.test.url"));
// Test PUT.
execute(transport.buildRequest("PUT", "http://www.test.url"));
// Test POST.
@@ -128,51 +101,19 @@ private void execute(ApacheHttpRequest request) throws Exception {
request.execute();
}
- @Test
- public void testRequestShouldNotFollowRedirects() throws IOException {
- final AtomicInteger requestsAttempted = new AtomicInteger(0);
- HttpRequestExecutor requestExecutor = new HttpRequestExecutor() {
- @Override
- public HttpResponse execute(HttpRequest request, HttpClientConnection conn,
- HttpContext context) throws IOException, HttpException {
- HttpResponse resp = new BasicHttpResponse(HttpVersion.HTTP_1_1, 302, null);
- resp.addHeader("location", "https://google.com/path");
- requestsAttempted.incrementAndGet();
- return resp;
- }
- };
- HttpClient client = HttpClients.custom().setRequestExecutor(requestExecutor).build();
- ApacheHttpTransport transport = new ApacheHttpTransport(client);
- ApacheHttpRequest request = transport.buildRequest("GET", "https://google.com");
- LowLevelHttpResponse response = request.execute();
- assertEquals(1, requestsAttempted.get());
- assertEquals(302, response.getStatusCode());
+ private void checkDefaultHttpClient(DefaultHttpClient client) {
+ HttpParams params = client.getParams();
+ assertTrue(client.getConnectionManager() instanceof ThreadSafeClientConnManager);
+ assertEquals(8192, params.getIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, -1));
+ DefaultHttpRequestRetryHandler retryHandler =
+ (DefaultHttpRequestRetryHandler) client.getHttpRequestRetryHandler();
+ assertEquals(0, retryHandler.getRetryCount());
+ assertFalse(retryHandler.isRequestSentRetryEnabled());
}
- @Test
- public void testRequestCanSetHeaders() {
- final AtomicBoolean interceptorCalled = new AtomicBoolean(false);
- HttpClient client = HttpClients.custom().addInterceptorFirst(new HttpRequestInterceptor() {
- @Override
- public void process(HttpRequest request, HttpContext context)
- throws HttpException, IOException {
- Header header = request.getFirstHeader("foo");
- assertNotNull("Should have found header", header);
- assertEquals("bar", header.getValue());
- interceptorCalled.set(true);
- throw new IOException("cancelling request");
- }
- }).build();
-
- ApacheHttpTransport transport = new ApacheHttpTransport(client);
- ApacheHttpRequest request = transport.buildRequest("GET", "https://google.com");
- request.addHeader("foo", "bar");
- try {
- LowLevelHttpResponse response = request.execute();
- fail("should not actually make the request");
- } catch (IOException exception) {
- assertEquals("cancelling request", exception.getMessage());
- }
- assertTrue("Expected to have called our test interceptor", interceptorCalled.get());
+ private void checkHttpClient(HttpClient client) {
+ HttpParams params = client.getParams();
+ assertFalse(params.getBooleanParameter(ClientPNames.HANDLE_REDIRECTS, true));
+ assertEquals(HttpVersion.HTTP_1_1, HttpProtocolParams.getVersion(params));
}
}
diff --git a/google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java b/google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
index ecc7e0c13..50e74dc87 100644
--- a/google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
+++ b/google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
@@ -15,7 +15,9 @@
package com.google.api.client.http.apache;
import com.google.api.client.http.HttpMethods;
+import com.google.api.client.http.HttpRequest;
import com.google.api.client.http.HttpTransport;
+import com.google.api.client.util.Beta;
import com.google.api.client.util.Preconditions;
import com.google.api.client.util.SecurityUtils;
import com.google.api.client.util.SslUtils;
@@ -25,24 +27,36 @@
import java.security.GeneralSecurityException;
import java.security.KeyStore;
import java.security.cert.CertificateFactory;
-import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLContext;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpVersion;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpHead;
import org.apache.http.client.methods.HttpOptions;
-import org.apache.http.client.methods.HttpPatch;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.methods.HttpTrace;
-import org.apache.http.config.SocketConfig;
-import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
-import org.apache.http.impl.conn.SystemDefaultRoutePlanner;
+import org.apache.http.client.params.ClientPNames;
+import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.conn.params.ConnManagerParams;
+import org.apache.http.conn.params.ConnPerRouteBean;
+import org.apache.http.conn.params.ConnRouteParams;
+import org.apache.http.conn.scheme.PlainSocketFactory;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.scheme.SchemeRegistry;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
+import org.apache.http.impl.conn.DefaultHttpRoutePlanner;
+import org.apache.http.impl.conn.ProxySelectorRoutePlanner;
+import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.HttpConnectionParams;
+import org.apache.http.params.HttpParams;
+import org.apache.http.params.HttpProtocolParams;
/**
* Thread-safe HTTP transport based on the Apache HTTP Client library.
@@ -56,7 +70,8 @@
*
* Default settings are specified in {@link #newDefaultHttpClient()}. Use the
* {@link #ApacheHttpTransport(HttpClient)} constructor to override the Apache HTTP Client used.
- * Please read the Apache HTTP
* Client connection management tutorial for more complex configuration options.
*
@@ -72,6 +87,10 @@ public final class ApacheHttpTransport extends HttpTransport {
/**
* Constructor that uses {@link #newDefaultHttpClient()} for the Apache HTTP client.
*
+ *
+ * Use {@link Builder} to modify HTTP client options.
+ *
+ *
* @since 1.3
*/
public ApacheHttpTransport() {
@@ -82,23 +101,34 @@ public ApacheHttpTransport() {
* Constructor that allows an alternative Apache HTTP client to be used.
*
*
- * Note that in the previous version, we tried overrode several settings, however, we are no
- * longer able to do so.
+ * Note that a few settings are overridden:
*
- *
- *
If you choose to provide your own Apache HttpClient implementation, be sure that
*
- *
HTTP version is set to 1.1.
- *
Redirects are disabled (google-http-client handles redirects).
- *
Retries are disabled (google-http-client handles retries).
+ *
HTTP version is set to 1.1 using {@link HttpProtocolParams#setVersion} with
+ * {@link HttpVersion#HTTP_1_1}.
+ *
Redirects are disabled using {@link ClientPNames#HANDLE_REDIRECTS}.
+ *
{@link ConnManagerParams#setTimeout} and {@link HttpConnectionParams#setConnectionTimeout}
+ * are set on each request based on {@link HttpRequest#getConnectTimeout()}.
+ *
{@link HttpConnectionParams#setSoTimeout} is set on each request based on
+ * {@link HttpRequest#getReadTimeout()}.
*
*
+ *
+ * Use {@link Builder} for a more user-friendly way to modify the HTTP client options.
+ *
- * Settings:
+ * Use this constructor if you want to customize the default Apache HTTP client. Settings:
*
*
- *
The client connection manager is set to {@link PoolingHttpClientConnectionManager}.
- *
The socket buffer size is set to 8192 using {@link SocketConfig}.
- *
- *
The route planner uses {@link SystemDefaultRoutePlanner} with
+ *
The client connection manager is set to {@link ThreadSafeClientConnManager}.
+ *
The socket buffer size is set to 8192 using
+ * {@link HttpConnectionParams#setSocketBufferSize}.
+ *
+ *
The route planner uses {@link ProxySelectorRoutePlanner} with
* {@link ProxySelector#getDefault()}, which uses the proxy settings from system
* properties.
*
*
* @return new instance of the Apache HTTP client
- * @since 2.0
+ * @since 1.6
+ */
+ public static DefaultHttpClient newDefaultHttpClient() {
+ return newDefaultHttpClient(
+ SSLSocketFactory.getSocketFactory(), newDefaultHttpParams(), ProxySelector.getDefault());
+ }
+
+ /** Returns a new instance of the default HTTP parameters we use. */
+ static HttpParams newDefaultHttpParams() {
+ HttpParams params = new BasicHttpParams();
+ // Turn off stale checking. Our connections break all the time anyway,
+ // and it's not worth it to pay the penalty of checking every time.
+ HttpConnectionParams.setStaleCheckingEnabled(params, false);
+ HttpConnectionParams.setSocketBufferSize(params, 8192);
+ ConnManagerParams.setMaxTotalConnections(params, 200);
+ ConnManagerParams.setMaxConnectionsPerRoute(params, new ConnPerRouteBean(20));
+ return params;
+ }
+
+ /**
+ * Creates a new instance of the Apache HTTP client that is used by the
+ * {@link #ApacheHttpTransport()} constructor.
+ *
+ * @param socketFactory SSL socket factory
+ * @param params HTTP parameters
+ * @param proxySelector HTTP proxy selector to use {@link ProxySelectorRoutePlanner} or
+ * {@code null} for {@link DefaultHttpRoutePlanner}
+ * @return new instance of the Apache HTTP client
*/
- public static HttpClient newDefaultHttpClient() {
- // Set socket buffer sizes to 8192
- SocketConfig socketConfig =
- SocketConfig.custom()
- .setRcvBufSize(8192)
- .setSndBufSize(8192)
- .build();
-
- PoolingHttpClientConnectionManager connectionManager =
- new PoolingHttpClientConnectionManager(-1, TimeUnit.MILLISECONDS);
- // Disable the stale connection check (previously configured in the HttpConnectionParams
- connectionManager.setValidateAfterInactivity(-1);
-
- return HttpClientBuilder.create()
- .useSystemProperties()
- .setSSLSocketFactory(SSLConnectionSocketFactory.getSocketFactory())
- .setDefaultSocketConfig(socketConfig)
- .setMaxConnTotal(200)
- .setMaxConnPerRoute(20)
- .setRoutePlanner(new SystemDefaultRoutePlanner(ProxySelector.getDefault()))
- .setConnectionManager(connectionManager)
- .disableRedirectHandling()
- .disableAutomaticRetries()
- .build();
+ static DefaultHttpClient newDefaultHttpClient(
+ SSLSocketFactory socketFactory, HttpParams params, ProxySelector proxySelector) {
+ // See http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html
+ SchemeRegistry registry = new SchemeRegistry();
+ registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
+ registry.register(new Scheme("https", socketFactory, 443));
+ ClientConnectionManager connectionManager = new ThreadSafeClientConnManager(params, registry);
+ DefaultHttpClient defaultHttpClient = new DefaultHttpClient(connectionManager, params);
+ defaultHttpClient.setHttpRequestRetryHandler(new DefaultHttpRequestRetryHandler(0, false));
+ if (proxySelector != null) {
+ defaultHttpClient.setRoutePlanner(new ProxySelectorRoutePlanner(registry, proxySelector));
+ }
+ return defaultHttpClient;
}
@Override
@@ -162,8 +209,6 @@ protected ApacheHttpRequest buildRequest(String method, String url) {
requestBase = new HttpGet(url);
} else if (method.equals(HttpMethods.HEAD)) {
requestBase = new HttpHead(url);
- } else if (method.equals(HttpMethods.PATCH)) {
- requestBase = new HttpPatch(url);
} else if (method.equals(HttpMethods.POST)) {
requestBase = new HttpPost(url);
} else if (method.equals(HttpMethods.PUT)) {
@@ -185,10 +230,8 @@ protected ApacheHttpRequest buildRequest(String method, String url) {
* @since 1.4
*/
@Override
- public void shutdown() throws IOException {
- if (httpClient instanceof CloseableHttpClient) {
- ((CloseableHttpClient) httpClient).close();
- }
+ public void shutdown() {
+ httpClient.getConnectionManager().shutdown();
}
/**
@@ -199,4 +242,171 @@ public void shutdown() throws IOException {
public HttpClient getHttpClient() {
return httpClient;
}
+
+ /**
+ * Builder for {@link ApacheHttpTransport}.
+ *
+ *
+ * Implementation is not thread-safe.
+ *
+ *
+ * @since 1.13
+ */
+ public static final class Builder {
+
+ /** SSL socket factory. */
+ private SSLSocketFactory socketFactory = SSLSocketFactory.getSocketFactory();
+
+ /** HTTP parameters. */
+ private HttpParams params = newDefaultHttpParams();
+
+ /**
+ * HTTP proxy selector to use {@link ProxySelectorRoutePlanner} or {@code null} for
+ * {@link DefaultHttpRoutePlanner}.
+ */
+ private ProxySelector proxySelector = ProxySelector.getDefault();
+
+ /**
+ * Sets the HTTP proxy to use {@link DefaultHttpRoutePlanner} or {@code null} to use
+ * {@link #setProxySelector(ProxySelector)} with {@link ProxySelector#getDefault()}.
+ *
+ *
+ * By default it is {@code null}, which uses the proxy settings from system
+ * properties.
+ *
+ *
+ *
+ * For example:
+ *
+ *
+ *
+ setProxy(new HttpHost("127.0.0.1", 8080))
+ *
+ */
+ public Builder setProxy(HttpHost proxy) {
+ ConnRouteParams.setDefaultProxy(params, proxy);
+ if (proxy != null) {
+ proxySelector = null;
+ }
+ return this;
+ }
+
+ /**
+ * Sets the HTTP proxy selector to use {@link ProxySelectorRoutePlanner} or {@code null} for
+ * {@link DefaultHttpRoutePlanner}.
+ *
+ *
+ * By default it is {@link ProxySelector#getDefault()} which uses the proxy settings from system
+ * properties.
+ *
+ */
+ public Builder setProxySelector(ProxySelector proxySelector) {
+ this.proxySelector = proxySelector;
+ if (proxySelector != null) {
+ ConnRouteParams.setDefaultProxy(params, null);
+ }
+ return this;
+ }
+ /**
+ * Sets the SSL socket factory based on root certificates in a Java KeyStore.
+ *
+ *
+ *
+ * @param certificateStream certificate stream
+ * @since 1.14
+ */
+ public Builder trustCertificatesFromStream(InputStream certificateStream)
+ throws GeneralSecurityException, IOException {
+ KeyStore trustStore = SecurityUtils.getJavaKeyStore();
+ trustStore.load(null, null);
+ SecurityUtils.loadKeyStoreFromCertificates(
+ trustStore, SecurityUtils.getX509CertificateFactory(), certificateStream);
+ return trustCertificates(trustStore);
+ }
+
+ /**
+ * Sets the SSL socket factory based on a root certificate trust store.
+ *
+ * @param trustStore certificate trust store (use for example {@link SecurityUtils#loadKeyStore}
+ * or {@link SecurityUtils#loadKeyStoreFromCertificates})
+ *
+ * @since 1.14
+ */
+ public Builder trustCertificates(KeyStore trustStore) throws GeneralSecurityException {
+ SSLContext sslContext = SslUtils.getTlsSslContext();
+ SslUtils.initSslContext(sslContext, trustStore, SslUtils.getPkixTrustManagerFactory());
+ return setSocketFactory(new SSLSocketFactoryExtension(sslContext));
+ }
+
+ /**
+ * {@link Beta}
+ * Disables validating server SSL certificates by setting the SSL socket factory using
+ * {@link SslUtils#trustAllSSLContext()} for the SSL context and
+ * {@link SSLSocketFactory#ALLOW_ALL_HOSTNAME_VERIFIER} for the host name verifier.
+ *
+ *
+ * Be careful! Disabling certificate validation is dangerous and should only be done in testing
+ * environments.
+ *
+ */
+ @Beta
+ public Builder doNotValidateCertificate() throws GeneralSecurityException {
+ socketFactory = new SSLSocketFactoryExtension(SslUtils.trustAllSSLContext());
+ socketFactory.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+ return this;
+ }
+
+ /** Sets the SSL socket factory ({@link SSLSocketFactory#getSocketFactory()} by default). */
+ public Builder setSocketFactory(SSLSocketFactory socketFactory) {
+ this.socketFactory = Preconditions.checkNotNull(socketFactory);
+ return this;
+ }
+
+ /** Returns the SSL socket factory ({@link SSLSocketFactory#getSocketFactory()} by default). */
+ public SSLSocketFactory getSSLSocketFactory() {
+ return socketFactory;
+ }
+
+ /** Returns the HTTP parameters. */
+ public HttpParams getHttpParams() {
+ return params;
+ }
+
+ /** Returns a new instance of {@link ApacheHttpTransport} based on the options. */
+ public ApacheHttpTransport build() {
+ return new ApacheHttpTransport(newDefaultHttpClient(socketFactory, params, proxySelector));
+ }
+ }
}
diff --git a/google-http-client/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java b/google-http-client/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java
new file mode 100644
index 000000000..3d507371b
--- /dev/null
+++ b/google-http-client/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2013 Google Inc.
+ *
+ * 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;
+
+import java.io.IOException;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.security.KeyManagementException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocket;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+
+/**
+ * Implementation of SSL socket factory that extends Apache's implementation to provide
+ * functionality missing from the Android SDK that is available in Apache HTTP Client.
+ *
+ * @author Yaniv Inbar
+ */
+final class SSLSocketFactoryExtension extends SSLSocketFactory {
+
+ /** Wrapped Java SSL socket factory. */
+ private final javax.net.ssl.SSLSocketFactory socketFactory;
+
+ /**
+ * @param sslContext SSL context
+ */
+ SSLSocketFactoryExtension(SSLContext sslContext) throws KeyManagementException,
+ UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException {
+ super((KeyStore) null);
+ socketFactory = sslContext.getSocketFactory();
+ }
+
+ @Override
+ public Socket createSocket() throws IOException {
+ return socketFactory.createSocket();
+ }
+
+ @Override
+ public Socket createSocket(Socket socket, String host, int port, boolean autoClose)
+ throws IOException, UnknownHostException {
+ SSLSocket sslSocket = (SSLSocket) socketFactory.createSocket(socket, host, port, autoClose);
+ getHostnameVerifier().verify(host, sslSocket);
+ return sslSocket;
+ }
+}
From 9a99e3d2f0d863d417f29391a6c8ba30aee432ff Mon Sep 17 00:00:00 2001
From: Elliotte Rusty Harold
Date: Mon, 18 Mar 2019 08:06:22 -0400
Subject: [PATCH 069/983] avoid default locale (#617)
---
.../java/com/google/api/client/util/FieldInfo.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/google-http-client/src/main/java/com/google/api/client/util/FieldInfo.java b/google-http-client/src/main/java/com/google/api/client/util/FieldInfo.java
index ac7cdd422..7204dd872 100644
--- a/google-http-client/src/main/java/com/google/api/client/util/FieldInfo.java
+++ b/google-http-client/src/main/java/com/google/api/client/util/FieldInfo.java
@@ -144,7 +144,7 @@ public static FieldInfo of(Field field) {
private Method[] settersMethodForField(Field field) {
List methods = new ArrayList<>();
for (Method method : field.getDeclaringClass().getDeclaredMethods()) {
- if (Ascii.toLowerCase(method.getName()).equals("set" + field.getName().toLowerCase())
+ if (Ascii.toLowerCase(method.getName()).equals("set" + Ascii.toLowerCase(field.getName()))
&& method.getParameterTypes().length == 1) {
methods.add(method);
}
@@ -221,9 +221,9 @@ public Object getValue(Object obj) {
}
/**
- * Sets to the given value of the field in the given object instance using reflection.
+ * Sets this field in the given object to the given value using reflection.
*
- * If the field is final, it checks that value being set is identical to the existing value.
+ * If the field is final, it checks that the value being set is identical to the existing value.
*/
public void setValue(Object obj, Object value) {
if (setters.length > 0) {
@@ -252,7 +252,7 @@ public > T enumValue() {
}
/**
- * Returns the value of the given field in the given object instance using reflection.
+ * Returns the value of the given field in the given object using reflection.
*/
public static Object getFieldValue(Field field, Object obj) {
try {
@@ -263,9 +263,9 @@ public static Object getFieldValue(Field field, Object obj) {
}
/**
- * Sets to the given value of the given field in the given object instance using reflection.
+ * Sets the given field in the given object to the given value using reflection.
*
- * Don't use this for Android applications that anyway require Gingerbread. Instead just call
+ *
Don't use this for Android applications that anyway require Gingerbread. Instead just call
* {@code new NetHttpTransport()}.
- *
*
- *
- * Prior to Gingerbread, the {@link HttpURLConnection} implementation was buggy, and the Apache
+ *
Prior to Gingerbread, the {@link HttpURLConnection} implementation was buggy, and the Apache
* HTTP Client was preferred. However, starting with Gingerbread, the {@link HttpURLConnection}
* implementation bugs were fixed, and is now better supported than the Apache HTTP Client. There
* is no guarantee that Apache HTTP transport will continue to work in future SDKs. Therefore,
- * this method uses {@link NetHttpTransport} for Gingerbread or higher, and otherwise
- * {@link ApacheHttpTransport}.
- *
+ * this method uses {@link NetHttpTransport} for Gingerbread or higher, and otherwise {@link
+ * ApacheHttpTransport}.
*/
public static HttpTransport newCompatibleTransport() {
return AndroidUtils.isMinimumSdkLevel(9) ? new NetHttpTransport() : new ApacheHttpTransport();
}
- private AndroidHttp() {
- }
+ private AndroidHttp() {}
}
diff --git a/google-http-client-android/src/main/java/com/google/api/client/extensions/android/http/package-info.java b/google-http-client-android/src/main/java/com/google/api/client/extensions/android/http/package-info.java
index 1b9d72b75..1491436b7 100644
--- a/google-http-client-android/src/main/java/com/google/api/client/extensions/android/http/package-info.java
+++ b/google-http-client-android/src/main/java/com/google/api/client/extensions/android/http/package-info.java
@@ -13,7 +13,7 @@
*/
/**
- * {@link com.google.api.client.util.Beta}
+ * {@link com.google.api.client.util.Beta}
* Utilities for Android HTTP transport.
*
* @since 1.11
diff --git a/google-http-client-android/src/main/java/com/google/api/client/extensions/android/json/AndroidJsonFactory.java b/google-http-client-android/src/main/java/com/google/api/client/extensions/android/json/AndroidJsonFactory.java
index e9b30c4b9..7b2b2cbbc 100644
--- a/google-http-client-android/src/main/java/com/google/api/client/extensions/android/json/AndroidJsonFactory.java
+++ b/google-http-client-android/src/main/java/com/google/api/client/extensions/android/json/AndroidJsonFactory.java
@@ -33,17 +33,13 @@
import java.nio.charset.Charset;
/**
- * {@link Beta}
+ * {@link Beta}
* Low-level JSON library implementation based on GSON.
*
- *
- * Implementation is thread-safe, and sub-classes must be thread-safe. For maximum efficiency,
+ *
Implementation is thread-safe, and sub-classes must be thread-safe. For maximum efficiency,
* applications should use a single globally-shared instance of the JSON factory.
- *
Implementation is not thread-safe.
*
* @author Yaniv Inbar
*/
diff --git a/google-http-client-android/src/main/java/com/google/api/client/extensions/android/json/AndroidJsonParser.java b/google-http-client-android/src/main/java/com/google/api/client/extensions/android/json/AndroidJsonParser.java
index b7af28466..622dcc971 100644
--- a/google-http-client-android/src/main/java/com/google/api/client/extensions/android/json/AndroidJsonParser.java
+++ b/google-http-client-android/src/main/java/com/google/api/client/extensions/android/json/AndroidJsonParser.java
@@ -29,12 +29,10 @@
import java.util.List;
/**
- * {@link Beta}
+ * {@link Beta}
* Low-level JSON serializer implementation based on GSON.
*
- *
- * Implementation is not thread-safe.
- *
+ *
Implementation is not thread-safe.
*
* @author Yaniv Inbar
*/
@@ -87,7 +85,6 @@ public short getShortValue() {
return Short.parseShort(currentText);
}
-
@Override
public int getIntValue() {
checkNumber();
@@ -199,8 +196,10 @@ public JsonToken nextToken() throws IOException {
break;
case NUMBER:
currentText = reader.nextString();
- currentToken = currentText.indexOf('.') == -1
- ? JsonToken.VALUE_NUMBER_INT : JsonToken.VALUE_NUMBER_FLOAT;
+ currentToken =
+ currentText.indexOf('.') == -1
+ ? JsonToken.VALUE_NUMBER_INT
+ : JsonToken.VALUE_NUMBER_FLOAT;
break;
case NAME:
currentText = reader.nextName();
diff --git a/google-http-client-android/src/main/java/com/google/api/client/extensions/android/json/package-info.java b/google-http-client-android/src/main/java/com/google/api/client/extensions/android/json/package-info.java
index 0507f3dc9..cd99614f8 100644
--- a/google-http-client-android/src/main/java/com/google/api/client/extensions/android/json/package-info.java
+++ b/google-http-client-android/src/main/java/com/google/api/client/extensions/android/json/package-info.java
@@ -13,7 +13,7 @@
*/
/**
- * {@link com.google.api.client.util.Beta}
+ * {@link com.google.api.client.util.Beta}
* Low-level implementation of the GSON parser library built-in to the Android 3.0 SDK.
*
* @since 1.11
diff --git a/google-http-client-android/src/main/java/com/google/api/client/extensions/android/package-info.java b/google-http-client-android/src/main/java/com/google/api/client/extensions/android/package-info.java
index 7149b88a7..3862d01ba 100644
--- a/google-http-client-android/src/main/java/com/google/api/client/extensions/android/package-info.java
+++ b/google-http-client-android/src/main/java/com/google/api/client/extensions/android/package-info.java
@@ -13,7 +13,7 @@
*/
/**
- * {@link com.google.api.client.util.Beta}
+ * {@link com.google.api.client.util.Beta}
* Utilities for Android.
*
* @since 1.11
diff --git a/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java
index b31b20594..2d2f40189 100644
--- a/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java
+++ b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpRequest.java
@@ -25,9 +25,7 @@
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
-/**
- * @author Yaniv Inbar
- */
+/** @author Yaniv Inbar */
final class ApacheHttpRequest extends LowLevelHttpRequest {
private final HttpClient httpClient;
@@ -54,7 +52,8 @@ public void setTimeout(int connectTimeout, int readTimeout) throws IOException {
@Override
public LowLevelHttpResponse execute() throws IOException {
if (getStreamingContent() != null) {
- Preconditions.checkArgument(request instanceof HttpEntityEnclosingRequest,
+ Preconditions.checkArgument(
+ request instanceof HttpEntityEnclosingRequest,
"Apache HTTP client does not support %s requests with content.",
request.getRequestLine().getMethod());
ContentEntity entity = new ContentEntity(getContentLength(), getStreamingContent());
diff --git a/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
index 82ce559bb..2dfda73fe 100644
--- a/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
+++ b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java
@@ -61,20 +61,16 @@
/**
* Thread-safe HTTP transport based on the Apache HTTP Client library.
*
- *
- * Implementation is thread-safe, as long as any parameter modification to the
- * {@link #getHttpClient() Apache HTTP Client} is only done at initialization time. For maximum
- * efficiency, applications should use a single globally-shared instance of the HTTP transport.
- *
+ *
Implementation is thread-safe, as long as any parameter modification to the {@link
+ * #getHttpClient() Apache HTTP Client} is only done at initialization time. For maximum efficiency,
+ * applications should use a single globally-shared instance of the HTTP transport.
*
- *
- * Default settings are specified in {@link #newDefaultHttpClient()}. Use the
- * {@link #ApacheHttpTransport(HttpClient)} constructor to override the Apache HTTP Client used.
+ *
Default settings are specified in {@link #newDefaultHttpClient()}. Use the {@link
+ * #ApacheHttpTransport(HttpClient)} constructor to override the Apache HTTP Client used.
* Alternatively, use {@link #ApacheHttpTransport()} and change the {@link #getHttpClient()}. Please
* read the Apache HTTP
* Client connection management tutorial for more complex configuration options.
- *
*
* @since 1.0
* @author Yaniv Inbar
@@ -87,9 +83,7 @@ public final class ApacheHttpTransport extends HttpTransport {
/**
* Constructor that uses {@link #newDefaultHttpClient()} for the Apache HTTP client.
*
- *
- * Use {@link Builder} to modify HTTP client options.
- *
+ *
Use {@link Builder} to modify HTTP client options.
*
* @since 1.3
*/
@@ -100,25 +94,22 @@ public ApacheHttpTransport() {
/**
* Constructor that allows an alternative Apache HTTP client to be used.
*
- *
- * Note that a few settings are overridden:
- *
+ *
Note that a few settings are overridden:
+ *
*
- *
HTTP version is set to 1.1 using {@link HttpProtocolParams#setVersion} with
- * {@link HttpVersion#HTTP_1_1}.
- *
Redirects are disabled using {@link ClientPNames#HANDLE_REDIRECTS}.
- *
{@link ConnManagerParams#setTimeout} and {@link HttpConnectionParams#setConnectionTimeout}
- * are set on each request based on {@link HttpRequest#getConnectTimeout()}.
- *
{@link HttpConnectionParams#setSoTimeout} is set on each request based on
- * {@link HttpRequest#getReadTimeout()}.
+ *
HTTP version is set to 1.1 using {@link HttpProtocolParams#setVersion} with {@link
+ * HttpVersion#HTTP_1_1}.
+ *
Redirects are disabled using {@link ClientPNames#HANDLE_REDIRECTS}.
+ *
{@link ConnManagerParams#setTimeout} and {@link
+ * HttpConnectionParams#setConnectionTimeout} are set on each request based on {@link
+ * HttpRequest#getConnectTimeout()}.
+ *
{@link HttpConnectionParams#setSoTimeout} is set on each request based on {@link
+ * HttpRequest#getReadTimeout()}.
*
*
- *
- * Use {@link Builder} for a more user-friendly way to modify the HTTP client options.
- *
+ *
Use {@link Builder} for a more user-friendly way to modify the HTTP client options.
*
* @param httpClient Apache HTTP client to use
- *
* @since 1.6
*/
public ApacheHttpTransport(HttpClient httpClient) {
@@ -150,11 +141,11 @@ static HttpParams newDefaultHttpParams() {
*
Use this constructor if you want to customize the default Apache HTTP client. Settings:
*
*
- *
The client connection manager is set to {@link ThreadSafeClientConnManager}.
+ *
The client connection manager is set to {@link ThreadSafeClientConnManager}.
*
The socket buffer size is set to 8192 using {@link
* HttpConnectionParams#setSocketBufferSize}.
- *
The retry mechanism is turned off by setting {@code new
- * DefaultHttpRequestRetryHandler(0, false)}.
+ *
The retry mechanism is turned off by setting {@code new DefaultHttpRequestRetryHandler(0,
+ * false)}.
*
*/
public Builder setProxy(HttpHost proxy) {
@@ -295,11 +280,9 @@ public Builder setProxy(HttpHost proxy) {
* Sets the HTTP proxy selector to use {@link ProxySelectorRoutePlanner} or {@code null} for
* {@link DefaultHttpRoutePlanner}.
*
- *
*
* @param keyStoreStream input stream to the key store (closed at the end of this method in a
- * finally block)
+ * finally block)
* @param storePass password protecting the key store file
* @since 1.14
*/
@@ -335,12 +316,10 @@ public Builder trustCertificatesFromJavaKeyStore(InputStream keyStoreStream, Str
* Sets the SSL socket factory based root certificates generated from the specified stream using
* {@link CertificateFactory#generateCertificates(InputStream)}.
*
- *
*
* @param certificateStream certificate stream
@@ -359,8 +338,7 @@ public Builder trustCertificatesFromStream(InputStream certificateStream)
* Sets the SSL socket factory based on a root certificate trust store.
*
* @param trustStore certificate trust store (use for example {@link SecurityUtils#loadKeyStore}
- * or {@link SecurityUtils#loadKeyStoreFromCertificates})
- *
+ * or {@link SecurityUtils#loadKeyStoreFromCertificates})
* @since 1.14
*/
public Builder trustCertificates(KeyStore trustStore) throws GeneralSecurityException {
@@ -370,15 +348,13 @@ public Builder trustCertificates(KeyStore trustStore) throws GeneralSecurityExce
}
/**
- * {@link Beta}
- * Disables validating server SSL certificates by setting the SSL socket factory using
- * {@link SslUtils#trustAllSSLContext()} for the SSL context and
- * {@link SSLSocketFactory#ALLOW_ALL_HOSTNAME_VERIFIER} for the host name verifier.
+ * {@link Beta}
+ * Disables validating server SSL certificates by setting the SSL socket factory using {@link
+ * SslUtils#trustAllSSLContext()} for the SSL context and {@link
+ * SSLSocketFactory#ALLOW_ALL_HOSTNAME_VERIFIER} for the host name verifier.
*
- *
- * Be careful! Disabling certificate validation is dangerous and should only be done in testing
- * environments.
- *
+ *
Be careful! Disabling certificate validation is dangerous and should only be done in
+ * testing environments.
*/
@Beta
public Builder doNotValidateCertificate() throws GeneralSecurityException {
diff --git a/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ContentEntity.java b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ContentEntity.java
index 293f8a908..343b35c50 100644
--- a/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ContentEntity.java
+++ b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/ContentEntity.java
@@ -21,9 +21,7 @@
import java.io.OutputStream;
import org.apache.http.entity.AbstractHttpEntity;
-/**
- * @author Yaniv Inbar
- */
+/** @author Yaniv Inbar */
final class ContentEntity extends AbstractHttpEntity {
/** Content length or less than zero if not known. */
diff --git a/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java
index 809849fcb..4b9a624f2 100644
--- a/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java
+++ b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/SSLSocketFactoryExtension.java
@@ -36,11 +36,10 @@ final class SSLSocketFactoryExtension extends SSLSocketFactory {
/** Wrapped Java SSL socket factory. */
private final javax.net.ssl.SSLSocketFactory socketFactory;
- /**
- * @param sslContext SSL context
- */
- SSLSocketFactoryExtension(SSLContext sslContext) throws KeyManagementException,
- UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException {
+ /** @param sslContext SSL context */
+ SSLSocketFactoryExtension(SSLContext sslContext)
+ throws KeyManagementException, UnrecoverableKeyException, NoSuchAlgorithmException,
+ KeyStoreException {
super((KeyStore) null);
socketFactory = sslContext.getSocketFactory();
}
diff --git a/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/package-info.java b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/package-info.java
index e0f5be089..0c2c23b4f 100644
--- a/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/package-info.java
+++ b/google-http-client-apache-legacy/src/main/java/com/google/api/client/http/apache/package-info.java
@@ -18,6 +18,4 @@
* @since 1.0
* @author Yaniv Inbar
*/
-
package com.google.api.client.http.apache;
-
diff --git a/google-http-client-apache-legacy/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java b/google-http-client-apache-legacy/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java
index 21aa27357..8176166db 100644
--- a/google-http-client-apache-legacy/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java
+++ b/google-http-client-apache-legacy/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java
@@ -88,7 +88,8 @@ private void subtestUnsupportedRequestsWithContent(ApacheHttpRequest request, St
fail("expected " + IllegalArgumentException.class);
} catch (IllegalArgumentException e) {
// expected
- assertEquals(e.getMessage(),
+ assertEquals(
+ e.getMessage(),
"Apache HTTP client does not support " + method + " requests with content.");
}
}
diff --git a/google-http-client-apache/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java b/google-http-client-apache/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java
index 21aa27357..8176166db 100644
--- a/google-http-client-apache/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java
+++ b/google-http-client-apache/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java
@@ -88,7 +88,8 @@ private void subtestUnsupportedRequestsWithContent(ApacheHttpRequest request, St
fail("expected " + IllegalArgumentException.class);
} catch (IllegalArgumentException e) {
// expected
- assertEquals(e.getMessage(),
+ assertEquals(
+ e.getMessage(),
"Apache HTTP client does not support " + method + " requests with content.");
}
}
diff --git a/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/datastore/AppEngineDataStoreFactory.java b/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/datastore/AppEngineDataStoreFactory.java
index 5fca5a684..0894d8192 100644
--- a/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/datastore/AppEngineDataStoreFactory.java
+++ b/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/datastore/AppEngineDataStoreFactory.java
@@ -34,7 +34,6 @@
import com.google.appengine.api.memcache.Expiration;
import com.google.appengine.api.memcache.MemcacheService;
import com.google.appengine.api.memcache.MemcacheServiceFactory;
-
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
@@ -50,18 +49,13 @@
* Thread-safe Google App Engine implementation of a data store factory that directly uses the App
* Engine Data Store API.
*
- *
- * For convenience, a default global instance is provided in {@link #getDefaultInstance()}.
- *
+ *
For convenience, a default global instance is provided in {@link #getDefaultInstance()}.
*
- *
- * By default, it uses the Memcache API as an in-memory data cache. To disable it, call
- * {@link Builder#setDisableMemcache(boolean)}. The Memcache is only read to check if a key already
- * has a value inside {@link DataStore#get(String)}. The values in the Memcache are updated in the
- * {@link DataStore#get(String)}, {@link DataStore#set(String, Serializable)},
- * {@link DataStore#delete(String)}, {@link DataStore#values()}, and {@link DataStore#clear()}
- * methods.
- *
+ *
By default, it uses the Memcache API as an in-memory data cache. To disable it, call {@link
+ * Builder#setDisableMemcache(boolean)}. The Memcache is only read to check if a key already has a
+ * value inside {@link DataStore#get(String)}. The values in the Memcache are updated in the {@link
+ * DataStore#get(String)}, {@link DataStore#set(String, Serializable)}, {@link
+ * DataStore#delete(String)}, {@link DataStore#values()}, and {@link DataStore#clear()} methods.
*
* @since 1.16
* @author Yaniv Inbar
@@ -83,9 +77,7 @@ public AppEngineDataStoreFactory() {
this(new Builder());
}
- /**
- * @param builder builder
- */
+ /** @param builder builder */
public AppEngineDataStoreFactory(Builder builder) {
disableMemcache = builder.disableMemcache;
memcacheExpiration = builder.memcacheExpiration;
@@ -97,8 +89,8 @@ public boolean getDisableMemcache() {
}
/**
- * Returns a global thread-safe instance based on the default constructor
- * {@link #AppEngineDataStoreFactory()}.
+ * Returns a global thread-safe instance based on the default constructor {@link
+ * #AppEngineDataStoreFactory()}.
*/
public static AppEngineDataStoreFactory getDefaultInstance() {
return InstanceHolder.INSTANCE;
@@ -296,9 +288,7 @@ private Iterable query(boolean keysOnly) {
/**
* App Engine data store factory builder.
*
- *
- * Implementation is not thread-safe.
- *
+ *
Implementation is not thread-safe.
*
* @since 1.16
*/
@@ -318,10 +308,8 @@ public final boolean getDisableMemcache() {
/**
* Sets whether to disable the memcache ({@code false} by default).
*
- *
- * Overriding is only supported for the purpose of calling the super implementation and changing
- * the return type, but nothing else.
- *
+ *
Overriding is only supported for the purpose of calling the super implementation and
+ * changing the return type, but nothing else.
*/
public Builder setDisableMemcache(boolean disableMemcache) {
this.disableMemcache = disableMemcache;
@@ -336,10 +324,8 @@ public final Expiration getMemcacheExpiration() {
/**
* Sets the Memcache expiration policy on puts.
*
- *
- * Overriding is only supported for the purpose of calling the super implementation and changing
- * the return type, but nothing else.
- *
+ *
Overriding is only supported for the purpose of calling the super implementation and
+ * changing the return type, but nothing else.
*/
public Builder setMemcacheExpiration(Expiration memcacheExpiration) {
this.memcacheExpiration = memcacheExpiration;
diff --git a/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/datastore/package-info.java b/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/datastore/package-info.java
index fd9acf785..b81c6c4bc 100644
--- a/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/datastore/package-info.java
+++ b/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/datastore/package-info.java
@@ -19,4 +19,3 @@
* @author Yaniv Inbar
*/
package com.google.api.client.extensions.appengine.datastore;
-
diff --git a/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/http/UrlFetchRequest.java b/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/http/UrlFetchRequest.java
index f79b93c6f..903b2cc43 100644
--- a/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/http/UrlFetchRequest.java
+++ b/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/http/UrlFetchRequest.java
@@ -23,14 +23,11 @@
import com.google.appengine.api.urlfetch.HTTPResponse;
import com.google.appengine.api.urlfetch.URLFetchService;
import com.google.appengine.api.urlfetch.URLFetchServiceFactory;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URL;
-/**
- * @author Yaniv Inbar
- */
+/** @author Yaniv Inbar */
final class UrlFetchRequest extends LowLevelHttpRequest {
private final HTTPRequest request;
@@ -46,8 +43,12 @@ public void addHeader(String name, String value) {
@Override
public void setTimeout(int connectTimeout, int readTimeout) {
- request.getFetchOptions().setDeadline(connectTimeout == 0 || readTimeout == 0
- ? Double.MAX_VALUE : (connectTimeout + readTimeout) / 1000.0);
+ request
+ .getFetchOptions()
+ .setDeadline(
+ connectTimeout == 0 || readTimeout == 0
+ ? Double.MAX_VALUE
+ : (connectTimeout + readTimeout) / 1000.0);
}
@Override
diff --git a/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/http/UrlFetchResponse.java b/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/http/UrlFetchResponse.java
index c10fdee6c..19e6a1ef3 100644
--- a/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/http/UrlFetchResponse.java
+++ b/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/http/UrlFetchResponse.java
@@ -17,7 +17,6 @@
import com.google.api.client.http.LowLevelHttpResponse;
import com.google.appengine.api.urlfetch.HTTPHeader;
import com.google.appengine.api.urlfetch.HTTPResponse;
-
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.ArrayList;
diff --git a/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/http/UrlFetchTransport.java b/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/http/UrlFetchTransport.java
index a7ba1b940..b6dfa8d3d 100644
--- a/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/http/UrlFetchTransport.java
+++ b/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/http/UrlFetchTransport.java
@@ -19,7 +19,6 @@
import com.google.api.client.util.Preconditions;
import com.google.appengine.api.urlfetch.FetchOptions;
import com.google.appengine.api.urlfetch.HTTPMethod;
-
import java.io.IOException;
import java.net.HttpURLConnection;
import java.util.Arrays;
@@ -28,21 +27,18 @@
* Thread-safe HTTP transport for Google App Engine based on URL Fetch.
*
- *
- * Implementation is thread-safe. For maximum efficiency, applications should use a single
+ *
Implementation is thread-safe. For maximum efficiency, applications should use a single
* globally-shared instance of the HTTP transport.
- *
*
- *
- * URL Fetch is only available on Google App Engine (not on any other Java environment), and is the
- * underlying HTTP transport used for App Engine. Their implementation of {@link HttpURLConnection}
- * is simply an abstraction layer on top of URL Fetch. By implementing a transport that directly
- * uses URL Fetch, we can optimize the behavior slightly, and can potentially take advantage of
- * features in URL Fetch that are not available in {@link HttpURLConnection}. Furthermore, there is
- * currently a serious bug in how HTTP headers are processed in the App Engine implementation of
- * {@link HttpURLConnection}, which we are able to avoid using this implementation. Therefore, this
- * is the recommended transport to use on App Engine.
- *
+ *
URL Fetch is only available on Google App Engine (not on any other Java environment), and is
+ * the underlying HTTP transport used for App Engine. Their implementation of {@link
+ * HttpURLConnection} is simply an abstraction layer on top of URL Fetch. By implementing a
+ * transport that directly uses URL Fetch, we can optimize the behavior slightly, and can
+ * potentially take advantage of features in URL Fetch that are not available in {@link
+ * HttpURLConnection}. Furthermore, there is currently a serious bug in how HTTP headers are
+ * processed in the App Engine implementation of {@link HttpURLConnection}, which we are able to
+ * avoid using this implementation. Therefore, this is the recommended transport to use on App
+ * Engine.
*
* @since 1.10
* @author Yaniv Inbar
@@ -54,16 +50,24 @@ public final class UrlFetchTransport extends HttpTransport {
* {@link FetchOptions#validateCertificate()}.
*/
enum CertificateValidationBehavior {
- DEFAULT, VALIDATE, DO_NOT_VALIDATE
+ DEFAULT,
+ VALIDATE,
+ DO_NOT_VALIDATE
}
/**
* All valid request methods as specified in {@link HTTPMethod}, sorted in ascending alphabetical
* order.
*/
- private static final String[] SUPPORTED_METHODS =
- {HttpMethods.DELETE, HttpMethods.GET, HttpMethods.HEAD, HttpMethods.POST,
- HttpMethods.PUT, HttpMethods.PATCH};
+ private static final String[] SUPPORTED_METHODS = {
+ HttpMethods.DELETE,
+ HttpMethods.GET,
+ HttpMethods.HEAD,
+ HttpMethods.POST,
+ HttpMethods.PUT,
+ HttpMethods.PATCH
+ };
+
static {
Arrays.sort(SUPPORTED_METHODS);
}
@@ -74,17 +78,13 @@ enum CertificateValidationBehavior {
/**
* Constructor with the default fetch options.
*
- *
- * Use {@link Builder} to modify fetch options.
- *
Implementation is not thread-safe.
*
* @since 1.13
*/
@@ -160,10 +158,8 @@ public static final class Builder {
* Sets whether to use {@link FetchOptions#doNotValidateCertificate()} ({@code false} by
* default).
*
- *
- * Be careful! Disabling certificate validation is dangerous and should be done in testing
+ *
Be careful! Disabling certificate validation is dangerous and should be done in testing
* environments only.
- *
*/
public Builder doNotValidateCertificate() {
this.certificateValidationBehavior = CertificateValidationBehavior.DO_NOT_VALIDATE;
diff --git a/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/http/package-info.java b/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/http/package-info.java
index ef321de84..e9c6e9b31 100644
--- a/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/http/package-info.java
+++ b/google-http-client-appengine/src/main/java/com/google/api/client/extensions/appengine/http/package-info.java
@@ -14,11 +14,10 @@
/**
* HTTP Transport library for Google API's based on URL Fetch in Google App Engine.
+ * href="https://cloud.google.com/appengine/docs/standard/java/issue-requests">URL Fetch in Google
+ * App Engine
.
*
* @since 1.10
* @author Yaniv Inbar
*/
-
package com.google.api.client.extensions.appengine.http;
-
diff --git a/google-http-client-appengine/src/test/java/com/google/api/client/extensions/appengine/datastore/AppEngineNoMemcacheDataStoreFactoryTest.java b/google-http-client-appengine/src/test/java/com/google/api/client/extensions/appengine/datastore/AppEngineNoMemcacheDataStoreFactoryTest.java
index 2fb1594ec..33d1fc468 100644
--- a/google-http-client-appengine/src/test/java/com/google/api/client/extensions/appengine/datastore/AppEngineNoMemcacheDataStoreFactoryTest.java
+++ b/google-http-client-appengine/src/test/java/com/google/api/client/extensions/appengine/datastore/AppEngineNoMemcacheDataStoreFactoryTest.java
@@ -17,8 +17,8 @@
import com.google.api.client.util.store.DataStoreFactory;
/**
- * Tests {@link AppEngineDataStoreFactory} with
- * {@link AppEngineDataStoreFactory.Builder#setDisableMemcache(boolean)}.
+ * Tests {@link AppEngineDataStoreFactory} with {@link
+ * AppEngineDataStoreFactory.Builder#setDisableMemcache(boolean)}.
*
* @author Yaniv Inbar
*/
diff --git a/google-http-client-findbugs/src/main/java/com/google/api/client/findbugs/BetaDetector.java b/google-http-client-findbugs/src/main/java/com/google/api/client/findbugs/BetaDetector.java
index 97e138be3..791d37f39 100644
--- a/google-http-client-findbugs/src/main/java/com/google/api/client/findbugs/BetaDetector.java
+++ b/google-http-client-findbugs/src/main/java/com/google/api/client/findbugs/BetaDetector.java
@@ -15,7 +15,6 @@
package com.google.api.client.findbugs;
import com.google.api.client.util.Beta;
-
import edu.umd.cs.findbugs.BugInstance;
import edu.umd.cs.findbugs.BugReporter;
import edu.umd.cs.findbugs.bcel.OpcodeStackDetector;
@@ -36,19 +35,13 @@ public class BetaDetector extends OpcodeStackDetector {
/** Beta annotation "signature". */
private static final String BETA_ANNOTATION = "Lcom/google/api/client/util/Beta;";
- /**
- * A message indicating there is a usage of a method annotated with Beta annotation.
- */
+ /** A message indicating there is a usage of a method annotated with Beta annotation. */
private static final String BETA_METHOD_USAGE = "BETA_METHOD_USAGE";
- /**
- * A message indicating there is a usage of a field annotated with Beta annotation.
- */
+ /** A message indicating there is a usage of a field annotated with Beta annotation. */
private static final String BETA_FIELD_USAGE = "BETA_FIELD_USAGE";
- /**
- * A message indicating there is a usage of a class annotated with Beta annotation.
- */
+ /** A message indicating there is a usage of a class annotated with Beta annotation. */
private static final String BETA_CLASS_USAGE = "BETA_CLASS_USAGE";
/** The bug reporter is used to report errors. */
@@ -96,7 +89,7 @@ public void sawOpcode(int seen) {
break;
default:
- // DO NOTHING
+ // DO NOTHING
}
}
@@ -115,9 +108,7 @@ private static boolean isBeta(AnnotationEntry[] annotationEntries) {
* class, it's not {@link Beta} and it doesn't appear in other {@link Beta} section. Otherwise
* returns {@code null}.
*
- *
- * Reports a bug in case the class is {@link Beta}.
- *
+ *
Reports a bug in case the class is {@link Beta}.
*/
private JavaClass checkClass() {
// TODO(peleyal): check if caching the beta state of every class could improve
@@ -167,9 +158,7 @@ private JavaClass getSuperclass(JavaClass javaClass) {
/**
* Reports bug in case the method defined by the given name and signature is {@link Beta}.
*
- *
- * The method is searched in current class and all super classses as well.
- *
+ *
The method is searched in current class and all super classses as well.
*/
private void checkMethod(String methodName, String signature) {
JavaClass javaClass = checkClass();
@@ -197,9 +186,7 @@ private void checkMethod(String methodName, String signature) {
/**
* Reports bug in case the field defined by the given name is {@link Beta}.
*
- *
- * The field is searched in current class and all super classses as well.
- *
+ *
The field is searched in current class and all super classses as well.
*/
private void checkField(String fieldName) {
JavaClass javaClass = checkClass();
diff --git a/google-http-client-gson/src/main/java/com/google/api/client/json/gson/GsonFactory.java b/google-http-client-gson/src/main/java/com/google/api/client/json/gson/GsonFactory.java
index b604a8414..391dbf3d4 100644
--- a/google-http-client-gson/src/main/java/com/google/api/client/json/gson/GsonFactory.java
+++ b/google-http-client-gson/src/main/java/com/google/api/client/json/gson/GsonFactory.java
@@ -21,7 +21,6 @@
import com.google.api.client.util.Charsets;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
-
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
@@ -34,10 +33,8 @@
/**
* Low-level JSON library implementation based on GSON.
*
- *
- * Implementation is thread-safe, and sub-classes must be thread-safe. For maximum efficiency,
+ *
Implementation is thread-safe, and sub-classes must be thread-safe. For maximum efficiency,
* applications should use a single globally-shared instance of the JSON factory.
- *
- * Implementation is thread-safe, and sub-classes must be thread-safe. For maximum efficiency,
+ *
Implementation is thread-safe, and sub-classes must be thread-safe. For maximum efficiency,
* applications should use a single globally-shared instance of the JSON factory.
- *
*
* @since 1.3
* @author Yaniv Inbar
@@ -44,6 +41,7 @@ public final class JacksonFactory extends JsonFactory {
/** JSON factory. */
private final org.codehaus.jackson.JsonFactory factory = new org.codehaus.jackson.JsonFactory();
+
{
// don't auto-close JSON content in order to ensure consistent behavior across JSON factories
// TODO(rmistry): Should we disable the JsonGenerator.Feature.AUTO_CLOSE_TARGET feature?
diff --git a/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/JacksonGenerator.java b/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/JacksonGenerator.java
index 64c0eed57..096b892ac 100644
--- a/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/JacksonGenerator.java
+++ b/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/JacksonGenerator.java
@@ -15,7 +15,6 @@
package com.google.api.client.json.jackson;
import com.google.api.client.json.JsonGenerator;
-
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
@@ -23,9 +22,7 @@
/**
* Low-level JSON serializer implementation based on Jackson.
*
- *
- * Implementation is not thread-safe.
- *
+ *
Implementation is not thread-safe.
*
* @author Yaniv Inbar
* @deprecated As of release 1.28, please use Jackson2 and google-http-client-jackson2.
diff --git a/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/JacksonParser.java b/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/JacksonParser.java
index 9a246d185..529582075 100644
--- a/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/JacksonParser.java
+++ b/google-http-client-jackson/src/main/java/com/google/api/client/json/jackson/JacksonParser.java
@@ -16,7 +16,6 @@
import com.google.api.client.json.JsonParser;
import com.google.api.client.json.JsonToken;
-
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
@@ -24,9 +23,7 @@
/**
* Low-level JSON serializer implementation based on Jackson.
*
- *
- * Implementation is thread-safe, and sub-classes must be thread-safe. For maximum efficiency,
+ *
Implementation is thread-safe, and sub-classes must be thread-safe. For maximum efficiency,
* applications should use a single globally-shared instance of the JSON factory.
- *
*
* @since 1.11
* @author Yaniv Inbar
@@ -43,6 +40,7 @@ public final class JacksonFactory extends JsonFactory {
/** JSON factory. */
private final com.fasterxml.jackson.core.JsonFactory factory =
new com.fasterxml.jackson.core.JsonFactory();
+
{
// don't auto-close JSON content in order to ensure consistent behavior across JSON factories
// TODO(rmistry): Should we disable the JsonGenerator.Feature.AUTO_CLOSE_TARGET feature?
diff --git a/google-http-client-jackson2/src/main/java/com/google/api/client/json/jackson2/JacksonGenerator.java b/google-http-client-jackson2/src/main/java/com/google/api/client/json/jackson2/JacksonGenerator.java
index 7288a442a..fd02c54c3 100644
--- a/google-http-client-jackson2/src/main/java/com/google/api/client/json/jackson2/JacksonGenerator.java
+++ b/google-http-client-jackson2/src/main/java/com/google/api/client/json/jackson2/JacksonGenerator.java
@@ -15,7 +15,6 @@
package com.google.api.client.json.jackson2;
import com.google.api.client.json.JsonGenerator;
-
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
@@ -23,9 +22,7 @@
/**
* Low-level JSON serializer implementation based on Jackson.
*
- *
- * There is no official media type for protocol buffers registered with the IANA.
- * {@link #CONTENT_TYPE} and {@link #ALT_CONTENT_TYPE} are some of the more popular choices being
- * used today, but other media types are also in use.
- *
+ *
There is no official media type for protocol buffers registered with the IANA. {@link
+ * #CONTENT_TYPE} and {@link #ALT_CONTENT_TYPE} are some of the more popular choices being used
+ * today, but other media types are also in use.
*
* @since 1.5
* @author Yaniv Inbar
@@ -51,7 +48,7 @@ public class ProtocolBuffers {
*
* @param destination message type
* @param messageClass destination message class that has a {@code parseFrom(InputStream)} public
- * static method
+ * static method
* @return new instance of the parsed destination message class
*/
public static T parseAndClose(
@@ -69,6 +66,5 @@ public static T parseAndClose(
}
}
- private ProtocolBuffers() {
- }
+ private ProtocolBuffers() {}
}
diff --git a/google-http-client-protobuf/src/main/java/com/google/api/client/protobuf/package-info.java b/google-http-client-protobuf/src/main/java/com/google/api/client/protobuf/package-info.java
index deec6ea8d..c6b19b0a2 100644
--- a/google-http-client-protobuf/src/main/java/com/google/api/client/protobuf/package-info.java
+++ b/google-http-client-protobuf/src/main/java/com/google/api/client/protobuf/package-info.java
@@ -13,12 +13,12 @@
*/
/**
- * {@link com.google.api.client.util.Beta}
- * Utilities for the Protocol Buffer format.
+ * {@link com.google.api.client.util.Beta}
+ * Utilities for the Protocol Buffer
+ * format.
*
* @since 1.5
* @author Yaniv Inbar
*/
@com.google.api.client.util.Beta
package com.google.api.client.protobuf;
-
diff --git a/google-http-client-protobuf/src/test/java/com/google/api/client/protobuf/ProtocolBuffersTest.java b/google-http-client-protobuf/src/test/java/com/google/api/client/protobuf/ProtocolBuffersTest.java
index c8c5c6ec9..94d7d1391 100644
--- a/google-http-client-protobuf/src/test/java/com/google/api/client/protobuf/ProtocolBuffersTest.java
+++ b/google-http-client-protobuf/src/test/java/com/google/api/client/protobuf/ProtocolBuffersTest.java
@@ -25,14 +25,16 @@
public class ProtocolBuffersTest extends TestCase {
public void testParseAndClose() throws Exception {
- SimpleProto.TestMessage mockResponse = SimpleProto.TestMessage.newBuilder()
- .setStatus(SimpleProto.TestStatus.SUCCESS)
- .setName("This is a test!")
- .setValue(123454321)
- .build();
+ SimpleProto.TestMessage mockResponse =
+ SimpleProto.TestMessage.newBuilder()
+ .setStatus(SimpleProto.TestStatus.SUCCESS)
+ .setName("This is a test!")
+ .setValue(123454321)
+ .build();
// Create the parser and test it with our mock response
- SimpleProto.TestMessage parsedResponse = ProtocolBuffers.parseAndClose(
- new ByteArrayInputStream(mockResponse.toByteArray()), SimpleProto.TestMessage.class);
+ SimpleProto.TestMessage parsedResponse =
+ ProtocolBuffers.parseAndClose(
+ new ByteArrayInputStream(mockResponse.toByteArray()), SimpleProto.TestMessage.class);
// Validate the parser properly parsed the response
// (i.e. it matches the original mock response)
assertEquals(mockResponse.getSerializedSize(), parsedResponse.getSerializedSize());
diff --git a/google-http-client-test/src/main/java/com/google/api/client/test/json/AbstractJsonFactoryTest.java b/google-http-client-test/src/main/java/com/google/api/client/test/json/AbstractJsonFactoryTest.java
index ee3386eaf..8bf518109 100644
--- a/google-http-client-test/src/main/java/com/google/api/client/test/json/AbstractJsonFactoryTest.java
+++ b/google-http-client-test/src/main/java/com/google/api/client/test/json/AbstractJsonFactoryTest.java
@@ -69,8 +69,12 @@ public AbstractJsonFactoryTest(String name) {
protected abstract JsonFactory newFactory();
private static final String EMPTY = "";
- private static final String JSON_THREE_ELEMENTS = "{" + " \"one\": { \"num\": 1 }"
- + ", \"two\": { \"num\": 2 }" + ", \"three\": { \"num\": 3 }" + "}";
+ private static final String JSON_THREE_ELEMENTS =
+ "{"
+ + " \"one\": { \"num\": 1 }"
+ + ", \"two\": { \"num\": 2 }"
+ + ", \"three\": { \"num\": 3 }"
+ + "}";
public void testParse_empty() throws Exception {
JsonParser parser = newFactory().createJsonParser(EMPTY);
@@ -262,18 +266,15 @@ public void testCurrentToken() throws Exception {
}
public static class Entry {
- @Key
- public String title;
+ @Key public String title;
}
public static class Feed {
- @Key
- public Collection entries;
+ @Key public Collection entries;
}
public static class A {
- @Key
- public Map map;
+ @Key public Map map;
}
static final String CONTAINED_MAP = "{\"map\":{\"title\":\"foo\"}}";
@@ -286,114 +287,69 @@ public void testParse() throws Exception {
}
public static class NumberTypes {
- @Key
- byte byteValue;
- @Key
- Byte byteObjValue;
- @Key
- short shortValue;
- @Key
- Short shortObjValue;
- @Key
- int intValue;
- @Key
- Integer intObjValue;
- @Key
- float floatValue;
- @Key
- Float floatObjValue;
- @Key
- long longValue;
- @Key
- Long longObjValue;
- @Key
- double doubleValue;
- @Key
- Double doubleObjValue;
- @Key
- BigInteger bigIntegerValue;
- @Key
- BigDecimal bigDecimalValue;
+ @Key byte byteValue;
+ @Key Byte byteObjValue;
+ @Key short shortValue;
+ @Key Short shortObjValue;
+ @Key int intValue;
+ @Key Integer intObjValue;
+ @Key float floatValue;
+ @Key Float floatObjValue;
+ @Key long longValue;
+ @Key Long longObjValue;
+ @Key double doubleValue;
+ @Key Double doubleObjValue;
+ @Key BigInteger bigIntegerValue;
+ @Key BigDecimal bigDecimalValue;
+
@Key("yetAnotherBigDecimalValue")
BigDecimal anotherBigDecimalValue;
- @Key
- List longListValue;
+ @Key List longListValue;
- @Key
- Map longMapValue;
+ @Key Map longMapValue;
}
public static class NumberTypesAsString {
- @Key
- @JsonString
- byte byteValue;
- @Key
- @JsonString
- Byte byteObjValue;
- @Key
- @JsonString
- short shortValue;
- @Key
- @JsonString
- Short shortObjValue;
- @Key
- @JsonString
- int intValue;
- @Key
- @JsonString
- Integer intObjValue;
- @Key
- @JsonString
- float floatValue;
- @Key
- @JsonString
- Float floatObjValue;
- @Key
- @JsonString
- long longValue;
- @Key
- @JsonString
- Long longObjValue;
- @Key
- @JsonString
- double doubleValue;
- @Key
- @JsonString
- Double doubleObjValue;
- @Key
- @JsonString
- BigInteger bigIntegerValue;
- @Key
- @JsonString
- BigDecimal bigDecimalValue;
+ @Key @JsonString byte byteValue;
+ @Key @JsonString Byte byteObjValue;
+ @Key @JsonString short shortValue;
+ @Key @JsonString Short shortObjValue;
+ @Key @JsonString int intValue;
+ @Key @JsonString Integer intObjValue;
+ @Key @JsonString float floatValue;
+ @Key @JsonString Float floatObjValue;
+ @Key @JsonString long longValue;
+ @Key @JsonString Long longObjValue;
+ @Key @JsonString double doubleValue;
+ @Key @JsonString Double doubleObjValue;
+ @Key @JsonString BigInteger bigIntegerValue;
+ @Key @JsonString BigDecimal bigDecimalValue;
+
@Key("yetAnotherBigDecimalValue")
@JsonString
BigDecimal anotherBigDecimalValue;
- @Key
- @JsonString
- List longListValue;
+ @Key @JsonString List longListValue;
- @Key
- @JsonString
- Map longMapValue;
+ @Key @JsonString Map longMapValue;
}
static final String NUMBER_TYPES =
"{\"bigDecimalValue\":1.0,\"bigIntegerValue\":1,\"byteObjValue\":1,\"byteValue\":1,"
- + "\"doubleObjValue\":1.0,\"doubleValue\":1.0,\"floatObjValue\":1.0,\"floatValue\":1.0,"
- + "\"intObjValue\":1,\"intValue\":1,\"longListValue\":[1],\"longMapValue\":{\"a\":1},"
- + "\"longObjValue\":1,\"longValue\":1,\"shortObjValue\":1,\"shortValue\":1,"
- + "\"yetAnotherBigDecimalValue\":1}";
+ + "\"doubleObjValue\":1.0,\"doubleValue\":1.0,\"floatObjValue\":1.0,\"floatValue\":1.0,"
+ + "\"intObjValue\":1,\"intValue\":1,\"longListValue\":[1],\"longMapValue\":{\"a\":1},"
+ + "\"longObjValue\":1,\"longValue\":1,\"shortObjValue\":1,\"shortValue\":1,"
+ + "\"yetAnotherBigDecimalValue\":1}";
static final String NUMBER_TYPES_AS_STRING =
"{\"bigDecimalValue\":\"1.0\",\"bigIntegerValue\":\"1\",\"byteObjValue\":\"1\","
- + "\"byteValue\":\"1\",\"doubleObjValue\":\"1.0\",\"doubleValue\":\"1.0\","
- + "\"floatObjValue\":\"1.0\",\"floatValue\":\"1.0\",\"intObjValue\":\"1\","
- + "\"intValue\":\"1\",\"longListValue\":[\"1\"],\"longMapValue\":{\"a\":\"1\"},"
- + "\"longObjValue\":\"1\",\"longValue\":\"1\"," + "\"shortObjValue\":\"1\","
- + "\"shortValue\":\"1\",\"yetAnotherBigDecimalValue\":\"1\"}";
+ + "\"byteValue\":\"1\",\"doubleObjValue\":\"1.0\",\"doubleValue\":\"1.0\","
+ + "\"floatObjValue\":\"1.0\",\"floatValue\":\"1.0\",\"intObjValue\":\"1\","
+ + "\"intValue\":\"1\",\"longListValue\":[\"1\"],\"longMapValue\":{\"a\":\"1\"},"
+ + "\"longObjValue\":\"1\",\"longValue\":\"1\","
+ + "\"shortObjValue\":\"1\","
+ + "\"shortValue\":\"1\",\"yetAnotherBigDecimalValue\":\"1\"}";
public void testParser_numberTypes() throws Exception {
JsonFactory factory = newFactory();
@@ -445,22 +401,17 @@ public void testToFromString_UTF8() throws Exception {
}
public static class AnyType {
- @Key
- public Object arr;
- @Key
- public Object bool;
- @Key
- public Object num;
- @Key
- public Object obj;
- @Key
- public Object str;
- @Key
- public Object nul;
+ @Key public Object arr;
+ @Key public Object bool;
+ @Key public Object num;
+ @Key public Object obj;
+ @Key public Object str;
+ @Key public Object nul;
}
- static final String ANY_TYPE = "{\"arr\":[1],\"bool\":true,\"nul\":null,\"num\":5,"
- + "\"obj\":{\"key\":\"value\"},\"str\":\"value\"}";
+ static final String ANY_TYPE =
+ "{\"arr\":[1],\"bool\":true,\"nul\":null,\"num\":5,"
+ + "\"obj\":{\"key\":\"value\"},\"str\":\"value\"}";
public void testParser_anyType() throws Exception {
JsonFactory factory = newFactory();
@@ -472,14 +423,11 @@ public void testParser_anyType() throws Exception {
}
public static class ArrayType {
- @Key
- int[] arr;
+ @Key int[] arr;
- @Key
- int[][] arr2;
+ @Key int[][] arr2;
- @Key
- public Integer[] integerArr;
+ @Key public Integer[] integerArr;
}
static final String ARRAY_TYPE = "{\"arr\":[4,5],\"arr2\":[[1,2],[3]],\"integerArr\":[6,7]}";
@@ -510,8 +458,7 @@ public void testParser_arrayType() throws Exception {
}
public static class CollectionOfCollectionType {
- @Key
- public LinkedList> arr;
+ @Key public LinkedList> arr;
}
static final String COLLECTION_TYPE = "{\"arr\":[[\"a\",\"b\"],[\"c\"]]}";
@@ -530,8 +477,7 @@ public void testParser_collectionType() throws Exception {
}
public static class MapOfMapType {
- @Key
- public Map>[] value;
+ @Key public Map>[] value;
}
static final String MAP_TYPE =
@@ -577,23 +523,17 @@ public void testParser_hashmapForMapType() throws Exception {
}
public static class WildCardTypes {
- @Key
- public Collection super Integer>[] lower;
- @Key
- public Map map;
- @Key
- public Collection super TreeMap> mapInWild;
- @Key
- public Map mapUpper;
- @Key
- public Collection>[] simple;
- @Key
- public Collection extends Integer>[] upper;
+ @Key public Collection super Integer>[] lower;
+ @Key public Map map;
+ @Key public Collection super TreeMap> mapInWild;
+ @Key public Map mapUpper;
+ @Key public Collection>[] simple;
+ @Key public Collection extends Integer>[] upper;
}
static final String WILDCARD_TYPE =
"{\"lower\":[[1,2,3]],\"map\":{\"v\":1},\"mapInWild\":[{\"v\":1}],"
- + "\"mapUpper\":{\"v\":1},\"simple\":[[1,2,3]],\"upper\":[[1,2,3]]}";
+ + "\"mapUpper\":{\"v\":1},\"simple\":[[1,2,3]],\"upper\":[[1,2,3]]}";
@SuppressWarnings("unchecked")
public void testParser_wildCardType() throws Exception {
@@ -633,30 +573,22 @@ public void testParser_wildCardType() throws Exception {
public static class TypeVariableType {
- @Key
- public T[][] arr;
+ @Key public T[][] arr;
- @Key
- public LinkedList> list;
+ @Key public LinkedList> list;
- @Key
- public T nullValue;
+ @Key public T nullValue;
- @Key
- public T value;
+ @Key public T value;
}
- public static class IntegerTypeVariableType extends TypeVariableType {
- }
+ public static class IntegerTypeVariableType extends TypeVariableType {}
- public static class IntArrayTypeVariableType extends TypeVariableType {
- }
+ public static class IntArrayTypeVariableType extends TypeVariableType {}
- public static class DoubleListTypeVariableType extends TypeVariableType> {
- }
+ public static class DoubleListTypeVariableType extends TypeVariableType> {}
- public static class FloatMapTypeVariableType extends TypeVariableType