Initializes the cause of this Throwable. The cause can only be initialized once. @param throwable the cause of this Throwable. @return this Throwable instance. @throws IllegalArgumentException if Throwable is this object. @throws IllegalStateEx
(Throwable throwable)
| 344 | * if the cause has already been initialized. |
| 345 | */ |
| 346 | public synchronized Throwable initCause(Throwable throwable) { |
| 347 | if (cause == this) { |
| 348 | if (throwable != this) { |
| 349 | cause = throwable; |
| 350 | return this; |
| 351 | } |
| 352 | throw new IllegalArgumentException("Cause cannot be the receiver"); |
| 353 | } |
| 354 | throw new IllegalStateException("Cause already initialized"); |
| 355 | } |
| 356 | |
| 357 | /** |
| 358 | * Returns the cause of this {@code Throwable}, or {@code null} if there is |
no outgoing calls
no test coverage detected