title: Why ContentResolver.openFileDescriptor throws IllegalArgumentException? Way out?
body: <p>I have two questions, and to make my issue clear here a short code snippet:</p>
  
  <pre><code>ContentResolver resolver = context.getContentResolver();
  DocumentsContract.deleteDocument(resolver, documentUri);
  resolver.openFileDescriptor(documentUri, "rw");
  </code></pre>
  
  <p>The documentation sais that the last line "Throws FileNotFoundException if no file exists under the URI or the mode is invalid."</p>
  
  <p>But actually I get <code>java.lang.IllegalArgumentException</code>.</p>
  
  <p>(Question 1) Is this a bug or OK?</p>
  
  <p>(Question 2) <code>openFileDescriptor()</code> is obviously not a good method to test if the document exists. What is the "official" method to do that?</p>
  
  <p><strong>Edit (added error log):</strong></p>
  
  <p>W/System.err: java.lang.IllegalArgumentException: Failed to determine if 9016-4EF8:myFolder/file1.wav is child of 9016-4EF8:myFolder: java.io.FileNotFoundException: Missing file for 9016-4EF8:myFolder/file1.wav at /storage/extSdCard/myFolder/file1.wav</p>
  
  <p>W/System.err:     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:167)</p>
  
  <p>W/System.err:     at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:148)</p>
  
  <p>W/System.err:     at android.content.ContentProviderProxy.openAssetFile(ContentProviderNative.java:618)</p>
  
  <p>W/System.err:     at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:945)</p>
  
  <p>W/System.err:     at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:784)</p>
  
  <p>W/System.err:     at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:739)</p>
  
  <p><strong>And:</strong></p>
  
  <p>documentUri="content://com.android.externalstorage.documents/tree/9016-4EF8%3AmyFolder/document/9016-4EF8%3AmyFolder%2Ffile1.wav"</p>