Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7049107

Cannot call initCause() on BatchUpdateException

XMLWordPrintable

    • b145
    • x86
    • solaris_nevada
    • Verified

      The javadoc comments for all of BatchUpdateException's constructors that don't take a cause argument, say that initCause() can be called to initialize the cause:

      > The cause is not initialized, and may subsequently be initialized by a call
      > to the Throwable.initCause(java.lang.Throwable) method.

      As of b142, this is no longer true (also tested b143 and b144). For example, the following code

              BatchUpdateException bue = new BatchUpdateException();
              bue.initCause(new Throwable());

      results in this exception being thrown:

      Exception in thread "main" java.lang.IllegalStateException: Can't overwrite cause
      at java.lang.Throwable.initCause(Throwable.java:456)
      at BUE.main(BUE.java:6)

            lancea Lance Andersen
            khatlen Knut Anders Hatlen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: