-
Bug
-
Resolution: Fixed
-
P4
-
6u24, 8
-
b13
-
x86
-
windows_8
FULL PRODUCT VERSION :
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.3.9600]
A DESCRIPTION OF THE PROBLEM :
When the codepoints 0xFFFF and 0x10000 are added to an empty javax.swing.JTextComponent (JTextArea or JTextField), the view cannot be updated due to a NullPointerException.
No problems with java.awt.TextComponents.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the source code.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at java.awt.font.TextLayout.getBaselineFromGraphic(TextLayout.java:2679)
at java.awt.font.TextMeasurer.initAll(TextMeasurer.java:249)
at java.awt.font.TextMeasurer.<init>(TextMeasurer.java:168)
at java.awt.font.LineBreakMeasurer.<init>(LineBreakMeasurer.java:310)
at javax.swing.text.TextLayoutStrategy.sync(TextLayoutStrategy.java:312)
at javax.swing.text.TextLayoutStrategy.insertUpdate(TextLayoutStrategy.java:70)
at javax.swing.text.FlowView.loadChildren(FlowView.java:143)
at javax.swing.text.CompositeView.setParent(CompositeView.java:139)
at javax.swing.text.FlowView.setParent(FlowView.java:289)
at javax.swing.plaf.basic.BasicTextUI$RootView.setView(BasicTextUI.java:1328)
at javax.swing.plaf.basic.BasicTextUI.setView(BasicTextUI.java:693)
at javax.swing.plaf.basic.BasicTextUI.modelChanged(BasicTextUI.java:682)
at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.insertUpdate(BasicTextUI.java:1862)
at javax.swing.text.AbstractDocument.fireInsertUpdate(AbstractDocument.java:201)
at javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:748)
at javax.swing.text.AbstractDocument.insertString(AbstractDocument.java:707)
at javax.swing.text.PlainDocument.insertString(PlainDocument.java:130)
at javax.swing.text.AbstractDocument.replace(AbstractDocument.java:669)
at javax.swing.text.JTextComponent.setText(JTextComponent.java:1712)
at javax.swing.JTextField.<init>(JTextField.java:243)
at javax.swing.JTextField.<init>(JTextField.java:183)
at SwingUnicodeTest.lambda$main$0(SwingUnicodeTest.java:4)
at SwingUnicodeTest$$Lambda$1/640070680.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744)
at java.awt.EventQueue.access$400(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:697)
at java.awt.EventQueue$3.run(EventQueue.java:691)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:714)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
public class SwingUnicodeTest {
public static void main(final String... args) {
SwingUtilities.invokeLater(() -> new JTextField(new StringBuilder().appendCodePoint(0xFFFF).appendCodePoint(0x10000).toString()));
}
}
---------- END SOURCE ----------
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.3.9600]
A DESCRIPTION OF THE PROBLEM :
When the codepoints 0xFFFF and 0x10000 are added to an empty javax.swing.JTextComponent (JTextArea or JTextField), the view cannot be updated due to a NullPointerException.
No problems with java.awt.TextComponents.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the source code.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at java.awt.font.TextLayout.getBaselineFromGraphic(TextLayout.java:2679)
at java.awt.font.TextMeasurer.initAll(TextMeasurer.java:249)
at java.awt.font.TextMeasurer.<init>(TextMeasurer.java:168)
at java.awt.font.LineBreakMeasurer.<init>(LineBreakMeasurer.java:310)
at javax.swing.text.TextLayoutStrategy.sync(TextLayoutStrategy.java:312)
at javax.swing.text.TextLayoutStrategy.insertUpdate(TextLayoutStrategy.java:70)
at javax.swing.text.FlowView.loadChildren(FlowView.java:143)
at javax.swing.text.CompositeView.setParent(CompositeView.java:139)
at javax.swing.text.FlowView.setParent(FlowView.java:289)
at javax.swing.plaf.basic.BasicTextUI$RootView.setView(BasicTextUI.java:1328)
at javax.swing.plaf.basic.BasicTextUI.setView(BasicTextUI.java:693)
at javax.swing.plaf.basic.BasicTextUI.modelChanged(BasicTextUI.java:682)
at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.insertUpdate(BasicTextUI.java:1862)
at javax.swing.text.AbstractDocument.fireInsertUpdate(AbstractDocument.java:201)
at javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:748)
at javax.swing.text.AbstractDocument.insertString(AbstractDocument.java:707)
at javax.swing.text.PlainDocument.insertString(PlainDocument.java:130)
at javax.swing.text.AbstractDocument.replace(AbstractDocument.java:669)
at javax.swing.text.JTextComponent.setText(JTextComponent.java:1712)
at javax.swing.JTextField.<init>(JTextField.java:243)
at javax.swing.JTextField.<init>(JTextField.java:183)
at SwingUnicodeTest.lambda$main$0(SwingUnicodeTest.java:4)
at SwingUnicodeTest$$Lambda$1/640070680.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744)
at java.awt.EventQueue.access$400(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:697)
at java.awt.EventQueue$3.run(EventQueue.java:691)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:714)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
public class SwingUnicodeTest {
public static void main(final String... args) {
SwingUtilities.invokeLater(() -> new JTextField(new StringBuilder().appendCodePoint(0xFFFF).appendCodePoint(0x10000).toString()));
}
}
---------- END SOURCE ----------