summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Flynn <paflynn@google.com>2014-10-22 17:11:44 -0400
committerPatrick Flynn <paflynn@google.com>2014-10-22 17:11:44 -0400
commit394bae8e8748f9b2820f5a54c4b8d7407ac59409 (patch)
treeb4a4bc65855f66ce7a932077bca96506bde2d874
parent2176c470cbdf8ce0c95b5d6b5612ca42a33a4593 (diff)
downloadlogin-394bae8e8748f9b2820f5a54c4b8d7407ac59409.tar.gz
don't log errors when they could be caused by the user.
Change-Id: I267e9f9a5bb51a5bac4b423da9ccec90c5bd4fbb
-rw-r--r--src/com/google/gct/login/CredentialedUser.java2
-rw-r--r--src/com/google/gct/login/GoogleLoginUtils.java21
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;