Source:
<code>public CompletableFuture<Page<NamedBlobRecord>> list(String accountName, String containerName, String blobNamePrefix, String continuationToken) { return executeTransactionAsync(accountName, containerName, (accountId, containerId, connection) -> { try (PreparedStatement statement = connection.prepareStatement(LIST_QUERY)) { statement.setInt(1, accountId); statement.setInt(2, containerId); statement.setString(3, blobNamePrefix + "%"); statement.setString(4, continuationToken != null ? continuationToken : blobNamePrefix); statement.setInt(5, config.listMaxResults + 1); try (ResultSet resultSet = statement.executeQuery()) { String nextContinuationToken = null; List<NamedBlobRecord> elements = new ArrayList<>(); int resultIndex = 0; while (resultSet.next()) { if (resultIndex++ == config.listMaxResults) { nextContinuationToken = resultSet.getString(1); break; } String blobName = resultSet.getString(1); String blobId = Base64.encodeBase64URLSafeString(resultSet.getBytes(2)); Timestamp expirationTime = resultSet.getTimestamp(3); Timestamp deletionTime = resultSet.getTimestamp(4); long currentTime = System.currentTimeMillis(); <START> if (compareTimestamp(expirationTime, currentTime) > 0 && compareTimestamp(deletionTime, currentTime) > 0) { <END> elements.add(new NamedBlobRecord(accountName, containerName, blobName, blobId, expirationTime != null ? expirationTime.getTime() : Utils.Infinite_Time)); } } return new Page<>(nextContinuationToken, elements); } } }); }</code><technical_language>A quick question, if blob deleted expired, do need throw exception similar get method simply excluding element is good enough? I feel if some expired blob listed</technical_language>

Target:
public CompletableFuture<Page<NamedBlobRecord>> list(String accountName, String containerName, String blobNamePrefix, String continuationToken) { return executeTransactionAsync(accountName, containerName, (accountId, containerId, connection) -> { try (PreparedStatement statement = connection.prepareStatement(LIST_QUERY)) { statement.setInt(1, accountId); statement.setInt(2, containerId); statement.setString(3, blobNamePrefix + "%"); statement.setString(4, continuationToken != null ? continuationToken : blobNamePrefix); statement.setInt(5, config.listMaxResults + 1); try (ResultSet resultSet = statement.executeQuery()) { String nextContinuationToken = null; List<NamedBlobRecord> elements = new ArrayList<>(); int resultIndex = 0; while (resultSet.next()) { if (resultIndex++ == config.listMaxResults) { nextContinuationToken = resultSet.getString(1); break; } String blobName = resultSet.getString(1); String blobId = Base64.encodeBase64URLSafeString(resultSet.getBytes(2)); Timestamp expirationTime = resultSet.getTimestamp(3); Timestamp deletionTime = resultSet.getTimestamp(4); long currentTime = System.currentTimeMillis(); if (compareTimestamp(expirationTime, currentTime) <= 0) { logger.trace("LIST: Blob expired, ignoring in list response; account='{}', container='{}', name='{}'", accountName, containerName, blobName); } else if (compareTimestamp(deletionTime, currentTime) <= 0) { logger.trace("LIST: Blob deleted, ignoring in list response; account='{}', container='{}', name='{}'", accountName, containerName, blobName); } else { elements.add( new NamedBlobRecord(accountName, containerName, blobName, blobId, timestampToMs(expirationTime))); } } return new Page<>(nextContinuationToken, elements); } } }); }