From d97d6c66b8f209de3fe686bd6c9145ef21570db6 Mon Sep 17 00:00:00 2001 From: Tom Morris Date: Tue, 23 Jun 2020 15:55:46 -0400 Subject: [PATCH] Update Google API dependencies for GData extension (#2754) * Update Google API dependencies for Sheets & Drive Remove unnecessary direct dependencies which are transitive dependencies of those. * Fix use of deprecated class --- extensions/gdata/pom.xml | 15 ++------------- .../extension/gdata/GoogleAPIExtension.java | 10 +++++----- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/extensions/gdata/pom.xml b/extensions/gdata/pom.xml index cc797229b..7f85ddb95 100644 --- a/extensions/gdata/pom.xml +++ b/extensions/gdata/pom.xml @@ -126,25 +126,15 @@ httpclient 4.5.12 - - com.google.http-client - google-http-client-jackson - 1.23.0 - - - com.google.oauth-client - google-oauth-client-jetty - 1.23.0 - com.google.apis google-api-services-drive - v3-rev101-1.23.0 + v3-rev20200413-1.30.9 com.google.apis google-api-services-sheets - v4-rev502-1.23.0 + v4-rev20200508-1.30.9 com.fasterxml.jackson.core @@ -152,7 +142,6 @@ ${jackson.version} provided - org.testng testng diff --git a/extensions/gdata/src/com/google/refine/extension/gdata/GoogleAPIExtension.java b/extensions/gdata/src/com/google/refine/extension/gdata/GoogleAPIExtension.java index ec6d6d135..23299fb31 100644 --- a/extensions/gdata/src/com/google/refine/extension/gdata/GoogleAPIExtension.java +++ b/extensions/gdata/src/com/google/refine/extension/gdata/GoogleAPIExtension.java @@ -13,14 +13,14 @@ import javax.servlet.http.HttpServletRequest; import com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl; import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl; import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest; -import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; +import com.google.api.client.auth.oauth2.Credential; import com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.client.json.JsonFactory; -import com.google.api.client.json.jackson.JacksonFactory; +import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.services.drive.Drive; import com.google.api.services.drive.DriveScopes; import com.google.api.services.sheets.v4.Sheets; @@ -110,8 +110,8 @@ abstract public class GoogleAPIExtension { } static public Drive getDriveService(String token) { - GoogleCredential credential = new GoogleCredential().setAccessToken(token); - + Credential credential = new Credential.Builder(null).build().setAccessToken(token); + return new Drive.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential).setHttpRequestInitializer(new HttpRequestInitializer() { @Override public void initialize(HttpRequest httpRequest) throws IOException { @@ -156,7 +156,7 @@ abstract public class GoogleAPIExtension { * @throws IOException */ public static Sheets getSheetsService(String token) throws IOException { - GoogleCredential credential = new GoogleCredential().setAccessToken(token); + Credential credential = new Credential.Builder(null).build().setAccessToken(token); int connectTimeout = getConnectTimeout(); int readTimeout = getReadTimeout();