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

URLHandle: fall back to resetting stream if resetting to a mark fails #82

Merged
merged 1 commit into from
Oct 6, 2023

Conversation

melissalinkert
Copy link
Member

See ome/bioformats#3918

I believe this will help with the first problem in that issue:

Caused by: java.io.IOException: Resetting to invalid mark
	at java.io.BufferedInputStream.reset(BufferedInputStream.java:448)
	at java.io.FilterInputStream.reset(FilterInputStream.java:226)
	at loci.common.URLHandle.seek(URLHandle.java:83)
	at loci.common.RandomAccessInputStream.seek(RandomAccessInputStream.java:203)

as this will force the whole stream to be reinitialized if resetting to the marked position fails when seeking backwards. I don't have a good way to test this though, as I wasn't actually able to reproduce the original exception.

Copy link
Member

@dgault dgault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic here looks sensible and makes sense as a fallback. I have tried again to find a way to replicate the original exception seen in ome/bioformats#3918 but have been unable to do so. At very least this PR is an improvement on the existing behaviour.

@dgault dgault merged commit 4776bca into ome:master Oct 6, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants