From 49da636c8015ccc5bba5021ba1cee6a2af1aed21 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Fri, 28 Oct 2016 14:08:17 -0700 Subject: [PATCH 01/85] Fix missed version bump for samples This should fix the Travis-CI build. --- samples/dailymotion-simple-cmdline-sample/pom.xml | 2 +- samples/googleplus-simple-cmdline-sample/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/dailymotion-simple-cmdline-sample/pom.xml b/samples/dailymotion-simple-cmdline-sample/pom.xml index ec16778cf..a5536eb17 100644 --- a/samples/dailymotion-simple-cmdline-sample/pom.xml +++ b/samples/dailymotion-simple-cmdline-sample/pom.xml @@ -4,7 +4,7 @@ com.google.http-client google-http-client-parent - 1.22.0-SNAPSHOT + 1.23.0-SNAPSHOT ../../pom.xml dailymotion-simple-cmdline-sample diff --git a/samples/googleplus-simple-cmdline-sample/pom.xml b/samples/googleplus-simple-cmdline-sample/pom.xml index 2e88ce1b5..ead915732 100644 --- a/samples/googleplus-simple-cmdline-sample/pom.xml +++ b/samples/googleplus-simple-cmdline-sample/pom.xml @@ -4,7 +4,7 @@ com.google.http-client google-http-client-parent - 1.22.0-SNAPSHOT + 1.23.0-SNAPSHOT ../../pom.xml googleplus-simple-cmdline-sample From 75c2b202b8de32810fba77e1e5a7c71d274ae5e9 Mon Sep 17 00:00:00 2001 From: In-Ho Yi Date: Mon, 7 Nov 2016 13:08:55 -0800 Subject: [PATCH 02/85] Swallow exception from close call when there is an underlying IOException --- .../api/client/http/javanet/NetHttpRequest.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 9042a55c7..bad60626e 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 @@ -75,10 +75,21 @@ public LowLevelHttpResponse execute() throws IOException { connection.setChunkedStreamingMode(0); } OutputStream out = connection.getOutputStream(); + boolean threw = true; try { getStreamingContent().writeTo(out); + threw = false; } finally { - out.close(); + try { + out.close(); + } catch (IOException exception) { + // When writeTo() throws an exception, chances are that the close call will also fail. + // In such case, swallow exception from close call so that the underlying cause can + // propagate. + if (!threw) { + throw exception; + } + } } } else { // cannot call setDoOutput(true) because it would change a GET method to POST From 130706296db008387d070f7095ba90d2b4c97ae3 Mon Sep 17 00:00:00 2001 From: timhsieh Date: Thu, 21 Apr 2016 09:28:26 -0700 Subject: [PATCH 03/85] Add Method Not Allowed (405) ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=120452726 --- .../java/com/google/api/client/http/HttpStatusCodes.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/google-http-client/src/main/java/com/google/api/client/http/HttpStatusCodes.java b/google-http-client/src/main/java/com/google/api/client/http/HttpStatusCodes.java index 0d1d65958..1fbb18699 100644 --- a/google-http-client/src/main/java/com/google/api/client/http/HttpStatusCodes.java +++ b/google-http-client/src/main/java/com/google/api/client/http/HttpStatusCodes.java @@ -60,6 +60,12 @@ public class HttpStatusCodes { /** Status code for a server that has not found anything matching the Request-URI. */ public static final int STATUS_CODE_NOT_FOUND = 404; + /** + * Status code for a method specified in the Request-Line is not allowed for the resource + * identified by the Request-URI. + * */ + public static final int STATUS_CODE_METHOD_NOT_ALLOWED = 405; + /** Status code for a request that could not be completed due to a resource conflict. */ public static final int STATUS_CODE_CONFLICT = 409; From ece15415e7e683ba4c0db3859936c33dcf215501 Mon Sep 17 00:00:00 2001 From: gak Date: Thu, 14 Jul 2016 14:18:45 -0700 Subject: [PATCH 04/85] Update imports ordering to the new java import order (go/java-imports). The import order is changing because the current rules are unnecessarily complicated, difficult to configure in IDEs, and difficult for users to remember. More information: http://go/java-imports-lsc Tested: $ blaze build //java/com/google/api/client/benchmarks/model:all //java/com/google/api/client/benchmarks:all //java/com/google/api/client/extensions/android/json:all //java/com/google/api/client/extensions/android:all //java/com/google/api/client/extensions/jetty/auth/oauth2:all //java/com/google/api/client/googleapis/extensions/android/accounts:all //java/com/google/api/client/googleapis/extensions/android/gms/auth:all //java/com/google/api/client/googleapis/xml/atom:all //java/com/google/api/client/http/apache:all //java/com/google/api/client/http/xml/atom:all //java/com/google/api/client/http/xml:all //java/com/google/api/client/test/json:all //java/com/google/api/client/test/util/store:all //java/com/google/api/client/testing/http/apache:all //java/com/google/api/client/xml/atom:all //java/com/google/api/client/xml:all http://sponge/a7602dcb-ac8b-4609-9add-4a9e66f34eaf All failing tests were failing before this change ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=127472734 --- .../client/extensions/android/AndroidUtils.java | 3 +-- .../android/json/AndroidJsonFactory.java | 8 +++----- .../android/json/AndroidJsonGenerator.java | 6 ++---- .../android/json/AndroidJsonParser.java | 6 ++---- .../test/json/AbstractJsonFactoryTest.java | 4 +--- .../store/AbstractDataStoreFactoryTest.java | 4 +--- .../client/http/xml/AbstractXmlHttpContent.java | 4 +--- .../api/client/http/xml/XmlHttpContent.java | 4 +--- .../api/client/http/xml/atom/AtomContent.java | 4 +--- .../client/http/xml/atom/AtomFeedParser.java | 6 ++---- .../java/com/google/api/client/xml/Xml.java | 10 ++++------ .../api/client/xml/XmlNamespaceDictionary.java | 4 +--- .../google/api/client/xml/XmlObjectParser.java | 6 ++---- .../client/xml/atom/AbstractAtomFeedParser.java | 6 ++---- .../client/http/apache/ApacheHttpRequest.java | 4 +--- .../client/http/apache/ApacheHttpResponse.java | 6 ++---- .../client/http/apache/ApacheHttpTransport.java | 17 +++++++---------- .../api/client/http/apache/ContentEntity.java | 4 +--- .../client/http/apache/HttpExtensionMethod.java | 4 +--- .../http/apache/SSLSocketFactoryExtension.java | 4 +--- .../testing/http/apache/MockHttpClient.java | 4 +--- 21 files changed, 38 insertions(+), 80 deletions(-) diff --git a/google-http-client-android/src/main/java/com/google/api/client/extensions/android/AndroidUtils.java b/google-http-client-android/src/main/java/com/google/api/client/extensions/android/AndroidUtils.java index d26e9a49b..61522acc6 100644 --- a/google-http-client-android/src/main/java/com/google/api/client/extensions/android/AndroidUtils.java +++ b/google-http-client-android/src/main/java/com/google/api/client/extensions/android/AndroidUtils.java @@ -14,11 +14,10 @@ package com.google.api.client.extensions.android; +import android.os.Build; import com.google.api.client.util.Beta; import com.google.api.client.util.Preconditions; -import android.os.Build; - /** * {@link Beta}
* Utilities for Android. 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 c91511aeb..23b896688 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 @@ -14,17 +14,15 @@ package com.google.api.client.extensions.android.json; +import android.annotation.TargetApi; +import android.util.JsonReader; +import android.util.JsonWriter; import com.google.api.client.extensions.android.AndroidUtils; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.JsonGenerator; import com.google.api.client.json.JsonParser; import com.google.api.client.util.Beta; import com.google.api.client.util.Charsets; - -import android.annotation.TargetApi; -import android.util.JsonReader; -import android.util.JsonWriter; - import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; diff --git a/google-http-client-android/src/main/java/com/google/api/client/extensions/android/json/AndroidJsonGenerator.java b/google-http-client-android/src/main/java/com/google/api/client/extensions/android/json/AndroidJsonGenerator.java index fb0283760..27b403804 100644 --- a/google-http-client-android/src/main/java/com/google/api/client/extensions/android/json/AndroidJsonGenerator.java +++ b/google-http-client-android/src/main/java/com/google/api/client/extensions/android/json/AndroidJsonGenerator.java @@ -14,13 +14,11 @@ package com.google.api.client.extensions.android.json; +import android.annotation.TargetApi; +import android.util.JsonWriter; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.JsonGenerator; import com.google.api.client.util.Beta; - -import android.annotation.TargetApi; -import android.util.JsonWriter; - import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; 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 63fe57a41..78a8daa15 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 @@ -14,15 +14,13 @@ package com.google.api.client.extensions.android.json; +import android.annotation.TargetApi; +import android.util.JsonReader; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.JsonParser; import com.google.api.client.json.JsonToken; import com.google.api.client.util.Beta; import com.google.api.client.util.Preconditions; - -import android.annotation.TargetApi; -import android.util.JsonReader; - import java.io.EOFException; import java.io.IOException; import java.math.BigDecimal; 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 3603dae2d..ee3386eaf 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 @@ -35,9 +35,6 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.reflect.TypeToken; - -import junit.framework.TestCase; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; @@ -56,6 +53,7 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; +import junit.framework.TestCase; /** * Abstract test case for testing a {@link JsonFactory}. diff --git a/google-http-client-test/src/main/java/com/google/api/client/test/util/store/AbstractDataStoreFactoryTest.java b/google-http-client-test/src/main/java/com/google/api/client/test/util/store/AbstractDataStoreFactoryTest.java index 796a01486..1986c6204 100644 --- a/google-http-client-test/src/main/java/com/google/api/client/test/util/store/AbstractDataStoreFactoryTest.java +++ b/google-http-client-test/src/main/java/com/google/api/client/test/util/store/AbstractDataStoreFactoryTest.java @@ -18,12 +18,10 @@ import com.google.api.client.util.store.DataStore; import com.google.api.client.util.store.DataStoreFactory; import com.google.common.collect.Sets; - -import junit.framework.TestCase; - import java.util.Arrays; import java.util.Collection; import java.util.Set; +import junit.framework.TestCase; /** * Tests {@link DataStoreFactory}. diff --git a/google-http-client-xml/src/main/java/com/google/api/client/http/xml/AbstractXmlHttpContent.java b/google-http-client-xml/src/main/java/com/google/api/client/http/xml/AbstractXmlHttpContent.java index f427c3af5..643fa8369 100644 --- a/google-http-client-xml/src/main/java/com/google/api/client/http/xml/AbstractXmlHttpContent.java +++ b/google-http-client-xml/src/main/java/com/google/api/client/http/xml/AbstractXmlHttpContent.java @@ -20,11 +20,9 @@ import com.google.api.client.util.Preconditions; import com.google.api.client.xml.Xml; import com.google.api.client.xml.XmlNamespaceDictionary; - -import org.xmlpull.v1.XmlSerializer; - import java.io.IOException; import java.io.OutputStream; +import org.xmlpull.v1.XmlSerializer; /** * {@link Beta}
diff --git a/google-http-client-xml/src/main/java/com/google/api/client/http/xml/XmlHttpContent.java b/google-http-client-xml/src/main/java/com/google/api/client/http/xml/XmlHttpContent.java index 7361969c0..5184aed3e 100644 --- a/google-http-client-xml/src/main/java/com/google/api/client/http/xml/XmlHttpContent.java +++ b/google-http-client-xml/src/main/java/com/google/api/client/http/xml/XmlHttpContent.java @@ -18,10 +18,8 @@ import com.google.api.client.util.Beta; import com.google.api.client.util.Preconditions; import com.google.api.client.xml.XmlNamespaceDictionary; - -import org.xmlpull.v1.XmlSerializer; - import java.io.IOException; +import org.xmlpull.v1.XmlSerializer; /** * {@link Beta}
diff --git a/google-http-client-xml/src/main/java/com/google/api/client/http/xml/atom/AtomContent.java b/google-http-client-xml/src/main/java/com/google/api/client/http/xml/atom/AtomContent.java index c9c0fec84..7badc9e62 100644 --- a/google-http-client-xml/src/main/java/com/google/api/client/http/xml/atom/AtomContent.java +++ b/google-http-client-xml/src/main/java/com/google/api/client/http/xml/atom/AtomContent.java @@ -20,10 +20,8 @@ import com.google.api.client.util.Preconditions; import com.google.api.client.xml.XmlNamespaceDictionary; import com.google.api.client.xml.atom.Atom; - -import org.xmlpull.v1.XmlSerializer; - import java.io.IOException; +import org.xmlpull.v1.XmlSerializer; /** * {@link Beta}
diff --git a/google-http-client-xml/src/main/java/com/google/api/client/http/xml/atom/AtomFeedParser.java b/google-http-client-xml/src/main/java/com/google/api/client/http/xml/atom/AtomFeedParser.java index 6314a6cb3..71a032429 100644 --- a/google-http-client-xml/src/main/java/com/google/api/client/http/xml/atom/AtomFeedParser.java +++ b/google-http-client-xml/src/main/java/com/google/api/client/http/xml/atom/AtomFeedParser.java @@ -22,12 +22,10 @@ import com.google.api.client.xml.XmlNamespaceDictionary; import com.google.api.client.xml.atom.AbstractAtomFeedParser; import com.google.api.client.xml.atom.Atom; - -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; - import java.io.IOException; import java.io.InputStream; +import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * {@link Beta}
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 e53fd4f88..48d7ef3df 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 @@ -23,12 +23,6 @@ import com.google.api.client.util.FieldInfo; import com.google.api.client.util.Preconditions; import com.google.api.client.util.Types; - -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; -import org.xmlpull.v1.XmlPullParserFactory; -import org.xmlpull.v1.XmlSerializer; - import java.io.IOException; import java.lang.reflect.Field; import java.lang.reflect.ParameterizedType; @@ -37,6 +31,10 @@ import java.util.Collection; import java.util.List; import java.util.Map; +import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; +import org.xmlpull.v1.XmlPullParserFactory; +import org.xmlpull.v1.XmlSerializer; /** * {@link Beta}
diff --git a/google-http-client-xml/src/main/java/com/google/api/client/xml/XmlNamespaceDictionary.java b/google-http-client-xml/src/main/java/com/google/api/client/xml/XmlNamespaceDictionary.java index f33063618..2058a9dd8 100644 --- a/google-http-client-xml/src/main/java/com/google/api/client/xml/XmlNamespaceDictionary.java +++ b/google-http-client-xml/src/main/java/com/google/api/client/xml/XmlNamespaceDictionary.java @@ -20,9 +20,6 @@ import com.google.api.client.util.FieldInfo; import com.google.api.client.util.Preconditions; import com.google.api.client.util.Types; - -import org.xmlpull.v1.XmlSerializer; - import java.io.IOException; import java.io.StringWriter; import java.util.ArrayList; @@ -32,6 +29,7 @@ import java.util.Map; import java.util.SortedSet; import java.util.TreeSet; +import org.xmlpull.v1.XmlSerializer; /** * {@link Beta}
diff --git a/google-http-client-xml/src/main/java/com/google/api/client/xml/XmlObjectParser.java b/google-http-client-xml/src/main/java/com/google/api/client/xml/XmlObjectParser.java index de9dd2632..2c0a173b5 100644 --- a/google-http-client-xml/src/main/java/com/google/api/client/xml/XmlObjectParser.java +++ b/google-http-client-xml/src/main/java/com/google/api/client/xml/XmlObjectParser.java @@ -18,15 +18,13 @@ import com.google.api.client.util.ObjectParser; import com.google.api.client.util.Preconditions; import com.google.api.client.util.Types; - -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; - import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.lang.reflect.Type; import java.nio.charset.Charset; +import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * {@link Beta}
diff --git a/google-http-client-xml/src/main/java/com/google/api/client/xml/atom/AbstractAtomFeedParser.java b/google-http-client-xml/src/main/java/com/google/api/client/xml/atom/AbstractAtomFeedParser.java index 50c4e2b1b..c68453f57 100644 --- a/google-http-client-xml/src/main/java/com/google/api/client/xml/atom/AbstractAtomFeedParser.java +++ b/google-http-client-xml/src/main/java/com/google/api/client/xml/atom/AbstractAtomFeedParser.java @@ -19,12 +19,10 @@ import com.google.api.client.util.Types; import com.google.api.client.xml.Xml; import com.google.api.client.xml.XmlNamespaceDictionary; - -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; - import java.io.IOException; import java.io.InputStream; +import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; /** * {@link Beta}
diff --git a/google-http-client/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 index 6d75afaef..b31b20594 100644 --- a/google-http-client/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 @@ -17,7 +17,7 @@ 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; @@ -25,8 +25,6 @@ import org.apache.http.params.HttpConnectionParams; import org.apache.http.params.HttpParams; -import java.io.IOException; - /** * @author Yaniv Inbar */ diff --git a/google-http-client/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 index 8c69dc1fd..0b2e9cef5 100644 --- a/google-http-client/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 @@ -15,16 +15,14 @@ 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; -import java.io.IOException; -import java.io.InputStream; - final class ApacheHttpResponse extends LowLevelHttpResponse { private final HttpRequestBase request; 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 76921b16d..c26a8c9a7 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 @@ -21,7 +21,13 @@ 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; @@ -52,15 +58,6 @@ import org.apache.http.params.HttpParams; import org.apache.http.params.HttpProtocolParams; -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; - /** * Thread-safe HTTP transport based on the Apache HTTP Client library. * diff --git a/google-http-client/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 index 65a6c1c96..6ae45b742 100644 --- a/google-http-client/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 @@ -16,12 +16,10 @@ import com.google.api.client.util.Preconditions; import com.google.api.client.util.StreamingContent; - -import org.apache.http.entity.AbstractHttpEntity; - import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import org.apache.http.entity.AbstractHttpEntity; /** * @author Yaniv Inbar diff --git a/google-http-client/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 index 0bc9315d9..598833de5 100644 --- a/google-http-client/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 @@ -13,10 +13,8 @@ package com.google.api.client.http.apache; import com.google.api.client.util.Preconditions; - -import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; - import java.net.URI; +import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; /** * HTTP extension method. 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 index 4fdf66310..3d507371b 100644 --- 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 @@ -14,8 +14,6 @@ package com.google.api.client.http.apache; -import org.apache.http.conn.ssl.SSLSocketFactory; - import java.io.IOException; import java.net.Socket; import java.net.UnknownHostException; @@ -24,9 +22,9 @@ 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 diff --git a/google-http-client/src/main/java/com/google/api/client/testing/http/apache/MockHttpClient.java b/google-http-client/src/main/java/com/google/api/client/testing/http/apache/MockHttpClient.java index 92ce53e97..32e8a6617 100644 --- a/google-http-client/src/main/java/com/google/api/client/testing/http/apache/MockHttpClient.java +++ b/google-http-client/src/main/java/com/google/api/client/testing/http/apache/MockHttpClient.java @@ -16,7 +16,7 @@ import com.google.api.client.util.Beta; import com.google.api.client.util.Preconditions; - +import java.io.IOException; import org.apache.http.ConnectionReuseStrategy; import org.apache.http.HttpException; import org.apache.http.HttpHost; @@ -39,8 +39,6 @@ import org.apache.http.protocol.HttpProcessor; import org.apache.http.protocol.HttpRequestExecutor; -import java.io.IOException; - /** * {@link Beta}
* Mock for {@link HttpClient} that does not actually make any network calls. From dd5a87247917b1811a4542f28c997d4a54de649b Mon Sep 17 00:00:00 2001 From: gak Date: Mon, 18 Jul 2016 18:08:26 -0700 Subject: [PATCH 05/85] Update imports ordering to the new java import order (go/java-imports). The import order is changing because the current rules are unnecessarily complicated, difficult to configure in IDEs, and difficult for users to remember. More information: http://go/java-imports-lsc Tested: $ blaze build //javatests/com/google/android/libraries/componentview/components/gencode:all //javatests/com/google/android/libraries/componentview/components/interactive:all //javatests/com/google/android/libraries/componentview/performance/testactivity:all //javatests/com/google/android/libraries/componentview/robolectric:all //javatests/com/google/android/libraries/curvular/codegen:all //javatests/com/google/android/libraries/gcoreclient/common/api/mocks:all //javatests/com/google/android/libraries/glide/cronet:all //javatests/com/google/android/libraries/gmb/bizinfov2/mocks:all //javatests/com/google/android/libraries/gmb/experiments/mocks:all //javatests/com/google/android/libraries/hangouts/video/testing:all //javatests/com/google/android/libraries/kids/supervision/chimera/shadows:all //javatests/com/google/android/libraries/kids/supervision/testcommon:all //javatests/com/google/android/libraries/location/beacon/testing:all //javatests/com/google/android/libraries/location/normalizer:all //javatests/com/google/android/libraries/location/places/eval/conversions:all //javatests/com/google/android/libraries/location/places/inference/data/model:all //javatests/com/google/android/libraries/location/places/inference/data:all //javatests/com/google/android/libraries/location/places/inference/modules:all //javatests/com/google/android/libraries/micore/context/libs/cm:all //javatests/com/google/android/libraries/micore/training/sampleapp:all //javatests/com/google/android/libraries/micore/training/service:all //javatests/com/google/android/libraries/nbu/flags:all //javatests/com/google/android/libraries/performance/primes/hprof:all //javatests/com/google/android/libraries/performance/primes/testharness:all //javatests/com/google/android/libraries/photoeditor/core:all //javatests/com/google/android/libraries/sense/processor/matchmaker:all //javatests/com/google/android/libraries/social/autobackup:all //javatests/com/google/android/libraries/social/experiments/mocks:all //javatests/com/google/android/libraries/social/notifications/testing:all //javatests/com/google/android/libraries/social/people/mocks:all //javatests/com/google/android/libraries/social/sendkit/apitest:all //javatests/com/google/android/libraries/social/sendkit/shellapp:all //javatests/com/google/android/libraries/social/socialanalytics/testing:all //javatests/com/google/android/libraries/social/squares/apitest:all //javatests/com/google/android/libraries/social/stream/streamview/shellapp:all //javatests/com/google/android/libraries/social/testing/espresso/idlingresource:all //javatests/com/google/android/libraries/stitch/binder/compiler/bar:all //javatests/com/google/android/libraries/stitch/incompat/lgemenuoverride:all //javatests/com/google/android/libraries/tvdetect:all //javatests/com/google/android/libraries/velour/buildtools/resources:all //javatests/com/google/android/libraries/youtube/common/nio:all //javatests/com/google/android/libraries/youtube/creator/fluff:all //javatests/com/google/android/libraries/youtube/edit/filters/renderer/client/pipeline:all //javatests/com/google/android/libraries/youtube/innertube/crawler/processor:all //javatests/com/google/android/libraries/youtube/player/proxy:all //javatests/com/google/android/libraries/youtube/systemhealth:all //javatests/com/google/android/libraries/youtube/upload/faststart:all //javatests/com/google/android/testing/loganalysis/parser/impl:all //javatests/com/google/android/wh/common:all //javatests/com/google/api/buganizer/stubby:all //javatests/com/google/api/client/auth/oauth:all //javatests/com/google/api/client/dapper:all //javatests/com/google/api/client/googleapis/batch:all //javatests/com/google/api/client/googleapis/extensions/appengine/auth/oauth2:all //javatests/com/google/api/client/googleapis:all //javatests/com/google/api/client/testing/util:all //javatests/com/google/api/client/util:all //javatests/com/google/api/client/xml:all //javatests/com/google/api/management/dcshared/apiconfiguration:all //javatests/com/google/api/management/dcshared/quota/appstats:all //javatests/com/google/api/management/offline/migration:all //javatests/com/google/api/management/server/apis/loasproject/v1:all //javatests/com/google/api/management/server/apis/servicemanager/v1:all //javatests/com/google/api/management/server/controlplanemigration:all //javatests/com/google/api/management/server/core/flows/util/testing:all //javatests/com/google/api/management/server/debug:all //javatests/com/google/api/management/server/domain/irdb:all //javatests/com/google/api/management/server/integrations/consumersettings:all //javatests/com/google/api/management/server/integrations/gfe/coordinatorv2:all //javatests/com/google/api/management/server/integrations/precisequotaserver:all //javatests/com/google/api/management/server/integrations/quotaserver/client:all //javatests/com/google/api/management/server/integrations/respay:all //javatests/com/google/api/management/server/integrations/serviceaccounts:all //javatests/com/google/api/management/server/superquota:all //javatests/com/google/api/management/services/apis/common/dcvisibility:all http://sponge/b448ece6-ceda-4d4a-ab21-d7511d3351e6 Some tests failed; test failures are believed to be unrelated to this CL ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=127782949 --- .../google/api/client/protobuf/ProtocolBuffersTest.java | 3 +-- .../src/test/java/com/google/api/client/xml/AtomTest.java | 4 +--- .../java/com/google/api/client/xml/GenericXmlTest.java | 7 ++----- .../google/api/client/xml/XmlNamespaceDictionaryTest.java | 6 ++---- .../src/test/java/com/google/api/client/xml/XmlTest.java | 8 +++----- .../google/api/client/http/AbstractHttpContentTest.java | 3 +-- .../com/google/api/client/http/ByteArrayContentTest.java | 4 +--- .../java/com/google/api/client/http/EmptyContentTest.java | 3 +-- .../java/com/google/api/client/http/GZipEncodingTest.java | 4 +--- .../java/com/google/api/client/http/GenericUrlTest.java | 6 ++---- .../client/http/HttpBackOffIOExpcetionHandlerTest.java | 4 +--- .../http/HttpBackOffUnsuccessfulResponseHandlerTest.java | 4 +--- .../api/client/http/HttpEncodingStreamingContentTest.java | 4 +--- .../java/com/google/api/client/http/HttpHeadersTest.java | 4 +--- .../java/com/google/api/client/http/HttpRequestTest.java | 6 ++---- .../google/api/client/http/HttpResponseExceptionTest.java | 4 +--- .../java/com/google/api/client/http/HttpResponseTest.java | 4 +--- .../com/google/api/client/http/MultipartContentTest.java | 4 +--- .../java/com/google/api/client/http/UriTemplateTest.java | 4 +--- .../com/google/api/client/http/UrlEncodedContentTest.java | 4 +--- .../com/google/api/client/http/UrlEncodedParserTest.java | 4 +--- .../api/client/http/javanet/NetHttpResponseTest.java | 4 +--- .../api/client/http/javanet/NetHttpTransportTest.java | 4 +--- .../com/google/api/client/json/JsonObjectParserTest.java | 4 +--- .../api/client/json/webtoken/JsonWebSignatureTest.java | 5 +---- .../testing/http/javanet/MockHttpUrlConnectionTest.java | 4 +--- .../google/api/client/testing/util/MockBackOffTest.java | 4 +--- .../test/java/com/google/api/client/util/BackOffTest.java | 3 +-- .../java/com/google/api/client/util/ClassInfoTest.java | 4 +--- .../test/java/com/google/api/client/util/DataMapTest.java | 4 +--- .../test/java/com/google/api/client/util/DataTest.java | 3 +-- .../java/com/google/api/client/util/DateTimeTest.java | 3 +-- .../java/com/google/api/client/util/GenericDataTest.java | 4 +--- .../api/client/util/LoggingStreamingContentTest.java | 4 +--- .../com/google/api/client/util/SecurityUtilsTest.java | 8 ++------ .../test/java/com/google/api/client/util/TypesTest.java | 4 +--- 36 files changed, 43 insertions(+), 113 deletions(-) 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 e05f01bcd..c8c5c6ec9 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 @@ -14,9 +14,8 @@ package com.google.api.client.protobuf; -import junit.framework.TestCase; - import java.io.ByteArrayInputStream; +import junit.framework.TestCase; /** * Tests {@link ProtocolBuffers}. diff --git a/google-http-client-xml/src/test/java/com/google/api/client/xml/AtomTest.java b/google-http-client-xml/src/test/java/com/google/api/client/xml/AtomTest.java index 2d221d987..65515f321 100644 --- a/google-http-client-xml/src/test/java/com/google/api/client/xml/AtomTest.java +++ b/google-http-client-xml/src/test/java/com/google/api/client/xml/AtomTest.java @@ -16,12 +16,10 @@ import com.google.api.client.http.HttpHeaders; import com.google.api.client.xml.atom.Atom; - +import java.util.List; import junit.framework.TestCase; import org.junit.Assert; -import java.util.List; - /** * Tests {@link Atom}. * diff --git a/google-http-client-xml/src/test/java/com/google/api/client/xml/GenericXmlTest.java b/google-http-client-xml/src/test/java/com/google/api/client/xml/GenericXmlTest.java index a3d39d148..d8c57918e 100644 --- a/google-http-client-xml/src/test/java/com/google/api/client/xml/GenericXmlTest.java +++ b/google-http-client-xml/src/test/java/com/google/api/client/xml/GenericXmlTest.java @@ -15,13 +15,10 @@ package com.google.api.client.xml; import com.google.api.client.util.ArrayMap; - -import org.xmlpull.v1.XmlPullParser; - -import junit.framework.TestCase; - import java.io.StringReader; import java.util.Collection; +import junit.framework.TestCase; +import org.xmlpull.v1.XmlPullParser; /** * Tests {@link GenericXml}. diff --git a/google-http-client-xml/src/test/java/com/google/api/client/xml/XmlNamespaceDictionaryTest.java b/google-http-client-xml/src/test/java/com/google/api/client/xml/XmlNamespaceDictionaryTest.java index 87c26cad5..051b6e5ec 100644 --- a/google-http-client-xml/src/test/java/com/google/api/client/xml/XmlNamespaceDictionaryTest.java +++ b/google-http-client-xml/src/test/java/com/google/api/client/xml/XmlNamespaceDictionaryTest.java @@ -17,13 +17,11 @@ import com.google.api.client.util.Key; import com.google.api.client.xml.atom.Atom; import com.google.common.collect.ImmutableMap; - -import junit.framework.TestCase; -import org.xmlpull.v1.XmlSerializer; - import java.io.StringWriter; import java.util.Collection; import java.util.TreeSet; +import junit.framework.TestCase; +import org.xmlpull.v1.XmlSerializer; /** * Tests {@link XmlNamespaceDictionary}. diff --git a/google-http-client-xml/src/test/java/com/google/api/client/xml/XmlTest.java b/google-http-client-xml/src/test/java/com/google/api/client/xml/XmlTest.java index 5abab62ba..033d3e1ba 100644 --- a/google-http-client-xml/src/test/java/com/google/api/client/xml/XmlTest.java +++ b/google-http-client-xml/src/test/java/com/google/api/client/xml/XmlTest.java @@ -16,15 +16,13 @@ import com.google.api.client.util.ArrayMap; import com.google.api.client.util.Key; - -import junit.framework.TestCase; -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlSerializer; - import java.io.ByteArrayOutputStream; import java.io.StringReader; import java.util.ArrayList; import java.util.Map; +import junit.framework.TestCase; +import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlSerializer; /** * Tests {@link Xml}. diff --git a/google-http-client/src/test/java/com/google/api/client/http/AbstractHttpContentTest.java b/google-http-client/src/test/java/com/google/api/client/http/AbstractHttpContentTest.java index 71bccd554..78269ae7b 100644 --- a/google-http-client/src/test/java/com/google/api/client/http/AbstractHttpContentTest.java +++ b/google-http-client/src/test/java/com/google/api/client/http/AbstractHttpContentTest.java @@ -14,11 +14,10 @@ package com.google.api.client.http; -import junit.framework.TestCase; - import java.io.IOException; import java.io.OutputStream; import java.util.Arrays; +import junit.framework.TestCase; /** * Tests {@link AbstractHttpContent}. diff --git a/google-http-client/src/test/java/com/google/api/client/http/ByteArrayContentTest.java b/google-http-client/src/test/java/com/google/api/client/http/ByteArrayContentTest.java index 45b3354e3..da73c5437 100644 --- a/google-http-client/src/test/java/com/google/api/client/http/ByteArrayContentTest.java +++ b/google-http-client/src/test/java/com/google/api/client/http/ByteArrayContentTest.java @@ -16,11 +16,9 @@ import com.google.api.client.util.IOUtils; import com.google.api.client.util.StringUtils; - -import junit.framework.TestCase; - import java.io.ByteArrayOutputStream; import java.io.IOException; +import junit.framework.TestCase; /** * Tests {@link ByteArrayContent}. diff --git a/google-http-client/src/test/java/com/google/api/client/http/EmptyContentTest.java b/google-http-client/src/test/java/com/google/api/client/http/EmptyContentTest.java index 82d5107ec..501e9d70e 100644 --- a/google-http-client/src/test/java/com/google/api/client/http/EmptyContentTest.java +++ b/google-http-client/src/test/java/com/google/api/client/http/EmptyContentTest.java @@ -15,10 +15,9 @@ package com.google.api.client.http; -import junit.framework.TestCase; - import java.io.ByteArrayOutputStream; import java.io.IOException; +import junit.framework.TestCase; /** * Tests {@link EmptyContent}. diff --git a/google-http-client/src/test/java/com/google/api/client/http/GZipEncodingTest.java b/google-http-client/src/test/java/com/google/api/client/http/GZipEncodingTest.java index 5ef4bc2b2..8746a5c66 100644 --- a/google-http-client/src/test/java/com/google/api/client/http/GZipEncodingTest.java +++ b/google-http-client/src/test/java/com/google/api/client/http/GZipEncodingTest.java @@ -18,12 +18,10 @@ import com.google.api.client.testing.util.TestableByteArrayOutputStream; import com.google.api.client.util.ByteArrayStreamingContent; import com.google.api.client.util.StringUtils; - +import java.io.IOException; import junit.framework.TestCase; import org.junit.Assert; -import java.io.IOException; - /** * Tests {@link GZipEncoding}. * diff --git a/google-http-client/src/test/java/com/google/api/client/http/GenericUrlTest.java b/google-http-client/src/test/java/com/google/api/client/http/GenericUrlTest.java index 9b8f4ebdc..f4a8b22a2 100644 --- a/google-http-client/src/test/java/com/google/api/client/http/GenericUrlTest.java +++ b/google-http-client/src/test/java/com/google/api/client/http/GenericUrlTest.java @@ -15,10 +15,6 @@ package com.google.api.client.http; import com.google.api.client.util.Key; - -import junit.framework.TestCase; -import org.junit.Assert; - import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; @@ -28,6 +24,8 @@ import java.util.Collection; import java.util.Iterator; import java.util.List; +import junit.framework.TestCase; +import org.junit.Assert; /** * Tests {@link GenericUrl}. diff --git a/google-http-client/src/test/java/com/google/api/client/http/HttpBackOffIOExpcetionHandlerTest.java b/google-http-client/src/test/java/com/google/api/client/http/HttpBackOffIOExpcetionHandlerTest.java index 784553a03..db4fcdc54 100644 --- a/google-http-client/src/test/java/com/google/api/client/http/HttpBackOffIOExpcetionHandlerTest.java +++ b/google-http-client/src/test/java/com/google/api/client/http/HttpBackOffIOExpcetionHandlerTest.java @@ -17,10 +17,8 @@ import com.google.api.client.testing.util.MockBackOff; import com.google.api.client.testing.util.MockSleeper; import com.google.api.client.util.BackOff; - -import junit.framework.TestCase; - import java.io.IOException; +import junit.framework.TestCase; /** * Tests {@link HttpBackOffIOExceptionHandler}. diff --git a/google-http-client/src/test/java/com/google/api/client/http/HttpBackOffUnsuccessfulResponseHandlerTest.java b/google-http-client/src/test/java/com/google/api/client/http/HttpBackOffUnsuccessfulResponseHandlerTest.java index 96086d382..a5dd36538 100644 --- a/google-http-client/src/test/java/com/google/api/client/http/HttpBackOffUnsuccessfulResponseHandlerTest.java +++ b/google-http-client/src/test/java/com/google/api/client/http/HttpBackOffUnsuccessfulResponseHandlerTest.java @@ -18,10 +18,8 @@ import com.google.api.client.testing.util.MockBackOff; import com.google.api.client.testing.util.MockSleeper; import com.google.api.client.util.BackOff; - -import junit.framework.TestCase; - import java.io.IOException; +import junit.framework.TestCase; /** * Test {@link HttpBackOffUnsuccessfulResponseHandler}. diff --git a/google-http-client/src/test/java/com/google/api/client/http/HttpEncodingStreamingContentTest.java b/google-http-client/src/test/java/com/google/api/client/http/HttpEncodingStreamingContentTest.java index fd9565b75..42fec080a 100644 --- a/google-http-client/src/test/java/com/google/api/client/http/HttpEncodingStreamingContentTest.java +++ b/google-http-client/src/test/java/com/google/api/client/http/HttpEncodingStreamingContentTest.java @@ -17,12 +17,10 @@ import com.google.api.client.testing.util.TestableByteArrayOutputStream; import com.google.api.client.util.ByteArrayStreamingContent; import com.google.api.client.util.StringUtils; - +import java.io.IOException; import junit.framework.TestCase; import org.junit.Assert; -import java.io.IOException; - /** * Tests {@link HttpEncodingStreamingContent}. * diff --git a/google-http-client/src/test/java/com/google/api/client/http/HttpHeadersTest.java b/google-http-client/src/test/java/com/google/api/client/http/HttpHeadersTest.java index 3d1445a17..46ba7de72 100644 --- a/google-http-client/src/test/java/com/google/api/client/http/HttpHeadersTest.java +++ b/google-http-client/src/test/java/com/google/api/client/http/HttpHeadersTest.java @@ -19,15 +19,13 @@ import com.google.api.client.testing.http.MockLowLevelHttpResponse; import com.google.api.client.util.Key; import com.google.common.collect.ImmutableList; - -import junit.framework.TestCase; - import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.Writer; import java.util.Arrays; import java.util.List; +import junit.framework.TestCase; /** * Tests {@link HttpHeaders}. 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 6e7eb4924..7774e3b38 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 @@ -31,10 +31,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; - -import junit.framework.Assert; -import junit.framework.TestCase; - import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.Arrays; @@ -46,6 +42,8 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.logging.Level; +import junit.framework.Assert; +import junit.framework.TestCase; /** * Tests {@link HttpRequest}. 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 c5ac562d3..950c40d7e 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 @@ -20,15 +20,13 @@ import com.google.api.client.testing.http.MockLowLevelHttpRequest; import com.google.api.client.testing.http.MockLowLevelHttpResponse; import com.google.api.client.util.StringUtils; - -import junit.framework.TestCase; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutput; import java.io.ObjectOutputStream; +import junit.framework.TestCase; /** * Tests {@link HttpResponseException}. 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 7fc458538..e6088ee33 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 @@ -22,15 +22,13 @@ import com.google.api.client.testing.util.LogRecordingHandler; import com.google.api.client.testing.util.TestableByteArrayInputStream; import com.google.api.client.util.Key; - -import junit.framework.TestCase; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.lang.reflect.Type; import java.util.Arrays; import java.util.logging.Level; +import junit.framework.TestCase; /** * Tests {@link HttpResponse}. diff --git a/google-http-client/src/test/java/com/google/api/client/http/MultipartContentTest.java b/google-http-client/src/test/java/com/google/api/client/http/MultipartContentTest.java index d9535f51d..fd6c08b4b 100644 --- a/google-http-client/src/test/java/com/google/api/client/http/MultipartContentTest.java +++ b/google-http-client/src/test/java/com/google/api/client/http/MultipartContentTest.java @@ -16,10 +16,8 @@ import com.google.api.client.json.Json; import com.google.api.client.util.StringUtils; - -import junit.framework.TestCase; - import java.io.ByteArrayOutputStream; +import junit.framework.TestCase; /** * Tests {@link MultipartContent}. 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 bfd06d24f..2dfcc1f3d 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 @@ -17,13 +17,11 @@ import com.google.api.client.util.Value; import com.google.common.collect.Lists; import com.google.common.collect.Maps; - -import junit.framework.TestCase; - import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.SortedMap; +import junit.framework.TestCase; /** * Tests {@link UriTemplate}. diff --git a/google-http-client/src/test/java/com/google/api/client/http/UrlEncodedContentTest.java b/google-http-client/src/test/java/com/google/api/client/http/UrlEncodedContentTest.java index 94ab11323..7b140cac3 100644 --- a/google-http-client/src/test/java/com/google/api/client/http/UrlEncodedContentTest.java +++ b/google-http-client/src/test/java/com/google/api/client/http/UrlEncodedContentTest.java @@ -17,15 +17,13 @@ import com.google.api.client.testing.http.HttpTesting; import com.google.api.client.testing.http.MockHttpTransport; import com.google.api.client.util.ArrayMap; - -import junit.framework.TestCase; - import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; +import junit.framework.TestCase; /** * Tests {@link UrlEncodedContent}. diff --git a/google-http-client/src/test/java/com/google/api/client/http/UrlEncodedParserTest.java b/google-http-client/src/test/java/com/google/api/client/http/UrlEncodedParserTest.java index 81bb49687..8042ecf17 100644 --- a/google-http-client/src/test/java/com/google/api/client/http/UrlEncodedParserTest.java +++ b/google-http-client/src/test/java/com/google/api/client/http/UrlEncodedParserTest.java @@ -19,15 +19,13 @@ import com.google.api.client.util.Key; import com.google.api.client.util.Objects; import com.google.api.client.util.Value; - -import junit.framework.TestCase; - import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import junit.framework.TestCase; /** * Tests {@link UrlEncodedParser}. diff --git a/google-http-client/src/test/java/com/google/api/client/http/javanet/NetHttpResponseTest.java b/google-http-client/src/test/java/com/google/api/client/http/javanet/NetHttpResponseTest.java index 39fc04dfe..550ea146c 100644 --- a/google-http-client/src/test/java/com/google/api/client/http/javanet/NetHttpResponseTest.java +++ b/google-http-client/src/test/java/com/google/api/client/http/javanet/NetHttpResponseTest.java @@ -16,13 +16,11 @@ import com.google.api.client.testing.http.javanet.MockHttpURLConnection; import com.google.api.client.util.StringUtils; - -import junit.framework.TestCase; - import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.charset.Charset; +import junit.framework.TestCase; /** * Tests {@link NetHttpResponse}. diff --git a/google-http-client/src/test/java/com/google/api/client/http/javanet/NetHttpTransportTest.java b/google-http-client/src/test/java/com/google/api/client/http/javanet/NetHttpTransportTest.java index aa0760b73..56e65c01b 100644 --- a/google-http-client/src/test/java/com/google/api/client/http/javanet/NetHttpTransportTest.java +++ b/google-http-client/src/test/java/com/google/api/client/http/javanet/NetHttpTransportTest.java @@ -18,14 +18,12 @@ import com.google.api.client.testing.http.javanet.MockHttpURLConnection; import com.google.api.client.util.ByteArrayStreamingContent; import com.google.api.client.util.StringUtils; - -import junit.framework.TestCase; - import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; +import junit.framework.TestCase; /** * Tests {@link NetHttpTransport}. diff --git a/google-http-client/src/test/java/com/google/api/client/json/JsonObjectParserTest.java b/google-http-client/src/test/java/com/google/api/client/json/JsonObjectParserTest.java index efd809771..b5d88adc8 100644 --- a/google-http-client/src/test/java/com/google/api/client/json/JsonObjectParserTest.java +++ b/google-http-client/src/test/java/com/google/api/client/json/JsonObjectParserTest.java @@ -18,15 +18,13 @@ import static org.mockito.Mockito.when; import com.google.common.base.Charsets; - -import junit.framework.TestCase; - import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.Reader; import java.io.StringReader; import java.lang.reflect.Type; import java.nio.charset.Charset; +import junit.framework.TestCase; /** * Tests for the {@link JsonObjectParser} class. diff --git a/google-http-client/src/test/java/com/google/api/client/json/webtoken/JsonWebSignatureTest.java b/google-http-client/src/test/java/com/google/api/client/json/webtoken/JsonWebSignatureTest.java index a7ebfbe3e..b26237569 100644 --- a/google-http-client/src/test/java/com/google/api/client/json/webtoken/JsonWebSignatureTest.java +++ b/google-http-client/src/test/java/com/google/api/client/json/webtoken/JsonWebSignatureTest.java @@ -17,13 +17,10 @@ import com.google.api.client.testing.json.MockJsonFactory; import com.google.api.client.testing.json.webtoken.TestCertificates; import com.google.api.client.testing.util.SecurityTestUtils; - -import junit.framework.TestCase; - import java.security.cert.X509Certificate; import java.security.interfaces.RSAPrivateKey; - import javax.net.ssl.X509TrustManager; +import junit.framework.TestCase; /** * Tests {@link JsonWebSignature}. diff --git a/google-http-client/src/test/java/com/google/api/client/testing/http/javanet/MockHttpUrlConnectionTest.java b/google-http-client/src/test/java/com/google/api/client/testing/http/javanet/MockHttpUrlConnectionTest.java index 707af7ea3..6f54f1975 100644 --- a/google-http-client/src/test/java/com/google/api/client/testing/http/javanet/MockHttpUrlConnectionTest.java +++ b/google-http-client/src/test/java/com/google/api/client/testing/http/javanet/MockHttpUrlConnectionTest.java @@ -16,9 +16,6 @@ import com.google.api.client.testing.http.HttpTesting; import com.google.api.client.util.StringUtils; - -import junit.framework.TestCase; - import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -26,6 +23,7 @@ import java.util.Arrays; import java.util.List; import java.util.Map; +import junit.framework.TestCase; /** * Tests {@link MockHttpURLConnection}. diff --git a/google-http-client/src/test/java/com/google/api/client/testing/util/MockBackOffTest.java b/google-http-client/src/test/java/com/google/api/client/testing/util/MockBackOffTest.java index 2c3246243..127edb1b0 100644 --- a/google-http-client/src/test/java/com/google/api/client/testing/util/MockBackOffTest.java +++ b/google-http-client/src/test/java/com/google/api/client/testing/util/MockBackOffTest.java @@ -15,10 +15,8 @@ package com.google.api.client.testing.util; import com.google.api.client.util.BackOff; - -import junit.framework.TestCase; - import java.io.IOException; +import junit.framework.TestCase; /** * Tests {@link MockBackOff}. diff --git a/google-http-client/src/test/java/com/google/api/client/util/BackOffTest.java b/google-http-client/src/test/java/com/google/api/client/util/BackOffTest.java index b510b8841..b88dd780b 100644 --- a/google-http-client/src/test/java/com/google/api/client/util/BackOffTest.java +++ b/google-http-client/src/test/java/com/google/api/client/util/BackOffTest.java @@ -14,9 +14,8 @@ package com.google.api.client.util; -import junit.framework.TestCase; - import java.io.IOException; +import junit.framework.TestCase; /** * Tests {@link BackOff}. diff --git a/google-http-client/src/test/java/com/google/api/client/util/ClassInfoTest.java b/google-http-client/src/test/java/com/google/api/client/util/ClassInfoTest.java index 045327ace..c7ec1c7af 100644 --- a/google-http-client/src/test/java/com/google/api/client/util/ClassInfoTest.java +++ b/google-http-client/src/test/java/com/google/api/client/util/ClassInfoTest.java @@ -16,10 +16,8 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; - -import junit.framework.TestCase; - import java.util.Arrays; +import junit.framework.TestCase; /** * Tests {@link ClassInfo}. diff --git a/google-http-client/src/test/java/com/google/api/client/util/DataMapTest.java b/google-http-client/src/test/java/com/google/api/client/util/DataMapTest.java index e176c960f..30d5eba0d 100644 --- a/google-http-client/src/test/java/com/google/api/client/util/DataMapTest.java +++ b/google-http-client/src/test/java/com/google/api/client/util/DataMapTest.java @@ -16,11 +16,9 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; - -import junit.framework.TestCase; - import java.util.Iterator; import java.util.Map; +import junit.framework.TestCase; /** * Tests {@link DataMap}. diff --git a/google-http-client/src/test/java/com/google/api/client/util/DataTest.java b/google-http-client/src/test/java/com/google/api/client/util/DataTest.java index b6e075311..75ebc160b 100644 --- a/google-http-client/src/test/java/com/google/api/client/util/DataTest.java +++ b/google-http-client/src/test/java/com/google/api/client/util/DataTest.java @@ -14,8 +14,6 @@ package com.google.api.client.util; -import junit.framework.TestCase; - import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; @@ -40,6 +38,7 @@ import java.util.TreeMap; import java.util.TreeSet; import java.util.concurrent.ConcurrentMap; +import junit.framework.TestCase; /** * Tests {@link Data}. diff --git a/google-http-client/src/test/java/com/google/api/client/util/DateTimeTest.java b/google-http-client/src/test/java/com/google/api/client/util/DateTimeTest.java index 87b54e139..7313d92ce 100644 --- a/google-http-client/src/test/java/com/google/api/client/util/DateTimeTest.java +++ b/google-http-client/src/test/java/com/google/api/client/util/DateTimeTest.java @@ -14,10 +14,9 @@ package com.google.api.client.util; -import junit.framework.TestCase; - import java.util.Date; import java.util.TimeZone; +import junit.framework.TestCase; /** * Tests {@link DateTime}. 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 45547231a..91d319561 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,12 +15,10 @@ package com.google.api.client.util; import com.google.api.client.util.GenericData.Flags; - +import java.util.EnumSet; import junit.framework.Assert; import junit.framework.TestCase; -import java.util.EnumSet; - /** * Tests {@link GenericData}. * diff --git a/google-http-client/src/test/java/com/google/api/client/util/LoggingStreamingContentTest.java b/google-http-client/src/test/java/com/google/api/client/util/LoggingStreamingContentTest.java index d3a1fb7a9..2a353466a 100644 --- a/google-http-client/src/test/java/com/google/api/client/util/LoggingStreamingContentTest.java +++ b/google-http-client/src/test/java/com/google/api/client/util/LoggingStreamingContentTest.java @@ -15,13 +15,11 @@ package com.google.api.client.util; import com.google.api.client.testing.util.LogRecordingHandler; - -import junit.framework.TestCase; - import java.io.ByteArrayOutputStream; import java.util.Arrays; import java.util.logging.Level; import java.util.logging.Logger; +import junit.framework.TestCase; /** * Tests {@link LoggingStreamingContent}. diff --git a/google-http-client/src/test/java/com/google/api/client/util/SecurityUtilsTest.java b/google-http-client/src/test/java/com/google/api/client/util/SecurityUtilsTest.java index 6228243a5..aa3eab20a 100644 --- a/google-http-client/src/test/java/com/google/api/client/util/SecurityUtilsTest.java +++ b/google-http-client/src/test/java/com/google/api/client/util/SecurityUtilsTest.java @@ -16,19 +16,15 @@ import com.google.api.client.testing.json.webtoken.TestCertificates; import com.google.api.client.testing.util.SecurityTestUtils; - -import junit.framework.TestCase; - -import org.junit.Assert; - import java.io.ByteArrayInputStream; import java.security.PrivateKey; import java.security.Signature; import java.security.cert.X509Certificate; import java.security.interfaces.RSAPublicKey; import java.util.ArrayList; - import javax.net.ssl.X509TrustManager; +import junit.framework.TestCase; +import org.junit.Assert; /** * Tests {@link SecurityUtils}. diff --git a/google-http-client/src/test/java/com/google/api/client/util/TypesTest.java b/google-http-client/src/test/java/com/google/api/client/util/TypesTest.java index 258090f34..f325633f1 100644 --- a/google-http-client/src/test/java/com/google/api/client/util/TypesTest.java +++ b/google-http-client/src/test/java/com/google/api/client/util/TypesTest.java @@ -18,9 +18,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; - -import junit.framework.TestCase; - import java.lang.reflect.GenericArrayType; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; @@ -36,6 +33,7 @@ import java.util.Stack; import java.util.TreeMap; import java.util.Vector; +import junit.framework.TestCase; /** * Tests {@link Types}. From a6eba5f009dac1126862276880cd227a5f881973 Mon Sep 17 00:00:00 2001 From: gbartlett Date: Fri, 22 Jul 2016 11:03:37 -0700 Subject: [PATCH 06/85] typo in comments/javadoc ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=128190808 --- .../com/google/api/client/http/javanet/ConnectionFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-http-client/src/main/java/com/google/api/client/http/javanet/ConnectionFactory.java b/google-http-client/src/main/java/com/google/api/client/http/javanet/ConnectionFactory.java index 84ad031dc..49479303b 100644 --- a/google-http-client/src/main/java/com/google/api/client/http/javanet/ConnectionFactory.java +++ b/google-http-client/src/main/java/com/google/api/client/http/javanet/ConnectionFactory.java @@ -12,7 +12,7 @@ public interface ConnectionFactory { /** * Creates a new {@link HttpURLConnection} from the given {@code url}. * - * @param url the URL to which the conneciton will be made + * @param url the URL to which the connection will be made * @return the created connection object, which will still be in the pre-connected state * @throws IOException if there was a problem producing the connection * @throws ClassCastException if the URL is not for an HTTP endpoint From 945d79f7b12d97521fb4b165a2fffc69b7a45182 Mon Sep 17 00:00:00 2001 From: gak Date: Mon, 25 Jul 2016 11:43:13 -0700 Subject: [PATCH 07/85] Update imports ordering to the new java import order (go/java-imports). The import order is changing because the current rules are unnecessarily complicated, difficult to configure in IDEs, and difficult for users to remember. More information: http://go/java-imports-lsc Tested: $ blaze build //javatests/com/google/android/libraries/vision/ocr:all //javatests/com/google/android/libraries/vision/visionkit/base:all //javatests/com/google/android/libraries/vision/visionkit/imageutils:all //javatests/com/google/android/libraries/vision/visionkit/samples/edith:all //javatests/com/google/android/libraries/vision/visionkit/ui/cards:all //javatests/com/google/android/libraries/vision/visionkit/ui/shapes:all //javatests/com/google/android/libraries/wallet/addressapi:all //javatests/com/google/android/libraries/wallet/addwalletobject:all //javatests/com/google/android/libraries/wallet/billing:all //javatests/com/google/android/libraries/wallet/instrumentmanager:all //javatests/com/google/android/libraries/wallet/orchestration:all //javatests/com/google/android/libraries/youtube/ads/client:all //javatests/com/google/android/libraries/youtube/ads/companion:all //javatests/com/google/android/libraries/youtube/ads/macros:all //javatests/com/google/android/libraries/youtube/ads/player/prewarm:all //javatests/com/google/android/libraries/youtube/comment/endpoint:all //javatests/com/google/android/libraries/youtube/common/cache:all //javatests/com/google/android/libraries/youtube/common/concurrent:all //javatests/com/google/android/libraries/youtube/common/network/hurl:all //javatests/com/google/android/libraries/youtube/creator/actionbar:all //javatests/com/google/android/libraries/youtube/creator/analytics/header:all //javatests/com/google/android/libraries/youtube/creator/browse:all //javatests/com/google/android/libraries/youtube/creator/community/v2:all //javatests/com/google/android/libraries/youtube/creator/dashboard:all //javatests/com/google/android/libraries/youtube/creator/header:all //javatests/com/google/android/libraries/youtube/creator/survey:all //javatests/com/google/android/libraries/youtube/edit/audioswap/model:all //javatests/com/google/android/libraries/youtube/edit/audioswap/ui:all //javatests/com/google/android/libraries/youtube/edit/renderer/upload:all //javatests/com/google/android/libraries/youtube/infocards:all //javatests/com/google/android/libraries/youtube/innertube/ads:all //javatests/com/google/android/libraries/youtube/innertube/config:all //javatests/com/google/android/libraries/youtube/innertube/endpoint:all //javatests/com/google/android/libraries/youtube/innertube/model/player:all //javatests/com/google/android/libraries/youtube/legacy/suggest:all //javatests/com/google/android/libraries/youtube/logging/drp:all //javatests/com/google/android/libraries/youtube/logging:all //javatests/com/google/android/libraries/youtube/mdx/command:all //javatests/com/google/android/libraries/youtube/mdx/promotion:all //javatests/com/google/android/libraries/youtube/mdx:all //javatests/com/google/android/libraries/youtube/media/multipart:all //javatests/com/google/android/libraries/youtube/media/player/exo/audio/dsp:all //javatests/com/google/android/libraries/youtube/media/player/internal:all //javatests/com/google/android/libraries/youtube/media/player:all //javatests/com/google/android/libraries/youtube/net/delayedevents:all //javatests/com/google/android/libraries/youtube/net/gcm:all //javatests/com/google/android/libraries/youtube/net/ping:all //javatests/com/google/android/libraries/youtube/net/request:all //javatests/com/google/android/libraries/youtube/net/visitorid:all //javatests/com/google/android/libraries/youtube/notification/gcm:all //javatests/com/google/android/libraries/youtube/offline/model:all //javatests/com/google/android/libraries/youtube/offline/transfer/timewindow:all //javatests/com/google/android/libraries/youtube/player/audiofocus:all //javatests/com/google/android/libraries/youtube/player/net:all //javatests/com/google/android/libraries/youtube/player/overlay:all //javatests/com/google/android/libraries/youtube/player/proxy:all //javatests/com/google/android/libraries/youtube/player/service:all //javatests/com/google/android/libraries/youtube/player/stats:all //javatests/com/google/android/libraries/youtube/player/subtitles:all //javatests/com/google/android/libraries/youtube/player/ui/controls/listener:all //javatests/com/google/android/libraries/youtube/player/ui:all //javatests/com/google/android/libraries/youtube/player/video/interrupt:all //javatests/com/google/android/libraries/youtube/spacecast/types:all //javatests/com/google/android/libraries/youtube/systemhealth/manager:all //javatests/com/google/android/libraries/youtube/systemhealth/transmitters:all //javatests/com/google/android/libraries/youtube/tubestresser/testing/fakes/innertube:all //javatests/com/google/android/libraries/youtube/tubestresser/testing/network:all //javatests/com/google/android/libraries/youtube/upload/service/framework:all //javatests/com/google/android/testing/accessibility/greenlines/example:all //javatests/com/google/android/testing/i18n/imetester:all //javatests/com/google/android/wearable/fitness/common/models:all //javatests/com/google/android/wearable/fitness/common/prefs:all //javatests/com/google/android/wearable/fitness/realtime/active:all //javatests/com/google/android/wearable/photos:all //javatests/com/google/api/client/util:all http://sponge/fe70367c-70d8-4310-a0eb-8c82e026fd93 Some tests failed; test failures are believed to be unrelated to this CL ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=128381657 --- .../test/java/com/google/api/client/util/IOUtilsTest.java | 3 +-- .../test/java/com/google/api/client/util/PemReaderTest.java | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/google-http-client/src/test/java/com/google/api/client/util/IOUtilsTest.java b/google-http-client/src/test/java/com/google/api/client/util/IOUtilsTest.java index 0e770326b..f38c8dac7 100644 --- a/google-http-client/src/test/java/com/google/api/client/util/IOUtilsTest.java +++ b/google-http-client/src/test/java/com/google/api/client/util/IOUtilsTest.java @@ -14,10 +14,9 @@ package com.google.api.client.util; -import junit.framework.TestCase; - import java.io.File; import java.io.IOException; +import junit.framework.TestCase; /** * Tests {@link IOUtils}. diff --git a/google-http-client/src/test/java/com/google/api/client/util/PemReaderTest.java b/google-http-client/src/test/java/com/google/api/client/util/PemReaderTest.java index 697c1bec7..8a1d01e5f 100644 --- a/google-http-client/src/test/java/com/google/api/client/util/PemReaderTest.java +++ b/google-http-client/src/test/java/com/google/api/client/util/PemReaderTest.java @@ -14,11 +14,10 @@ package com.google.api.client.util; -import junit.framework.TestCase; -import org.junit.Assert; - import java.io.InputStream; import java.io.InputStreamReader; +import junit.framework.TestCase; +import org.junit.Assert; /** * Tests {@link PemReader}. From 81fbe8d60f8f543e221514f83dcf9bdfb0e4076b Mon Sep 17 00:00:00 2001 From: wzoltak Date: Wed, 14 Sep 2016 11:54:42 -0700 Subject: [PATCH 08/85] Add Precondition Failed code (412) for users of the Compute API. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=133154438 --- .../main/java/com/google/api/client/http/HttpStatusCodes.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/google-http-client/src/main/java/com/google/api/client/http/HttpStatusCodes.java b/google-http-client/src/main/java/com/google/api/client/http/HttpStatusCodes.java index 1fbb18699..88b56eb21 100644 --- a/google-http-client/src/main/java/com/google/api/client/http/HttpStatusCodes.java +++ b/google-http-client/src/main/java/com/google/api/client/http/HttpStatusCodes.java @@ -68,6 +68,9 @@ public class HttpStatusCodes { /** Status code for a request that could not be completed due to a resource conflict. */ public static final int STATUS_CODE_CONFLICT = 409; + + /** Status code for a request for which one of the conditions it was made under has failed. */ + public static final int STATUS_CODE_PRECONDITION_FAILED = 412; /** Status code for an internal server error. */ public static final int STATUS_CODE_SERVER_ERROR = 500; From 956df84159e414bb45bd2f41abe91ef0d0461f4e Mon Sep 17 00:00:00 2001 From: fanghui Date: Thu, 8 Dec 2016 11:08:04 -0800 Subject: [PATCH 09/85] Add status code "Bad Request" (400). ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=141460113 --- .../main/java/com/google/api/client/http/HttpStatusCodes.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/google-http-client/src/main/java/com/google/api/client/http/HttpStatusCodes.java b/google-http-client/src/main/java/com/google/api/client/http/HttpStatusCodes.java index 88b56eb21..5777cb66c 100644 --- a/google-http-client/src/main/java/com/google/api/client/http/HttpStatusCodes.java +++ b/google-http-client/src/main/java/com/google/api/client/http/HttpStatusCodes.java @@ -51,6 +51,9 @@ public class HttpStatusCodes { /** Status code for a resource that has temporarily moved to a new URI. */ public static final int STATUS_CODE_TEMPORARY_REDIRECT = 307; + /** Status code for a request that could not be understood by the server. */ + public static final int STATUS_CODE_BAD_REQUEST = 400; + /** Status code for a request that requires user authentication. */ public static final int STATUS_CODE_UNAUTHORIZED = 401; From 2e2e395efce81fd5d323a8f2accd4cc0bb29d712 Mon Sep 17 00:00:00 2001 From: lianyang Date: Mon, 6 Feb 2017 07:17:17 -0800 Subject: [PATCH 10/85] Add HTTP status code CREATED (201). ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=146661068 --- .../main/java/com/google/api/client/http/HttpStatusCodes.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/google-http-client/src/main/java/com/google/api/client/http/HttpStatusCodes.java b/google-http-client/src/main/java/com/google/api/client/http/HttpStatusCodes.java index 5777cb66c..dc426e8dd 100644 --- a/google-http-client/src/main/java/com/google/api/client/http/HttpStatusCodes.java +++ b/google-http-client/src/main/java/com/google/api/client/http/HttpStatusCodes.java @@ -26,6 +26,9 @@ public class HttpStatusCodes { /** Status code for a successful request. */ public static final int STATUS_CODE_OK = 200; + /** Status code for a successful request that has been fulfilled to create a new resource. */ + public static final int STATUS_CODE_CREATED = 201; + /** * Status code for a successful request with no content information. * From 1c6049a8a4d148c570ee36adeb7dae7abd1c7127 Mon Sep 17 00:00:00 2001 From: kak Date: Fri, 17 Feb 2017 12:25:35 -0800 Subject: [PATCH 11/85] Migrate from deprecated Throwables.propagateIfPossible(throwable) to throwIfUnchecked(throwable). ATTENTION: the previous method allowed a null Throwable, but the replacement does not. If this is a problem, please let me know. More information: go/throwables-lsc Tested: TAP train for global presubmit queue http://test/OCL:147290834:BASE:147288131:1486945534671:7ebcefdb Some tests failed; test failures are believed to be unrelated to this CL ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=147866181 --- .../main/java/com/google/api/client/util/Throwables.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/google-http-client/src/main/java/com/google/api/client/util/Throwables.java b/google-http-client/src/main/java/com/google/api/client/util/Throwables.java index 86e9927d2..2fd192f77 100644 --- a/google-http-client/src/main/java/com/google/api/client/util/Throwables.java +++ b/google-http-client/src/main/java/com/google/api/client/util/Throwables.java @@ -74,7 +74,14 @@ public static RuntimeException propagate(Throwable throwable) { * @param throwable throwable (may be {@code null}) */ public static void propagateIfPossible(Throwable throwable) { - com.google.common.base.Throwables.propagateIfPossible(throwable); + if (throwable != null) { + if (throwable instanceof RuntimeException) { + throw (RuntimeException) throwable; + } + if (throwable instanceof Error) { + throw (Error) throwable; + } + } } /** From 3e6c79412d3cbcd78663a2b6c3392efd2cf4e881 Mon Sep 17 00:00:00 2001 From: glorioso Date: Fri, 10 Mar 2017 11:47:08 -0800 Subject: [PATCH 12/85] Update tests that were manually asserting that objects were not equals() to an object of an unrelated class to use EqualsTester instead, which exhaustively checks equals() and hashCode(). This CL is in service of enabling a new compile-time error: go/bugpattern/EqualsIncompatibleType This change is part of an go/LSC process. See more about this change: https://docs.google.com/document/d/1iUC8Xpss0Y558wuipOVHvdQAMRMgR_oWHCeSdLV22xw/edit Tested: TAP --sample for global presubmit queue http://test/OCL:149062924:BASE:149043627:1488501672029:8ae9f150 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=149781297 --- google-http-client/pom.xml | 5 +++++ .../google/api/client/http/HttpMediaTypeTest.java | 12 ++++++------ pom.xml | 5 +++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/google-http-client/pom.xml b/google-http-client/pom.xml index 89ac280d2..0c7bad783 100644 --- a/google-http-client/pom.xml +++ b/google-http-client/pom.xml @@ -118,6 +118,11 @@ guava-jdk5 provided + + com.google.guava + guava-testlib-jdk5 + test + junit junit diff --git a/google-http-client/src/test/java/com/google/api/client/http/HttpMediaTypeTest.java b/google-http-client/src/test/java/com/google/api/client/http/HttpMediaTypeTest.java index 11d57a406..80765d409 100644 --- a/google-http-client/src/test/java/com/google/api/client/http/HttpMediaTypeTest.java +++ b/google-http-client/src/test/java/com/google/api/client/http/HttpMediaTypeTest.java @@ -15,7 +15,7 @@ package com.google.api.client.http; import com.google.common.base.Charsets; - +import com.google.common.testing.EqualsTester; import junit.framework.TestCase; /** @@ -184,10 +184,10 @@ public void testEqualsIgnoreParameters_static() { } public void testEquals() { - assertEquals(true, new HttpMediaType("foo/bar").equals(new HttpMediaType("foo/bar"))); - assertEquals(true, new HttpMediaType("foo/bar; a=c").equals(new HttpMediaType("foo/bar; a=c"))); - assertEquals(false, new HttpMediaType("foo/bar; bar=bar").equals(new HttpMediaType("foo/bar"))); - assertEquals(false, new HttpMediaType("foo/bar").equals(null)); - assertEquals(false, new HttpMediaType("foo/bar").equals(new Integer(5))); + new EqualsTester() + .addEqualityGroup(new HttpMediaType("foo/bar"), new HttpMediaType("foo/bar")) + .addEqualityGroup(new HttpMediaType("foo/bar; a=c"), new HttpMediaType("foo/bar; a=c")) + .addEqualityGroup(new HttpMediaType("foo/bar; bar=bar")) + .testEquals(); } } diff --git a/pom.xml b/pom.xml index 7669e449a..894c0f8b4 100644 --- a/pom.xml +++ b/pom.xml @@ -168,6 +168,11 @@ guava-jdk5 ${project.guava.version} + + com.google.guava + guava-testlib-jdk5 + ${project.guava.version} + com.google.code.findbugs jsr305 From 98e6d4865c85da713b64b05a99baaad193ba07c6 Mon Sep 17 00:00:00 2001 From: dorir Date: Mon, 13 Mar 2017 23:01:04 -0700 Subject: [PATCH 13/85] Replace constants (static final CONSTANT_CASE) declaration type which use the general collection interface (e.g. List) with an immutable type (e.g. ImmutableList). For constant field declarations, you should use the immutable type (such as ImmutableList) instead of the general collection interface type (such as List). This communicates to your callers important semantic guarantees (https://cantata.corp.google.com/?ticket=java:com.google.common.collect.ImmutableCollection). For more info, see: go/lsc-immutable-constants Cleanup change automatically generated by javacflume/refactory Refactoring: //third_party/java_src/error_prone/project/core/src/main/java/com/google/errorprone/bugpatterns:MutableConstantField_refactoring Tested: TAP train for global presubmit queue http://test/OCL:149234672:BASE:149234770:1488739899777:b922b37f All failing tests were failing before this change ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=150033774 --- .../java/com/google/api/client/http/HttpRequestTest.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 7774e3b38..53a3d8842 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 @@ -35,7 +35,6 @@ import java.io.IOException; import java.util.Arrays; import java.util.List; -import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; import java.util.concurrent.Future; @@ -52,9 +51,9 @@ */ public class HttpRequestTest extends TestCase { - private static final Set BASIC_METHODS = + private static final ImmutableSet BASIC_METHODS = ImmutableSet.of(HttpMethods.GET, HttpMethods.PUT, HttpMethods.POST, HttpMethods.DELETE); - private static final Set OTHER_METHODS = + private static final ImmutableSet OTHER_METHODS = ImmutableSet.of(HttpMethods.HEAD, HttpMethods.PATCH); public HttpRequestTest(String name) { From 79e973276b27cb4a873097b7025fcebfff1d00a4 Mon Sep 17 00:00:00 2001 From: kgregorczyk Date: Thu, 24 Aug 2017 00:23:38 -0700 Subject: [PATCH 14/85] Adds STATUS_CODE_UNPROCESSABLE_ENTITY 422 http error to HttpStatusCodes ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=166307565 --- .../java/com/google/api/client/http/HttpStatusCodes.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/google-http-client/src/main/java/com/google/api/client/http/HttpStatusCodes.java b/google-http-client/src/main/java/com/google/api/client/http/HttpStatusCodes.java index dc426e8dd..9241eabef 100644 --- a/google-http-client/src/main/java/com/google/api/client/http/HttpStatusCodes.java +++ b/google-http-client/src/main/java/com/google/api/client/http/HttpStatusCodes.java @@ -78,6 +78,12 @@ public class HttpStatusCodes { /** Status code for a request for which one of the conditions it was made under has failed. */ public static final int STATUS_CODE_PRECONDITION_FAILED = 412; + /** + * Status code for a request for which the content-type and the request's syntax were correct but + * server was not able to process entity. + */ + public static final int STATUS_CODE_UNPROCESSABLE_ENTITY = 422; + /** Status code for an internal server error. */ public static final int STATUS_CODE_SERVER_ERROR = 500; From b69f50e2265e897b2830b983e03b37524eb1e290 Mon Sep 17 00:00:00 2001 From: neozwu Date: Wed, 13 Sep 2017 15:56:36 -0700 Subject: [PATCH 15/85] start 1.24 (#369) --- google-http-client-android-test/pom.xml | 6 +- google-http-client-android/pom.xml | 2 +- google-http-client-appengine/pom.xml | 2 +- ...ttp-client-1.24.0-SNAPSHOT.jar.properties} | 0 ...nt-android-1.24.0-SNAPSHOT.jar.properties} | 0 ...lient-gson-1.24.0-SNAPSHOT.jar.properties} | 0 ...nt-jackson-1.24.0-SNAPSHOT.jar.properties} | 0 ...t-jackson2-1.24.0-SNAPSHOT.jar.properties} | 0 ...client-jdo-1.24.0-SNAPSHOT.jar.properties} | 0 ...t-protobuf-1.24.0-SNAPSHOT.jar.properties} | 0 ...client-xml-1.24.0-SNAPSHOT.jar.properties} | 0 ...ogle-http-client-android-dependencies.html | 24 +-- ...le-http-client-appengine-dependencies.html | 34 ++-- .../google-http-client-dependencies.html | 148 +++++++++++++----- .../google-http-client-gson-dependencies.html | 34 ++-- ...ogle-http-client-jackson-dependencies.html | 36 ++--- ...gle-http-client-jackson2-dependencies.html | 34 ++-- .../google-http-client-jdo-dependencies.html | 34 ++-- ...gle-http-client-protobuf-dependencies.html | 24 +-- .../google-http-client-xml-dependencies.html | 24 +-- google-http-client-assembly/pom.xml | 2 +- google-http-client-findbugs/pom.xml | 2 +- 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 +- .../google/api/client/http/HttpRequest.java | 2 +- pom.xml | 2 +- 32 files changed, 246 insertions(+), 180 deletions(-) rename google-http-client-assembly/android-properties/{google-http-client-1.23.0-SNAPSHOT.jar.properties => google-http-client-1.24.0-SNAPSHOT.jar.properties} (100%) rename google-http-client-assembly/android-properties/{google-http-client-android-1.23.0-SNAPSHOT.jar.properties => google-http-client-android-1.24.0-SNAPSHOT.jar.properties} (100%) rename google-http-client-assembly/android-properties/{google-http-client-gson-1.23.0-SNAPSHOT.jar.properties => google-http-client-gson-1.24.0-SNAPSHOT.jar.properties} (100%) rename google-http-client-assembly/android-properties/{google-http-client-jackson-1.23.0-SNAPSHOT.jar.properties => google-http-client-jackson-1.24.0-SNAPSHOT.jar.properties} (100%) rename google-http-client-assembly/android-properties/{google-http-client-jackson2-1.23.0-SNAPSHOT.jar.properties => google-http-client-jackson2-1.24.0-SNAPSHOT.jar.properties} (100%) rename google-http-client-assembly/android-properties/{google-http-client-jdo-1.23.0-SNAPSHOT.jar.properties => google-http-client-jdo-1.24.0-SNAPSHOT.jar.properties} (100%) rename google-http-client-assembly/android-properties/{google-http-client-protobuf-1.23.0-SNAPSHOT.jar.properties => google-http-client-protobuf-1.24.0-SNAPSHOT.jar.properties} (100%) rename google-http-client-assembly/android-properties/{google-http-client-xml-1.23.0-SNAPSHOT.jar.properties => google-http-client-xml-1.24.0-SNAPSHOT.jar.properties} (100%) diff --git a/google-http-client-android-test/pom.xml b/google-http-client-android-test/pom.xml index aef3df344..1bbdbbb5c 100644 --- a/google-http-client-android-test/pom.xml +++ b/google-http-client-android-test/pom.xml @@ -4,7 +4,7 @@ google-http-client google-http-client-android-test Test project for google-http-client-android. - 1.23.0-SNAPSHOT + 1.24.0-SNAPSHOT apk @@ -86,7 +86,7 @@ com.google.http-client google-http-client-android - 1.23.0-SNAPSHOT + 1.24.0-SNAPSHOT android @@ -105,7 +105,7 @@ com.google.http-client google-http-client-test - 1.23.0-SNAPSHOT + 1.24.0-SNAPSHOT junit diff --git a/google-http-client-android/pom.xml b/google-http-client-android/pom.xml index 31bd23564..dbebb18b7 100644 --- a/google-http-client-android/pom.xml +++ b/google-http-client-android/pom.xml @@ -4,7 +4,7 @@ com.google.http-client google-http-client-parent - 1.23.0-SNAPSHOT + 1.24.0-SNAPSHOT ../pom.xml google-http-client-android diff --git a/google-http-client-appengine/pom.xml b/google-http-client-appengine/pom.xml index 17676e3fb..ea09e3cff 100644 --- a/google-http-client-appengine/pom.xml +++ b/google-http-client-appengine/pom.xml @@ -4,7 +4,7 @@ com.google.http-client google-http-client-parent - 1.23.0-SNAPSHOT + 1.24.0-SNAPSHOT ../pom.xml google-http-client-appengine diff --git a/google-http-client-assembly/android-properties/google-http-client-1.23.0-SNAPSHOT.jar.properties b/google-http-client-assembly/android-properties/google-http-client-1.24.0-SNAPSHOT.jar.properties similarity index 100% rename from google-http-client-assembly/android-properties/google-http-client-1.23.0-SNAPSHOT.jar.properties rename to google-http-client-assembly/android-properties/google-http-client-1.24.0-SNAPSHOT.jar.properties diff --git a/google-http-client-assembly/android-properties/google-http-client-android-1.23.0-SNAPSHOT.jar.properties b/google-http-client-assembly/android-properties/google-http-client-android-1.24.0-SNAPSHOT.jar.properties similarity index 100% rename from google-http-client-assembly/android-properties/google-http-client-android-1.23.0-SNAPSHOT.jar.properties rename to google-http-client-assembly/android-properties/google-http-client-android-1.24.0-SNAPSHOT.jar.properties diff --git a/google-http-client-assembly/android-properties/google-http-client-gson-1.23.0-SNAPSHOT.jar.properties b/google-http-client-assembly/android-properties/google-http-client-gson-1.24.0-SNAPSHOT.jar.properties similarity index 100% rename from google-http-client-assembly/android-properties/google-http-client-gson-1.23.0-SNAPSHOT.jar.properties rename to google-http-client-assembly/android-properties/google-http-client-gson-1.24.0-SNAPSHOT.jar.properties diff --git a/google-http-client-assembly/android-properties/google-http-client-jackson-1.23.0-SNAPSHOT.jar.properties b/google-http-client-assembly/android-properties/google-http-client-jackson-1.24.0-SNAPSHOT.jar.properties similarity index 100% rename from google-http-client-assembly/android-properties/google-http-client-jackson-1.23.0-SNAPSHOT.jar.properties rename to google-http-client-assembly/android-properties/google-http-client-jackson-1.24.0-SNAPSHOT.jar.properties diff --git a/google-http-client-assembly/android-properties/google-http-client-jackson2-1.23.0-SNAPSHOT.jar.properties b/google-http-client-assembly/android-properties/google-http-client-jackson2-1.24.0-SNAPSHOT.jar.properties similarity index 100% rename from google-http-client-assembly/android-properties/google-http-client-jackson2-1.23.0-SNAPSHOT.jar.properties rename to google-http-client-assembly/android-properties/google-http-client-jackson2-1.24.0-SNAPSHOT.jar.properties diff --git a/google-http-client-assembly/android-properties/google-http-client-jdo-1.23.0-SNAPSHOT.jar.properties b/google-http-client-assembly/android-properties/google-http-client-jdo-1.24.0-SNAPSHOT.jar.properties similarity index 100% rename from google-http-client-assembly/android-properties/google-http-client-jdo-1.23.0-SNAPSHOT.jar.properties rename to google-http-client-assembly/android-properties/google-http-client-jdo-1.24.0-SNAPSHOT.jar.properties diff --git a/google-http-client-assembly/android-properties/google-http-client-protobuf-1.23.0-SNAPSHOT.jar.properties b/google-http-client-assembly/android-properties/google-http-client-protobuf-1.24.0-SNAPSHOT.jar.properties similarity index 100% rename from google-http-client-assembly/android-properties/google-http-client-protobuf-1.23.0-SNAPSHOT.jar.properties rename to google-http-client-assembly/android-properties/google-http-client-protobuf-1.24.0-SNAPSHOT.jar.properties diff --git a/google-http-client-assembly/android-properties/google-http-client-xml-1.23.0-SNAPSHOT.jar.properties b/google-http-client-assembly/android-properties/google-http-client-xml-1.24.0-SNAPSHOT.jar.properties similarity index 100% rename from google-http-client-assembly/android-properties/google-http-client-xml-1.23.0-SNAPSHOT.jar.properties rename to google-http-client-assembly/android-properties/google-http-client-xml-1.24.0-SNAPSHOT.jar.properties 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 index 0598e6a9c..7e176d519 100644 --- a/google-http-client-assembly/dependencies/google-http-client-android-dependencies.html +++ b/google-http-client-assembly/dependencies/google-http-client-android-dependencies.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -24,8 +24,8 @@
- Last Published: 2016-03-28 -  | Version: 1.23.0-SNAPSHOT + Last Published: 2017-09-13 +  | Version: 1.24.0-SNAPSHOT
@@ -63,7 +63,7 @@

compile

com.google.http-client google-http-client -1.23.0-SNAPSHOT +1.24.0-SNAPSHOT jar The Apache Software License, Version 2.0
@@ -181,7 +181,7 @@

Project Dependency Graph