diff options
-rw-r--r-- | src/com/google/gct/login/CredentialedUser.java | 2 | ||||
-rw-r--r-- | src/com/google/gct/login/GoogleLoginUtils.java | 21 |
2 files changed, 9 insertions, 14 deletions
diff --git a/src/com/google/gct/login/CredentialedUser.java b/src/com/google/gct/login/CredentialedUser.java index 5feb2da..037fd55 100644 --- a/src/com/google/gct/login/CredentialedUser.java +++ b/src/com/google/gct/login/CredentialedUser.java @@ -114,7 +114,7 @@ public class CredentialedUser { updateUserCallback.onLoginCompleted(); } }; - GoogleLoginUtils.getUserPicture(userInfo, pictureCallback); + GoogleLoginUtils.provideUserPicture(userInfo, pictureCallback); } } } diff --git a/src/com/google/gct/login/GoogleLoginUtils.java b/src/com/google/gct/login/GoogleLoginUtils.java index 788b08f..27e1f5e 100644 --- a/src/com/google/gct/login/GoogleLoginUtils.java +++ b/src/com/google/gct/login/GoogleLoginUtils.java @@ -21,18 +21,13 @@ import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.client.json.jackson.JacksonFactory; import com.google.api.services.oauth2.Oauth2; import com.google.api.services.oauth2.model.Userinfoplus; - import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.diagnostic.Logger; - import com.intellij.openapi.ui.Messages; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.awt.Image; -import java.awt.Toolkit; +import java.awt.*; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; @@ -45,13 +40,13 @@ public class GoogleLoginUtils { public static final int DEFAULT_PICTURE_SIZE = 96; /** - * Gets the user's picture from <code>userInfo</code>. + * Gets the profile picture that corresponds to the {@code userInfo} and sets it on the provided + * {@code pictureCallback}. * - * @param userInfo the class to be parsed. - * @param pictureCallback - * @return the user's picture from <code>userInfo</code> + * @param userInfo the class to be parsed + * @param pictureCallback the user image will be set on this callback */ - public static void getUserPicture(Userinfoplus userInfo, final IUserPropertyCallback pictureCallback) { + public static void provideUserPicture(Userinfoplus userInfo, final IUserPropertyCallback pictureCallback) { // set the size of the image before it is served String urlString = userInfo.getPicture() + "?sz=" + DEFAULT_PICTURE_SIZE; URL url = null; @@ -59,8 +54,8 @@ public class GoogleLoginUtils { url = new URL(urlString); } catch (MalformedURLException e) { - LOG.error(e); - // Should users be able to see picture url? + LOG.warn(String.format("The picture URL: %s, is not a valid URL string.", urlString), e); + return; } final URL newUrl = url; |