jacek-lewandowski commented on code in PR #2064:
URL: https://github.com/apache/cassandra/pull/2064#discussion_r1071806982
##########
src/java/org/apache/cassandra/utils/Throwables.java:
##########
@@ -189,13 +189,19 @@ public static Throwable perform(Throwable accumulate,
String filePath, FileOpTyp
}
public static void closeAndAddSuppressed(@Nonnull Throwable t,
AutoCloseable... closeables)
+ {
+ closeAndAddSuppressed(t, Arrays.asList(closeables));
+ }
+
+ public static void closeAndAddSuppressed(@Nonnull Throwable t,
Iterable<AutoCloseable> closeables)
{
Preconditions.checkNotNull(t);
for (AutoCloseable closeable : closeables)
{
try
{
- closeable.close();
+ if (closeable != null)
Review Comment:
This is a new method. `FileUtils.close` just throws while here we are adding
suppressed exceptions. Actually this works very similar to try..catch with
resources, where only non-null resources are closed and no NPE is thrown. If
you think I should move it to `FileUtils` I'm ok with that.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]