Skip to content

Commit c7846d4

Browse files
author
Daniel Wang
committed
Fix JDK7 Dependency in DefaultCredentialProvider.
https://codereview.appspot.com/118790043/
1 parent fba9021 commit c7846d4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/DefaultCredentialProvider.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.io.IOException;
3030
import java.io.InputStream;
3131
import java.lang.reflect.Constructor;
32+
import java.lang.reflect.InvocationTargetException;
3233
import java.security.AccessControlException;
3334
import java.util.Locale;
3435

@@ -218,8 +219,12 @@ private final GoogleCredential tryGetAppEngineCredential(
218219
Constructor<?> constructor = credentialClass
219220
.getConstructor(HttpTransport.class, JsonFactory.class);
220221
return (GoogleCredential) constructor.newInstance(transport, jsonFactory);
221-
} catch (ReflectiveOperationException expected) {
222-
// Expected when not running on App Engine
222+
// Reflection expected to fail when not on App Engine
223+
} catch (ClassNotFoundException expected) {
224+
} catch (NoSuchMethodException expected) {
225+
} catch (InstantiationException expected) {
226+
} catch (IllegalAccessException expected) {
227+
} catch (InvocationTargetException expected) {
223228
}
224229
return null;
225230
}

0 commit comments

Comments
 (0)