}
synchronized ContentProvider findContentProvider(String path) {
+// if (ContentUtils.EMPTY.equals(path))
+// return partitions.firstEntry().getValue();
Map.Entry<String, ContentProvider> entry = partitions.floorEntry(path);
if (entry == null)
- throw new IllegalArgumentException("No entry provider found for " + path);
+ throw new IllegalArgumentException("No entry provider found for path '" + path + "'");
String mountPath = entry.getKey();
+ if (!path.startsWith(mountPath)) {
+ // FIXME make it more robust and find when there is no content provider
+ String[] parent = ContentUtils.getParentPath(path);
+ return findContentProvider(parent[0]);
+ // throw new IllegalArgumentException("Path " + path + " doesn't have a content
+ // provider");
+ }
ContentProvider contentProvider = entry.getValue();
assert mountPath.equals(contentProvider.getMountPath());
return contentProvider;