Opened 9 years ago

Closed 9 years ago

#369 closed defect (duplicate)

Potential resource leaks in net.i2p.util.FileUtil

Reported by: John Doo Owned by: John Doo
Priority: minor Milestone:
Component: unspecified Version: 0.8
Keywords: Cc:
Parent Tickets: Sensitive: no

Description

I've noticed a potential resource leak in net.i2p.util.FileUtil?.copy(String source, String dest, boolean overwriteExisting, boolean quiet).

The input- and output-streams are closed in the try-block. This is a fault, as the streams never get closed if any one of the previous statements causes an exception. The correct way to do this is to close the streams in a finally-block.

readFile(String path, String root, OutputStream? out) contains potentially the same fault for the output stream, but maybe it's by intention to close the output stream only if the whole file was read successfully.

Yours sincerely
John Doo

Subtickets

Change History (2)

comment:1 Changed 9 years ago by John Doo

Owner: set to John Doo
Status: newassigned

comment:2 Changed 9 years ago by John Doo

Resolution: duplicate
Status: assignedclosed
Note: See TracTickets for help on using tickets.