Why exception exception.getCause () ==?

I was mistaken in asking this question, thinking that the value of a member variable causewould be returned as a result of calling getCause()in org.apache.catalina.connector.ClientAbortException. This is clearly not the case. The real reason is coming back.

Looking at the Throwable source, I see what it sets cause = thisto indicate that the cause has not yet been established. It was a bad question, but I learned something from him.

Original question below:

Sometimes, when you encounter exceptions, getCause () returns the exception object itself, making it recursive. Why doesn't getCause () return null?

+3
source share
2 answers

getCause() , - getCause(), null, cause , .

, ?

+4

, ? , , - initCause() , . .

0

Source: https://habr.com/ru/post/1724934/


All Articles