antony / grails-oauth-scribe

Grails Oauth plugin using the Scribe library
23 stars 40 forks source link

Scribe 1.3.5 causes NPE upon oauthService.getProviderResource #27

Closed bdgarret closed 9 years ago

bdgarret commented 11 years ago

When attempting to upgrade to scribe 1.3.5, we get a NullPointerException when calling e.g. oathService.getYahooResource (linkedin and other providers produce the same result).

Versions: grails-oauth-scribe plugin 2.2.1 scribe 1.3.5 Using grails version 2.2.4 Using groovy version 2.1.6 java version "1.6.0_51" Mac OS X 10.6.8

Line | Method ->> 194 | addPayload in org.scribe.model.Request


| 19 | accessResource in OauthResourceService.groovy | 200 | methodMissing . in OauthService.groovy | 36 | createAuthToken in YahooSpringSecurityOAuthService.groovy

Scribe 1.3.2 does not produce this error.

bdgarret commented 11 years ago

I created a fork here: https://github.com/bdgarret/grails-oauth-scribe with a branch called issue27

I've added a test to OauthResourceServiceSpec that will fail in order to reproduce the issue (without the fix I added).
| Failure: null payload should be gracefully handled to avoid NPE(uk.co.desirableobjects.oauth.scribe.OauthResourceServiceSpec) | java.lang.NullPointerException at org.scribe.model.Request.addPayload(Request.java:194) at uk.co.desirableobjects.oauth.scribe.OauthResourceService.accessResource(OauthResourceService.groovy:25) at uk.co.desirableobjects.oauth.scribe.OauthResourceServiceSpec.null payload should be gracefully handled to avoid NPE(OauthResourceServiceSpec.groovy:64) | Completed 48 spock tests, 1 failed in 9974ms

But with the fix I created in OauthResourceService then the test above succeeds. | Completed 48 spock tests, 0 failed in 9453ms

The two important files are: OauthResourceServiceSpec and OauthResourceService. BuildConfig.groovy has the upgrade to scribe 1.3.5 but it also has a couple other things because I am running a later version of groovy. Feel free to pick and choose what to pull.

antony commented 11 years ago

Hi ben,

Great thanks! I'll get on to this as soon as I am able to.

Cheers, Antony On Oct 19, 2013 12:01 AM, "Benjamin Garrett" notifications@github.com wrote:

I created a fork here: https://github.com/bdgarret/grails-oauth-scribewith a branch called issue27

I've added a test to OauthResourceServiceSpec that will fail in order to reproduce the issue (without the fix I added).

| Failure: null payload should be gracefully handled to avoid NPE(uk.co.desirableobjects.oauth.scribe.OauthResourceServiceSpec) | java.lang.NullPointerException at org.scribe.model.Request.addPayload(Request.java:194) at uk.co.desirableobjects.oauth.scribe.OauthResourceService.accessResource(OauthResourceService.groovy:25) at uk.co.desirableobjects.oauth.scribe.OauthResourceServiceSpec.null payload should be gracefully handled to avoid NPE(OauthResourceServiceSpec.groovy:64) | Completed 48 spock tests, 1 failed in 9974ms

But with the fix I created in OauthResourceService then the test above succeeds. | Completed 48 spock tests, 0 failed in 9453ms

The two important files are: OauthResourceServiceSpec and OauthResourceService. BuildConfig.groovy has the upgrade to scribe 1.3.5 but it also has a couple other things because I am running a later version of groovy. Feel free to pick and choose what to pull.

— Reply to this email directly or view it on GitHubhttps://github.com/aiten/grails-oauth-scribe/issues/27#issuecomment-26636182 .