-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Browser handler #182
Browser handler #182
Conversation
Default behavior should not change with a newly introduced feature.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
I signed it! |
CLAs look good, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR!
System.out.println(" " + url); | ||
try { | ||
browser.browse(url); | ||
} catch (Exception e) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
* @param url url to browse | ||
* @throws Exception | ||
*/ | ||
public void browse(String url) throws Exception; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
browse(authorizationUrl.build()); | ||
String url = authorizationUrl.build(); | ||
Preconditions.checkNotNull(url); | ||
System.out.println("Please open the following address in your browser:"); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
- Browser.browse throws IOException instead of Exception - Do not swallow exceptions but let caller deal with it - Remove superfluous println statements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. LGTM.
We're currently blocked on new features so we can't merge this yet.
As outlined in #175 it is desirable in some cases to not use the
java.awt.Desktop
to browse theauthorizationUrl
inAuthorizationCodeInstalledApp
, e.g. when running aJavaFX
UI. For that purpose, I created aBrowser
interface with a singlebrowse(String)
method that is passed as an argument toAuthorizationCodeInstalledApp
. In order not to introduce any breaking changes, there is also aDefaultBrowser
that simply delegates toAuthorizationCodeInstalledApp.browse
.Fixes #175
Note:
mvn findbugs:check
fails but it also fails on thedev
branch.