title: Correct handling of exception: "getParameters failed (empty parameters)"
body: <p>I have a camera app in the Google Play store with Google Analytics installed.  I keep getting the following crash report:</p>
  
  <blockquote>
    <p>getParameters failed (empty parameters)</p>
  </blockquote>
  
  <p>My question is: <strong>What is the correct way to handle this?</strong></p>
  
  <p>Looking into the Android source of where it happens didn't give me any extra details.  The error is thrown in android_hardware_Camera.cpp:</p>
  
  <pre><code>String8 params8 = camera-&gt;getParameters();
  if (params8.isEmpty()) {
      jniThrowRuntimeException(env, "getParameters failed (empty parameters)");
      return 0;
  }
  </code></pre>
  
  <p>Looking into open source Android camera to see how it handles the situation was also not very helpful.  That code doesn't appear to catch the RuntimeException when calling getParameters.  (Except in one case where they catch it, close the camera, then rethrow it).</p>
  
  <p><strong>Is there a correct way to handle this?</strong></p>
  
  <p><strong>If not, is there a reason this happens so often?</strong></p>
  
  <p>Note: 
  On any given day I have between 5k - 8k active users.  With somewhere between 40-70 of these exceptions.  That seems <em>really</em> high to me.  I know there are legit instances where a camera may fail to initialize.  But 1% of users seems unreasonable.  Also, since the Android camera app doesn't handle the exception it really makes me wonder if there is some other root cause.</p>