I have the following code in Android 4:
import org.bouncycastle.jce.exception.ExtCertificateEncodingException;
....
public void method(){
try {
throw new ExtCertificateEncodingException();
} catch(ExtCertificateEncodingException e){
}
}
I compiled it and ran it. And an exception was thrown but it wasn't catched. It was confused me a bit. But, after an investigation it turned out that e
has type com.android.bouncycastle.jce.exception.ExtCertificateEncodingException
(or something like that) instead of bouncycastle.jce.exception.ExtCertificateEncodingException
.
And, I don't understand that exactly. I suppose that class loader makes some magic that I cannot understand. After all, I imported:
org.bouncycastle.jce.exception.ExtCertificateEncodingException
.
- Please help me understand it, explain it.
- Why a classloader is not obey and doesn't load it? (I am not sure if my interpretation of that behaviour is ok).
- Why I cannot
import com.android.bouncycastle.jce.exception.ExtCertificateEncodingException
- How to catch exactly it? I am not interested in
catch(Exception e)