juneau-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [juneau] lcc opened a new pull request #55: Java api fixes
Date Wed, 11 Nov 2020 23:41:19 GMT

lcc opened a new pull request #55:
URL: https://github.com/apache/juneau/pull/55


   This patch fixes the following misuses of the java api:
   
   1. Meaningless Close:  In several classes, close(), specified in Closeable interface, has
no effect and other methods in those classes can be called after close() without IOException.
   
   2. Flushes OutputStream before using the underlying ByteArrayOutputStream: when an OutputStream
(or its subclass) instance is built on top of an underlying ByteArrayOutputStream instance,
it should be flushed or closed before the underlying instance's toByteArray() is invoked.
Failing to fulfill this requirement may cause toByteArray() to return incomplete contents.
   
   3. Unsynchronized addAll:  The behavior of Collection.addAll() is undefined if the specified
source collection is modified while the operation is in progress.
   
   Fixes regarding (1) only have a consequence in coding-style/clarity, but IMO the impact
on clarity is quite big as there are some implementations of closeQuietly methods that have
no effect (since the close method, for these classes, never throw IOException).
   
   (2) and (3) may lead to incoherent behaviour.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message