StackOverflowError in AddCardActivity.onError
See original GitHub issueGeneral information
- SDK/Library version:
com.braintreepayments.api:drop-in:4.5.0
- Environment: Sandbox
- Android Version and Device: Robolectric
Issue description
We’ve created an espresso test, which runs on robolectric, and launches AddCardActivity
. It checks that the “save card” checkbox label and “add card” button label have the text we expect (we have redefined the values of these string resources and want this test to break in case the sdk ever changes these string ids).
On our CI, this test passes but then later tests fail with a StackOverflowError
. I’m not sure yet why. I’ll update here if I find more info.
In the meantime, here’s the recursive loop repeated a couple of times. Hopefully this is sufficient to identify a potential recursive issue in the drop in ui code.
at com.braintreepayments.api.dropin.AddCardActivity.onError(AddCardActivity.java:371)
at com.braintreepayments.api.BraintreeFragment$11.run(BraintreeFragment.java:756)
at com.braintreepayments.api.BraintreeFragment.postOrQueueCallback(BraintreeFragment.java:768)
at com.braintreepayments.api.BraintreeFragment.postCallback(BraintreeFragment.java:748)
at com.braintreepayments.api.BraintreeFragment.fetchConfiguration(BraintreeFragment.java:793)
at com.braintreepayments.api.BraintreeFragment.waitForConfiguration(BraintreeFragment.java:835)
at com.braintreepayments.api.BraintreeFragment.sendAnalyticsEvent(BraintreeFragment.java:590)
at com.braintreepayments.api.dropin.AddCardActivity.onError(AddCardActivity.java:371)
at com.braintreepayments.api.BraintreeFragment$11.run(BraintreeFragment.java:756)
at com.braintreepayments.api.BraintreeFragment.postOrQueueCallback(BraintreeFragment.java:768)
at com.braintreepayments.api.BraintreeFragment.postCallback(BraintreeFragment.java:748)
at com.braintreepayments.api.BraintreeFragment.fetchConfiguration(BraintreeFragment.java:793)
at com.braintreepayments.api.BraintreeFragment.waitForConfiguration(BraintreeFragment.java:835)
at com.braintreepayments.api.BraintreeFragment.sendAnalyticsEvent(BraintreeFragment.java:590)
at com.braintreepayments.api.dropin.AddCardActivity.onError(AddCardActivity.java:371)
at com.braintreepayments.api.BraintreeFragment$11.run(BraintreeFragment.java:756)
at com.braintreepayments.api.BraintreeFragment.postOrQueueCallback(BraintreeFragment.java:768)
at com.braintreepayments.api.BraintreeFragment.postCallback(BraintreeFragment.java:748)
at com.braintreepayments.api.BraintreeFragment.fetchConfiguration(BraintreeFragment.java:793)
at com.braintreepayments.api.BraintreeFragment.waitForConfiguration(BraintreeFragment.java:835)
Here’s what our test does:
@RunWith(AndroidJUnit4::class)
class DropInUiCustomizationTest {
@get:Rule
var activityRule = ActivityTestRule<AddCardActivity>(AddCardActivity::class.java, false, false)
/**
* Verify that our customized strings are used in the drop-in ui
*/
@Test
fun testDropInUiCustomization() {
val token = "eyJ2ZXJzaW9uIjoy ... snip ... GVjb21FVVIifQ=="
val dropInRequest = DropInRequest()
.clientToken(token)
.vaultCard(false)
.allowVaultCardOverride(true)
.vaultManager(true)
.disablePayPal()
val intent = Intent(ApplicationProvider.getApplicationContext(), AddCardActivity::class.java)
.putExtra(DropInRequest.EXTRA_CHECKOUT_REQUEST, dropInRequest)
val activity = activityRule.launchActivity(intent)
getInstrumentation().runOnMainSync {
activity.findViewById<ViewGroup>(R.id.bt_edit_card_view).let { editCardView ->
val checkbox = editCardView.findViewById<CheckBox>(R.id.bt_card_form_save_card_checkbox)
assertEquals(activity.getString(R.string.bt_save_card_checkbox_name), checkbox.text.toString())
val button = editCardView.findViewById<ViewGroup>(R.id.bt_animated_button_view).findViewById<Button>(R.id.bt_button)
assertEquals(activity.getString(R.string.bt_add_card).toLowerCase(Locale.US),
button.text.toString().toLowerCase(Locale.US))
}
}
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How to Fix java.lang.StackOverflowError in Java - Rollbar
StackOverflowError indicates that the application stack is exhausted and is usually caused by deep or infinite recursion. What Causes java.lang.
Read more >StackOverflowError - Android Developers
Constructs a StackOverflowError with no detail message. StackOverflowError(String s). Constructs a StackOverflowError with the specified detail message.
Read more >The StackOverflowError in Java - Baeldung
Learn how one of Java's most common errors - StackOverflowError - occurs, and how to resolve it.
Read more >How can I handle StackOverflowError in Java? - Stack Overflow
Please post the code that is causing the stack overflow. Avoiding stack overflows are nearly always better then trying to handle the exception....
Read more >StackOverflowError in Java with examples - GeeksforGeeks
StackOverflowError is an error which Java doesn't allow to catch, for instance, stack running out of space, as it's one of the most...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@calvarez-ov that’s understandable. Client tokens are valid for 24 hours. I’ll close this issue then since the authentication issue is resolved.
In regards to localization, you can open a separate issue with the suggested translations, and we can forward it to our dedicated localization team.
Opened #175 for the translation issue.