title: How to preserve stack trace in this case?
body: <p>In my code I got a rule violation called 'preserve stack trace' while I have analysed the code on sonar.</p>
  
  <pre><code>try {
    doSomething();
  } catch(IllegalStateException e) {
     try {
        doAnotherThing();
    } catch(IOException e1) {
        throw new MyException(e1.getCause());
    }
    throw new MyException(e.getCause());
  }
  </code></pre>
  
  <p>So how to preserve the stack trace in this case?</p>