https://codereview.appspot.com/8865045/diff/6001/google-oauth-client/src/main...
File
google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.java
(right):
https://codereview.appspot.com/8865045/diff/6001/google-oauth-client/src/main...
google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.java:96:
private String scopes;
Unfortunately storing it as a String is very inconvenient. I think it is better
to store it as a List to match what we've done for refreshListeners. It would
mean having to break a backwards-incompatible change to getScopes() to instead
return List<String> and add a new setScopes(List<String>) and deprecate
setScopes(Iterable<String>).
https://codereview.appspot.com/8865045/diff/6001/google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.java File google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.java (right): https://codereview.appspot.com/8865045/diff/6001/google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.java#newcode697 google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.java:697: public final String getScopes() { since we are making ...
https://codereview.appspot.com/8865045/diff/6001/google-oauth-client/src/main...
File
google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.java
(right):
https://codereview.appspot.com/8865045/diff/6001/google-oauth-client/src/main...
google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.java:697:
public final String getScopes() {
since we are making a backwards incompatible change to getScopes(), we should
add a new method like getScopesAsString() method that is implemented roughly
like this:
return scopes == null ? null : Joiner.on(' ').join(scopes);
That way existing users of getScopes() can simply use getScopesAsString()
instead.
On 2013/04/24 15:10:44, yanivi wrote:
>
https://codereview.appspot.com/8865045/diff/6001/google-oauth-client/src/main...
> File
>
google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.java
> (right):
>
>
https://codereview.appspot.com/8865045/diff/6001/google-oauth-client/src/main...
>
google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.java:697:
> public final String getScopes() {
> since we are making a backwards incompatible change to getScopes(), we should
> add a new method like getScopesAsString() method that is implemented roughly
> like this:
>
> return scopes == null ? null : Joiner.on(' ').join(scopes);
>
> That way existing users of getScopes() can simply use getScopesAsString()
> instead.
Just realized I'm being silly: rather than List we should use Collection. That
seems like a good compromise between being general purpose and enabling
functionality like size(), add(), remove(), contains(), clear(), etc.
https://codereview.appspot.com/8865045/diff/6001/google-oauth-client/src/main...
File
google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.java
(right):
https://codereview.appspot.com/8865045/diff/6001/google-oauth-client/src/main...
google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.java:96:
private String scopes;
On 2013/04/24 15:05:39, yanivi wrote:
> Unfortunately storing it as a String is very inconvenient. I think it is
better
> to store it as a List to match what we've done for refreshListeners. It would
> mean having to break a backwards-incompatible change to getScopes() to instead
> return List<String> and add a new setScopes(List<String>) and deprecate
> setScopes(Iterable<String>).
Done.
https://codereview.appspot.com/8865045/diff/6001/google-oauth-client/src/main...
google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.java:697:
public final String getScopes() {
Done. (but not in the builder, only in AuthorizationCodeFlow)
On 2013/04/24 15:10:44, yanivi wrote:
> since we are making a backwards incompatible change to getScopes(), we should
> add a new method like getScopesAsString() method that is implemented roughly
> like this:
>
> return scopes == null ? null : Joiner.on(' ').join(scopes);
>
> That way existing users of getScopes() can simply use getScopesAsString()
> instead.
https://codereview.appspot.com/8865045/diff/78001/google-oauth-client/src/mai...
File
google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.java
(right):
https://codereview.appspot.com/8865045/diff/78001/google-oauth-client/src/mai...
google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.java:683:
// this.scopes = (scopes == null) ? Lists.newArrayList() :
Lists.newArrayList(scopes);
On 2013/05/01 21:59:25, yanivi wrote:
> here's the fix: Lists.<String>newArrayList()
>
> please change it to that
Done.
https://codereview.appspot.com/8865045/diff/78001/google-oauth-client/src/mai...
File
google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/Credential.java
(right):
https://codereview.appspot.com/8865045/diff/78001/google-oauth-client/src/mai...
google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/Credential.java:819:
public Builder setRefreshListeners(List<CredentialRefreshListener>
refreshListeners) {
On 2013/05/01 21:59:25, yanivi wrote:
> Sorry to do this to you, but I realize now your backwards-incompatible change
> from List to Collection was actually a better idea. The problem is that if
you
> have code like this:
>
> setRefreshListeners(Arrays.asList(......));
>
> it will be marked as deprecated, but actually it's fine. We're better off
> making a backwards-incompatible change, and it's at least a source
incompatible
> change, even if it is a binary-incompatible change.
Done.
https://codereview.appspot.com/8865045/diff/78001/google-oauth-client/src/tes...
File
google-oauth-client/src/test/java/com/google/api/client/auth/oauth2/AuthorizationCodeFlowTest.java
(right):
https://codereview.appspot.com/8865045/diff/78001/google-oauth-client/src/tes...
google-oauth-client/src/test/java/com/google/api/client/auth/oauth2/AuthorizationCodeFlowTest.java:118:
if (scopes != null) {
On 2013/05/01 21:59:25, yanivi wrote:
> instead change the caller to pass in something like Collections.emptySet()
Done.
Issue 8865045: oauth issue 73: call to setScopes(String...) with null result in NullPointerException (OAUTH)
(Closed)
Created 11 years ago by peleyal
Modified 11 years ago
Reviewers: yanivi
Base URL: https://code.google.com/p/google-oauth-java-client/
Comments: 36