title: Azure Blob Error: StorageException: The condition specified using HTTP conditional header(s) is not met
body: <p>So I have a function that simply downloads text from blob storage every 10 minutes and checks for a result. This function can run for days. But it often (roughly every day) fails before finishing with the following error.</p>
  
  <blockquote>
    <p>Caused by: com.microsoft.azure.storage.StorageException: The condition specified using HTTP conditional header(s) is not met.</p>
  </blockquote>
  
  <p>My code is pretty simple.</p>
  
  <pre><code>public String downloadTextBlob(CloudBlobDirectory dir, String filename) {
      try {
          return dir.getBlockBlobReference(filename).downloadText();
      } catch (StorageException | IOException | URISyntaxException e) {
          throw new WorkbenchRuntimeException(e.getMessage(), e);
      }
  }
  </code></pre>
  
  <p>I the same issue posted <a href="https://stackoverflow.com/questions/5094089/azure-blob-the-condition-specified-using-http-conditional-headers-is-not-met">here</a>, and I was interested in the answer which talked about using an OperationContext to fix the issue. But the question wasn't on Java, and the answer didn't really explain what it was actually doing.</p>
  
  <p>Here's the proposed solution (non java code)</p>
  
  <pre><code> OperationContext context = new OperationContext();
   context.SendingRequest += (sender, e) =&gt; { 
       e.Request.Headers["if-match"] = "*";
   };
  </code></pre>
  
  <p>Can anyone explain what this is actually doing? And maybe how I can replicate this in Java, I notice there is an OperationContext in the Java azure storage sdk, and that I can call the .downloadText() with an operation context as a parameter. I'm just not sure what to do with OperationContext. </p>