JDK-8074956 : ArrayIndexOutOfBoundsException in javax.swing.text.html.parser.ContentModel.first()
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8u40
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-03-11
  • Updated: 2015-09-29
  • Resolved: 2015-04-16
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 8 JDK 9
8u60Fixed 9 b65Fixed
Description
javax.swing.text.html.parser.ContentModel.first(Element) throws ArrayIndexOutOfBoundsException where this method is called with an unknown jx.s.t.html.parser.Element.

Steps to reproduce:

1. Create instance of ContentModel with type '&'.
2. Call its first(Element) method with any Element.
3. Call first(Element) method with a new Element instance. It results in ArrayIndexOutOfBoundsException.
Comments
Implementation of ContentModel.first(Element) uses cache for elements. It is implied all the possible elements are already created before you call first(Element) method for the first time. If you create a new Element instance and call first(Element) method with it, you'll get ArrayIndexOutOfBoundsException because the implication is now false. The fix is to re-create arrays used for cache when an "unknown" Element is used as parameter to first(Element). The cache is reset.
13-04-2015