title: How to properly compare a string to another string
body: <p>I have a problem with below <code>if</code> condition.</p>
  
  <pre><code>if(!(type=="image/jpeg" || type=="image/png" || type=="image/gif")){
      throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Only jpeg, png or gif", ""));
  }
  </code></pre>
  
  <p>When <code>type</code> is <code>image/jpeg</code>, it still throws <code>ValidatorException</code>. When I hardcode <code>type</code> directly to <code>image/jpeg</code>, it works. So I hope that you help me, because I really don't know where is problem.</p>