java.lang.exception.getCause() gets null every time
<p>In one of the softwares that I develop, I am trying to manage an exception mechanism.</p>

<p>At somewhere of the programme, I do something like;</p>

<pre><code>IF(my condition not allowed){
    throw new Exception("My condition not allowed", null)
}
</code></pre>

<p>I throw null with the parameter of java.lang.exception to understand that this is something not relevant with a programatical error. (I don't have a chance to create my own custom exception, please consider that)</p>

<p>And in the somewhere above the programming I catch my exception like this;</p>

<pre><code>}catch(Exception e){
if(null == e.getCause)
    do.somethingThatIWantToCatch();
}else{
    do.somethingProgramaticalError();
}
</code></pre>

<p>here the problem is; my code may throw something else that I don't know like NullPointerException, ArrayIndexOutOfBoundsException etc...</p>

<p>At this point I expect that e.getCause() should NOT be null if I get programatical error, however I get NULL all the time and I execute my do.somethingThatIWantToCatch(); condition all the time.</p>

<p>how can I handle this situation and execute my do.somethingProgramaticalError(); condition ???</p>