commonsguy/cwac-provider

CompositeStreamStrategy's insert() shouldn't depend on canDelete()

mikrosk opened this issue · 2 comments

As seen in the source:

@OverRide
public Uri insert(Uri uri, ContentValues values) {
StreamStrategy strategy=getStrategy(uri);

if (strategy != null) {
  if (strategy.canDelete(uri)) {
    return(strategy.insert(uri, values));
  }
}

throw new UnsupportedOperationException("Um, this should not have been called");

}

Since we provide nice and explicit canInsert(), it seems odd to check for canDelete(). I guess this is because canDelete() is actually a check for exists() but StreamProvider shouldn't make assumptions like that -- for instance, my strategy's insert() is creating files, i.e. the file in question (defined by its uri) doesn't have to exist when inserting.

Related to #12.

Released in v0.4.4. Thanks!