Custom Query (1911 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (49 - 51 of 1911)

Ticket Resolution Summary Owner Reporter
#369 duplicate Potential resource leaks in net.i2p.util.FileUtil John Doo John Doo
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

#370 fixed Potential resource leaks in net.i2p.util.FileUtil zzz John Doo
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

#388 fixed I2PThread and I2PAppThread not thread safe zzz John Doo
Description

I2PThread and I2PAppThread both use a HashSet? for _listeners and _threadListeners respectively without further synchronisation. This can cause a ConcurrentModificationException? if a listener is added or removed while fireOOM iterates over this set. Solution: java.util.concurrent.CopyOnWriteArraySet?

In I2PThread obtaining a log-instance in

private void log(int level, String msg, Throwable t){

if (log == null) _log = new Log(I2PThread.class);…}

is not thread safe as well. The check-then-act needs to be synchronized.

Another solution is the "Lazy initialization holder class idiom.":

private static class LogHolder? {

public static Log log = new Log(I2PThread.class);

}

and

private void log(int level, String msg, Throwable t){

if (log == null) _log = new Log(I2PThread.class);…}

Note: See TracQuery for help on using queries.