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

StringIndexOutOfBoundsException: PhotonUtils.getPhotonImageUrl #18626

Closed
sentry-io bot opened this issue Jun 19, 2023 · 14 comments · Fixed by wordpress-mobile/WordPress-Utils-Android#143 or #20459
Closed
Assignees
Labels
Gutenberg Editing and display of Gutenberg blocks. Media [Pri] Medium [Type] Crash
Milestone

Comments

@sentry-io
Copy link

sentry-io bot commented Jun 19, 2023

Sentry Issue: JETPACK-ANDROID-1B8

StringIndexOutOfBoundsException: String index out of range: -39
    at java.lang.String.substring(String.java:2064)
    at org.wordpress.android.util.PhotonUtils.getPhotonImageUrl(PhotonUtils.java:141)
    at org.wordpress.android.util.PhotonUtils.getPhotonImageUrl(PhotonUtils.java:42)
    at org.wordpress.android.ui.media.MediaPreviewFragment.loadImage(MediaPreviewFragment.java:261)
    at org.wordpress.android.ui.media.MediaPreviewFragment.onResume(MediaPreviewFragment.java:213)
...
(24 additional frame(s) were not displayed)

RuntimeException: Unable to resume activity {com.jetpack.android/org.wordpress.android.ui.media.MediaPreviewActivity}: java.lang.StringIndexOutOfBoundsException: String index out of range: -39
    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4240)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4272)
    at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
...
(7 additional frame(s) were not displayed)
@ovitrif ovitrif changed the title RuntimeException: Unable to resume activity MediaPreviewActivity… RuntimeException: Unable to resume [activity] MediaPreviewActivity… Jun 19, 2023
@SiobhyB
Copy link
Contributor

SiobhyB commented Jun 28, 2023

The last time this crash occurred was June 20th, eight days ago. It had occurred a few times a day, or at least every other day, prior to that. As such, I'm wondering if this crash may have been resolved.

I'm setting this as a low priority for now and have set myself a reminder to check in after two weeks to see if there have been any more occurrences.

@SiobhyB
Copy link
Contributor

SiobhyB commented Jun 29, 2023

Updating the priority from low to medium after discovering that this is impacting more users than first thought. I've merged together all Sentry logs detailing this crash.

I've spent some time attempting to replicate, but haven't been able to. It appears the issue happens when MediaPreviewActivity is triggered either within the editor, or immediately after the editor's closed. It only happens when navigating back to MediaPreviewActivity after it had previously been destroyed.

The last change I see to MediaPreviewActivity was in #18019. @irfano, do you think something related to updates with back navigation may have caused this? 🤔

@irfano
Copy link
Member

irfano commented Jul 3, 2023

The last change I see to MediaPreviewActivity was in #18019. @irfano, do you think something related to updates with back navigation may have caused this? 🤔

This doesn't look related to #18019 because the crash is older than the PR. I am sharing the issues on Sentry, and you can see that the same problem was initially detected 43 months ago.

image

It looks related to bad image links. I will attempt to reproduce it and share the results here.

@irfano
Copy link
Member

irfano commented Jul 4, 2023

I couldn't succeed in reproducing the issue but I will share my findings. PhotonUtils.getPhotonImageUrl() function crashes because something seems wrong on mediaUri.

Copy link
Author

sentry-io bot commented Mar 13, 2024

Sentry Issue: JETPACK-ANDROID-H0H

Copy link
Author

sentry-io bot commented Mar 13, 2024

Sentry Issue: JETPACK-ANDROID-G3Q

Copy link
Author

sentry-io bot commented Mar 13, 2024

Sentry Issue: WORDPRESS-ANDROID-7AY

Copy link
Author

sentry-io bot commented Mar 13, 2024

Sentry Issue: WORDPRESS-ANDROID-1VWV

@antonis
Copy link

antonis commented Mar 13, 2024

Added a few more occurrences of the crash all rooting to org.wordpress.android.util.PhotonUtils.getPhotonImageUrl(PhotonUtils.java:141)

Copy link
Author

sentry-io bot commented Mar 15, 2024

Sentry Issue: JETPACK-ANDROID-1QW

Copy link
Author

sentry-io bot commented Mar 15, 2024

Sentry Issue: JETPACK-ANDROID-GX7

Copy link
Author

sentry-io bot commented Mar 15, 2024

Sentry Issue: JETPACK-ANDROID-HY5

Copy link
Author

sentry-io bot commented Mar 15, 2024

Sentry Issue: JETPACK-ANDROID-H7G

@antonis antonis changed the title RuntimeException: Unable to resume [activity] MediaPreviewActivity… StringIndexOutOfBoundsException: StringIndexOutOfBoundsException Mar 15, 2024
@antonis antonis changed the title StringIndexOutOfBoundsException: StringIndexOutOfBoundsException StringIndexOutOfBoundsException: PhotonUtils.getPhotonImageUrl Mar 15, 2024
Copy link
Author

sentry-io bot commented Mar 15, 2024

Sentry Issue: JETPACK-ANDROID-H7F

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