if (!bucket.data.hasRootId()) {
return Lists.newArrayList();
}
DirectoryData dir = directoryStorage.find(bucket.data.getRootId());
if (dir == null) {
throw new IllegalStateException();
}
List<DirectoryListEntry> entries = Lists.newArrayList();
for (FileData file : dir.getFilesList()) {
entries.add(new DirectoryListEntry(file.getKey(), file));
}
return entries;
}