title: Handling Runtime exception in Java
body: <p>I have the following piece of code</p>
  
  <pre><code> try{//do something
       }
    catch (Exception e) {
          log.error(e, e);
          if (e instanceof RuntimeException) {
              throw (RuntimeException) e;
          } else {
              throw new RuntimeException(e);
          }
      }
  </code></pre>
  
  <p>the findbugs stataic analysis tool throws this warning on it</p>
  
  <blockquote>
    <p>instanceof will always return true for all nonnull values in methodX, since all RuntimeException are instances of RuntimeException</p>
  </blockquote>
  
  <p>what i dont understand is that its Exception which is being caught and not the RuntimeException, so why this warning ?</p>