Skip to content
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

A NullPointerException when calling android.test.canceled #137

Closed
klisiewicz opened this issue Dec 27, 2016 · 4 comments
Closed

A NullPointerException when calling android.test.canceled #137

klisiewicz opened this issue Dec 27, 2016 · 4 comments

Comments

@klisiewicz
Copy link

Hi,
I have encountered an error when testing a Google Play static response product

android.test.canceled

Basically in the V3GoogleInAppBillingService.GdxPayAsyncOperationResultListener the result code is = -1 which is considered as a valid response, but later in PurchaseResponseActivityResultConverter.convertToTransaction the operation String purchaseDataString = responseData.getStringExtra("INAPP_PURCHASE_DATA"); results in a null string.

This is the full stack trace:
Caused by: java.lang.NullPointerException at org.json.JSONTokener.nextCleanInternal(JSONTokener.java:116) at org.json.JSONTokener.nextValue(JSONTokener.java:94) at org.json.JSONObject.<init>(JSONObject.java:155) at org.json.JSONObject.<init>(JSONObject.java:172) at com.badlogic.gdx.pay.android.googleplay.billing.converter.InAppPurchaseDataToTransactionConverter.convertJSONPurchaseToTransaction(InAppPurchaseDataToTransactionConverter.java:27) at com.badlogic.gdx.pay.android.googleplay.billing.converter.PurchaseResponseActivityResultConverter.convertToTransaction(PurchaseResponseActivityResultConverter.java:27) at com.badlogic.gdx.pay.android.googleplay.billing.V3GoogleInAppBillingService.convertPurchaseResponseDataToTransaction(V3GoogleInAppBillingService.java:255) at com.badlogic.gdx.pay.android.googleplay.billing.V3GoogleInAppBillingService.access$300(V3GoogleInAppBillingService.java:39) at com.badlogic.gdx.pay.android.googleplay.billing.V3GoogleInAppBillingService$2.handleResultOk(V3GoogleInAppBillingService.java:240) at com.badlogic.gdx.pay.android.googleplay.billing.V3GoogleInAppBillingService$2.onEvent(V3GoogleInAppBillingService.java:225) at com.badlogic.gdx.pay.android.googleplay.billing.V3GoogleInAppBillingService.onGdxPayActivityEvent(V3GoogleInAppBillingService.java:393) at com.badlogic.gdx.pay.android.googleplay.billing.V3GoogleInAppBillingService.access$800(V3GoogleInAppBillingService.java:39) at com.badlogic.gdx.pay.android.googleplay.billing.V3GoogleInAppBillingService$V3GoogleInAppBillingServiceAndroidEventListener.onActivityResult(V3GoogleInAppBillingService.java:403) at com.badlogic.gdx.backends.android.AndroidApplication.onActivityResult(AndroidApplication.java:472)

Regards

@keesvandieren
Copy link
Member

Can you create a PR for this? I can review it and commit it.

Thanks in advance!

@piotr-j
Copy link
Contributor

piotr-j commented Mar 12, 2018

Ive been investigating this and refunded issue. Best i can come up with is that that these things dont quite work as real purchases in these cases. This in addition to #163 could probably be solved by throwing JSONException when in app data is null. What do you think?

@MrStahlfelge
Copy link
Member

As @keesvandieren said, we are willing to review PRs on this.

@MrStahlfelge
Copy link
Member

Fixed with PR #188 and published with the latest 0.11.4-SNAPSHOT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants