Skip to content

Commit 2a873d0

Browse files
committed
Cleaner exception propagation.
Signed-off-by: Lukas R. Mansour <lukas.mansour@desy.de>
1 parent 7bde5f9 commit 2a873d0

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

modules/chimera/src/main/java/org/dcache/chimera/JdbcFs.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -722,11 +722,11 @@ public String inode2id(FsInode inode) throws ChimeraFsException {
722722
return _idCache.get(inode.ino(), (key) -> {
723723
String id = _sqlDriver.getId(inode);
724724
if (id == null) {
725-
throw new RuntimeException(FileNotFoundChimeraFsException.of(inode));
725+
throw new CompletionException(FileNotFoundChimeraFsException.of(inode));
726726
}
727727
return id;
728728
});
729-
} catch (RuntimeException e) {
729+
} catch (CompletionException e) {
730730
if (e.getCause() != null) {
731731
Throwables.throwIfInstanceOf(e.getCause(), ChimeraFsException.class);
732732
Throwables.throwIfInstanceOf(e.getCause(), DataAccessException.class);
@@ -743,11 +743,11 @@ public FsInode id2inode(String id, StatCacheOption option) throws ChimeraFsExcep
743743
return new FsInode(this, _inoCache.get(id, (key) -> {
744744
Long ino = _sqlDriver.getInumber(id);
745745
if (ino == null) {
746-
throw new RuntimeException(FileNotFoundChimeraFsException.ofPnfsId(id));
746+
throw new CompletionException(FileNotFoundChimeraFsException.ofPnfsId(id));
747747
}
748748
return ino;
749749
}));
750-
} catch (RuntimeException e) {
750+
} catch (CompletionException e) {
751751
if (e.getCause() != null) {
752752
Throwables.throwIfInstanceOf(e.getCause(), ChimeraFsException.class);
753753
Throwables.throwIfInstanceOf(e.getCause(), DataAccessException.class);

modules/dcache-nfs/src/main/java/org/dcache/chimera/nfsv41/door/proxy/NfsProxyIoFactory.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import java.net.InetAddress;
1111
import java.net.InetSocketAddress;
1212
import java.util.Arrays;
13+
import java.util.concurrent.CompletionException;
1314
import java.util.concurrent.TimeUnit;
1415
import java.util.function.Consumer;
1516
import java.util.stream.Collectors;
@@ -97,9 +98,9 @@ public ProxyIoAdapter getOrCreateProxy(Inode inode, stateid4 stateid, CompoundCo
9798

9899
return adapter;
99100
} catch (IOException e) {
100-
throw new RuntimeException(e);
101+
throw new CompletionException(e);
101102
}});
102-
} catch (RuntimeException e) {
103+
} catch (CompletionException e) {
103104
if (e.getCause() != null) {
104105
Throwable t = e.getCause();
105106
_log.debug("failed to create IO adapter: {}", t.getMessage());

0 commit comments

Comments
 (0)