JDK-8211267 : StackOverflowError happened by TextField.setFont(...)
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 11,12
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux,aix
  • CPU: generic
  • Submitted: 2018-09-28
  • Updated: 2019-10-20
  • Resolved: 2019-01-07
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 11 JDK 12 JDK 13
11.0.3Fixed 12.0.2Fixed 13 b03Fixed
Related Reports
Duplicate :  
Description
I could see following exception by TextField.setFont(...)

=====================
Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError
        at java.desktop/javax.swing.plaf.basic.BasicTextUI$UpdateHandler.layoutContainer(BasicTextUI.java:2061)
        at java.desktop/java.awt.Container.layout(Container.java:1537)
        at java.desktop/java.awt.Container.doLayout(Container.java:1526)
        at java.desktop/java.awt.Container.validateTree(Container.java:1722)
        at java.desktop/java.awt.Container.validate(Container.java:1657)
        at java.desktop/sun.awt.X11.XTextFieldPeer.setFont(XTextFieldPeer.java:290)
        at java.desktop/java.awt.Component.validate(Component.java:2976)
        at java.desktop/java.awt.Container.validateTree(Container.java:1740)
        at java.desktop/java.awt.Container.validate(Container.java:1657)
        at java.desktop/sun.awt.X11.XTextFieldPeer.setFont(XTextFieldPeer.java:290)
        at java.desktop/java.awt.Component.validate(Component.java:2976)
        at java.desktop/java.awt.Container.validateTree(Container.java:1740)
...
=====================

It seemed that sun.awt.X11.XTextFieldPeer.setFont(...) was called recursively.

Mail thread started on August, 2018,
http://mail.openjdk.java.net/pipermail/awt-dev/2018-August/014240.html
http://mail.openjdk.java.net/pipermail/awt-dev/2018-September/014267.html

Review approval:
http://mail.openjdk.java.net/pipermail/awt-dev/2018-October/014403.html
http://mail.openjdk.java.net/pipermail/awt-dev/2018-October/014552.html

JDK-8212677's test case code was merged:
Review approval:
http://mail.openjdk.java.net/pipermail/awt-dev/2018-December/014829.html

Another review was requested. The test case did not have "@test" tag
http://mail.openjdk.java.net/pipermail/awt-dev/2018-December/014860.html
Comments
Fix Request I'd like to request the fix for 12u as well. This fix prevents stack overflow and contributes to increase stability. The fix is simple and risk is low. The patch could apply cleanly to 12u repository.
21-02-2019

This should also go to 12u, right? If so, please amend Fix Request and tags to include 12u.
20-02-2019

Fix Request This fix prevents stack overflow and contributes to increase stability. The fix is simple and risk is low. The patch could apply cleanly.
20-02-2019

NOTE: This P4 bug will be retargeted to "13" in case this issue is still Unresolved by Mon, Dec 10 3am Pacific Time Mon Dec 10 (Pre Integration Testing deadline) to meet JDK 12 RDP1 Dec 13 milestone [1]. No more P4-P5 in JDK 12 beyond RDP1 in accordance with RDP1 definition [2]. [1] http://mail.openjdk.java.net/pipermail/jdk-dev/2018-September/001984.html [2] http://openjdk.java.net/jeps/3
04-12-2018