Skip to content

Commit

Permalink
Migrate from soon-to-be-deprecated propagateIfPossible to equivalen…
Browse files Browse the repository at this point in the history
…t `throwIfInstanceOf` and `throwIfUnchecked` calls.

PiperOrigin-RevId: 613894984
  • Loading branch information
cpovirk authored and Jimfs Team committed Mar 8, 2024
1 parent 068cd22 commit b962b48
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
package com.google.common.jimfs;

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.throwIfInstanceOf;
import static com.google.common.base.Throwables.throwIfUnchecked;

import com.google.common.base.Throwables;
import com.google.common.collect.Sets;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.Closeable;
Expand Down Expand Up @@ -133,7 +134,10 @@ public void close() throws IOException {
// In either case, we just need to repeat the loop until there are no more register calls
// in progress (no new calls can start and no resources left to close.
} while (registering.get() > 0 || !resources.isEmpty());
Throwables.propagateIfPossible(thrown, IOException.class);
if (thrown != null) {
throwIfInstanceOf(thrown, IOException.class);
throwIfUnchecked(thrown);
}
}
}
}

0 comments on commit b962b48

Please sign in to comment.