Merge "Throw FileNotFoundException in queryChildDocuments for archives."
diff --git a/documents-archive/src/android/support/provider/DocumentArchive.java b/documents-archive/src/android/support/provider/DocumentArchive.java
index 89cba8a..1182b0d 100644
--- a/documents-archive/src/android/support/provider/DocumentArchive.java
+++ b/documents-archive/src/android/support/provider/DocumentArchive.java
@@ -209,7 +209,7 @@
* @see DocumentsProvider.queryChildDocuments(String, String[], String)
*/
public Cursor queryChildDocuments(String documentId, @Nullable String[] projection,
- @Nullable String sortOrder) {
+ @Nullable String sortOrder) throws FileNotFoundException {
final ParsedDocumentId parsedParentId = ParsedDocumentId.fromDocumentId(
documentId, mIdDelimiter);
Preconditions.checkArgumentEquals(mDocumentId, parsedParentId.mArchiveId,
@@ -223,8 +223,9 @@
}
final List<ZipEntry> parentList = mTree.get(parentPath);
- Preconditions.checkArgumentNotNull(
- parentList, "The requested directory does not exist in the archive.");
+ if (parentList == null) {
+ throw new FileNotFoundException();
+ }
for (final ZipEntry entry : parentList) {
addCursorRow(result, entry);
}