#vulnerable code 
                                Optional<Chunk> chunk(BoundedInputStream bis, ChunkServer.ChunkInfo chunkInfo, int index) throws IOException {
        byte[] checksum = chunkInfo.getChunkChecksum().toByteArray();
        return store.chunk(checksum)
                .<IOSupplier<Optional<Chunk>>>map(u -> () -> {
                    logger.debug("-- chunk() - chunk present in store: 0x:{}", Hex.toHexString(checksum));
                    return Optional.of(u);
                })
                .orElseGet(() -> () -> {
                    logger.debug("-- chunk() - chunk not present in store: 0x:{}", Hex.toHexString(checksum));
                    byte[] chunkEncryptionKey = chunkInfo.getChunkEncryptionKey().toByteArray();
                    return decrypt(bis, chunkEncryptionKey, checksum, index);
                })
                .get();
    } 
                            #location 13 
                            #vulnerability type INTERFACE_NOT_THREAD_SAFE
#fixed code
                                Optional<Chunk> chunk(InputStream inputStream, ChunkServer.ChunkInfo chunkInfo, int index) throws IOException {
        logger.trace("<< chunk() - chunkInfo: {} index: {}", chunkInfo, index);

        BoundedInputStream bis = new BoundedInputStream(inputStream, chunkInfo.getChunkLength());
        bis.setPropagateClose(false);
        Optional<Chunk> chunk = chunk(bis, chunkInfo, index);
        consume(bis);

        logger.trace(">> chunk() - chunk: {}", chunk);
        return chunk;
    }