JDK-4871783 : RemoteException.initCause() always throws IllegalStateException
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.rmi
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_7
  • CPU: sparc
  • Submitted: 2003-05-30
  • Updated: 2003-05-30
  • Resolved: 2003-05-30
Related Reports
Duplicate :  
Description

Name: atR10191			Date: 05/30/2003


method public Throwable initCause(Throwable cause) of class Throwable
always throws IllegalStateException being called on the
java.rmi.RemoteException instance.

See the example below.

============ Test172.java ==============================================
import java.rmi.RemoteException;

public class Test172 {

    public static void main(String argv[]) {
        RemoteException re = new RemoteException("java");
        Throwable ex = re.initCause(null);
 
        System.out.println("initCause(null) returned " + ex);
        System.exit(0);
    }
}
======== end of Test172.java ==========================================
======== output of Test172 ============================================
Exception in thread "main" java.lang.IllegalStateException: Can't overwrite caus
e
        at java.lang.Throwable.initCause(Throwable.java:320)
        at Test172.main(Test172.java:8)
======== end of output of Test172 =====================================
======================================================================

Comments
EVALUATION This has been the behavior of RemoteException.initCause since it was "retrofitted" for the chained exception facility (which was new in 1.4) in J2SE 1.4. See the Evaluation of 4847777 for the rationale for this behavior. I'm closing this bug as a duplicate of 4847777, which is being used to represent the need to clarify this behavior in the documentation. ###@###.### 2003-05-30
30-05-2003