Skip to content

ImageReader: do not check file handle for in-memory sources#4414

Closed
sbesson wants to merge 1 commit into
ome:developfrom
sbesson:imagereader_inmemory
Closed

ImageReader: do not check file handle for in-memory sources#4414
sbesson wants to merge 1 commit into
ome:developfrom
sbesson:imagereader_inmemory

Conversation

@sbesson
Copy link
Copy Markdown
Member

@sbesson sbesson commented Feb 17, 2026

Fixes #4413

If a file has been mapped into memory via the Location.mapFile() API, skip the location checks entirely instead of printing an ERROR level warning

If a file has been mapped into memory via the `Location.mapFile()`
API, skip the location checks entirely instead of printing an
ERROR level warning
Copy link
Copy Markdown
Member

@melissalinkert melissalinkert left a comment

Choose a reason for hiding this comment

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

I think I'm OK with this change, but in the case of non-fake files with non-zero length (as in #4413), I wouldn't have expected new Location(id).length() to return 0.

Looking at the Location constructor:

https://github.com/ome/ome-common-java/blob/master/src/main/java/loci/common/Location.java#L234

and:

https://github.com/ome/ome-common-java/blob/master/src/main/java/loci/common/Location.java#L370

that's accounting for String -> String mapping, but not String -> IRandomAccess. That's almost certainly incorrect, and probably worth fixing as well.

@sbesson
Copy link
Copy Markdown
Member Author

sbesson commented Feb 26, 2026

Proposing to close this fix in favour of ome/ome-common-java#113 which allows the Location.length() API to work on in-memory files.

@sbesson sbesson closed this Feb 26, 2026
@sbesson sbesson deleted the imagereader_inmemory branch March 17, 2026 09:17
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.

ImageReader with mapFile logs an unexpected error

2 participants