Java Custom exception throw behaves differently between different Projects
Posted
by Pablo
on Stack Overflow
See other posts from Stack Overflow
or by Pablo
Published on 2010-05-06T04:09:29Z
Indexed on
2010/05/06
4:28 UTC
Read the original article
Hit count: 208
java
I am attempting to call the following in my code:
public void checkParticleLightRestriction(Particle parent) throws LightException {
if ( parent == null ) {
throw new LightException("quantum-particle-restrict.23", this);
}
In one Project the exception is thrown and the effect is similar to calling "return" whereby I am returned back to the point immediately succeeding where this method was called.
However in another Project I get thrown completed out of the current package and to a point way prior to the point preceeding this method.
It likes instead of being kicked out of a bar I am being deported all the way out of the country.
My option are the wrap the throw in a try / catch but I am wondering why this difference in behaviour beween the 2 projects ?
© Stack Overflow or respective owner