Skip to content

Commit

Permalink
dcache-xroot: check that descriptor is not null before calling close …
Browse files Browse the repository at this point in the history
…-- fix

73e683a
https://rb.dcache.org/r/14180/

still risks an NPE.  This fixes it.

Acked-by: Tigran
Acked-by: Lea
  • Loading branch information
alrossi authored and lemora committed Dec 8, 2023
1 parent 68dbc75 commit befcb48
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -18,7 +18,6 @@
package org.dcache.xrootd.pool;

import static java.nio.charset.StandardCharsets.US_ASCII;
import static java.util.function.Predicate.not;
import static org.dcache.xrootd.protocol.XrootdProtocol.UUID_PREFIX;
import static org.dcache.xrootd.protocol.XrootdProtocol.kXR_ArgInvalid;
import static org.dcache.xrootd.protocol.XrootdProtocol.kXR_ArgMissing;
Expand Down Expand Up @@ -52,6 +51,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
Expand Down Expand Up @@ -946,7 +946,7 @@ private FileDescriptor getDescriptorAtomically(int fd) throws XrootdException {

@GuardedBy("writeLock")
private void removeAllDescriptorsAtomically() {
_descriptors.stream().filter(not(null)).forEach(FileDescriptor::close);
_descriptors.stream().filter(Objects::nonNull).forEach(FileDescriptor::close);
_descriptors.clear();
}

Expand Down

0 comments on commit befcb48

Please sign in to comment.