diff --git a/modules/common/src/main/java/com/tsurugidb/tsubakuro/channel/common/connection/wire/impl/ChannelResponse.java b/modules/common/src/main/java/com/tsurugidb/tsubakuro/channel/common/connection/wire/impl/ChannelResponse.java index 90d68036..84e3ad88 100644 --- a/modules/common/src/main/java/com/tsurugidb/tsubakuro/channel/common/connection/wire/impl/ChannelResponse.java +++ b/modules/common/src/main/java/com/tsurugidb/tsubakuro/channel/common/connection/wire/impl/ChannelResponse.java @@ -157,9 +157,13 @@ public InputStream openSubResponse(String id) throws NoSuchElementException, IOE waitForResultSetOrMainResponse(); return relationChannel(); } else { - var path = blobs.get(id).getLeft(); - if (path != null) { - return new FileInputStream(path); + waitForMainResponse(); + var entry = blobs.get(id); + if (entry != null) { + var path = entry.getLeft(); + if (path != null) { + return new FileInputStream(path); + } } } throw new NoSuchElementException("illegal SubResponse id"); @@ -174,9 +178,13 @@ public InputStream openSubResponse(String id, long timeout, TimeUnit unit) throw waitForResultSetOrMainResponse(timeout, unit); return relationChannel(); } else { - var path = blobs.get(id).getLeft(); - if (path != null) { - return new FileInputStream(path); + waitForMainResponse(timeout, unit); + var entry = blobs.get(id); + if (entry != null) { + var path = entry.getLeft(); + if (path != null) { + return new FileInputStream(path); + } } } throw new NoSuchElementException("illegal SubResponse id");