JDK-8153479 : JavaFX unit tests fail after fix for JDK-8079136
  • Type: Bug
  • Component: javafx
  • Sub-Component: other
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-04-05
  • Updated: 2016-04-06
  • Resolved: 2016-04-06
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Fixed
Related Reports
Relates :  
Description
The fix for JDK-8079136 is causing the JavaFX unit tests to fail with an unexpected exception. We are now seeing IOOBE rather than the expected AIOOBE.

I don't know if this is a corner case or a general problem, but it is a regression.

To reproduce, you can run the javafx unit tests and see the following error. I will come up with a standalone test case tomorrow.

test.javafx.binding.BindingsArrayTest > testValueAt_Variable FAILED
    java.lang.AssertionError: expected:<class java.lang.ArrayIndexOutOfBoundsException> but was:<class java.lang.IndexOutOfBoundsException>
        at org.junit.Assert.fail(Assert.java:91)
        at org.junit.Assert.failNotEquals(Assert.java:645)
        at org.junit.Assert.assertEquals(Assert.java:126)
        at org.junit.Assert.assertEquals(Assert.java:145)
        at test.com.sun.javafx.binding.ErrorLoggingUtiltity.check(ErrorLoggingUtiltity.java:89)
        at test.com.sun.javafx.binding.ErrorLoggingUtiltity.checkFine(ErrorLoggingUtiltity.java:83)
        at test.javafx.binding.BindingsArrayTest.testValueAt_Variable(BindingsArrayTest.java:225)

[several more failures happen as well]
Comments
http://hg.openjdk.java.net/openjfx/9-dev/rt/rev/e7e7b5ce118c
06-04-2016

Looks good.
06-04-2016

http://cr.openjdk.java.net/~kcr/8153479/webrev.00/ Simple fix to check for IOOBE rather than AIOOBE in our list-based unit tests. Also, I checked and this issue is limited to the failing tests. I ran the tests with an older JDK 9 (without the fix for JDK-8079136) and a newer JDK 9 (with the fix for JDK-8079136) and all tests now pass on both builds.
06-04-2016

I agree with the evaluation given by Paul. Forwarding the issue back.
06-04-2016

Yes, AIOOBE is an implementation detail. For the majority of cases ArrayList throws an IOOBE. Before the fix for JDK-8079136 there a few cases where AIOOBE would be thrown, specifically when accessing via get/set/remove for a -ve index. For a +ve index >= size an IOOBE would be thrown: Here is the old code: /** * Checks if the given index is in range. If not, throws an appropriate * runtime exception. This method does *not* check if the index is * negative: It is always used immediately prior to an array access, * which throws an ArrayIndexOutOfBoundsException if index is negative. */ private void rangeCheck(int index) { if (index >= size) throw new IndexOutOfBoundsException(outOfBoundsMsg(index)); } public E get(int index) { rangeCheck(index); return elementData(index); }
06-04-2016

We need to fix our unit tests to not expect AIOOBE from ArrayList. At the same time I will check our implementation and make sure we have no places where we do "try { ... } catch (AIOOBE)".
06-04-2016

I note that it is a possible that we are relying on an implementation detail of the existing implementation, since AIOOBE is a subclass of IOOBE. I see that ArrayList is documented to throw IOOBE. If this is the case, and the change is intentional, then you can reassign the bug to me (and change component to javafx).
05-04-2016