Skip to content

FileLocation unusable after close() — stream/channel not nulled #86

Description

@elharo

Bug #4

FileLocation.java lines 55-71, 115-122

close() closes the FileChannel and FileInputStream but does not set the channel and stream fields to null. After close(), calling read() calls open() which checks if (stream == null) — but since stream is still non-null (just closed), the re-initialization is skipped and channel.read(buffer) is called on a closed channel, throwing ClosedChannelException.

Fix: set channel = null and stream = null after closing them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions