JDK-8351368 : RichTextArea: exception pasting from Word
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: jfx24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-03-06
  • Updated: 2025-03-21
  • Resolved: 2025-03-10
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.
Other
jfx24.0.1Fixed
Related Reports
Relates :  
Description
Exception gets thrown pasting from an RTF document (MS Word):

Exception in thread "JavaFX Application Thread" java.lang.ClassCastException: class java.lang.Object cannot be cast to class java.lang.String (java.lang.Object and java.lang.String are in module java.base of loader 'bootstrap')
	at jfx.incubator.richtext/com.sun.jfx.incubator.scene.control.richtext.rtf.RTFReader$StylesheetDestination.close(RTFReader.java:785)
	at jfx.incubator.richtext/com.sun.jfx.incubator.scene.control.richtext.rtf.RTFReader.endgroup(RTFReader.java:281)
	at jfx.incubator.richtext/com.sun.jfx.incubator.scene.control.richtext.rtf.RTFParser.write(RTFParser.java:163)
	at jfx.incubator.richtext/com.sun.jfx.incubator.scene.control.richtext.rtf.RTFReader.write(RTFReader.java:1)
	at jfx.incubator.richtext/com.sun.jfx.incubator.scene.control.richtext.rtf.AbstractFilter.readFromReader(AbstractFilter.java:106)
	at jfx.incubator.richtext/com.sun.jfx.incubator.scene.control.richtext.rtf.RTFReader.readFromReader(RTFReader.java:1)
	at jfx.incubator.richtext/com.sun.jfx.incubator.scene.control.richtext.rtf.RTFReader.generateStyledInput(RTFReader.java:143)
	at jfx.incubator.richtext/jfx.incubator.scene.control.richtext.model.RtfFormatHandler.createStyledInput(RtfFormatHandler.java:65)
	at jfx.incubator.richtext/com.sun.jfx.incubator.scene.control.richtext.RichTextAreaBehavior.pasteLocal(RichTextAreaBehavior.java:1191)
	at jfx.incubator.richtext/com.sun.jfx.incubator.scene.control.richtext.RichTextAreaBehavior.paste(RichTextAreaBehavior.java:1137)
	at jfx.incubator.input/com.sun.jfx.incubator.scene.control.input.SkinInputMap.execute(SkinInputMap.java:187)
	at jfx.incubator.input/jfx.incubator.scene.control.input.InputMap.executeDefault(InputMap.java:221)
	at jfx.incubator.input/jfx.incubator.scene.control.input.InputMap.execute(InputMap.java:215)
	at jfx.incubator.input/jfx.incubator.scene.control.input.InputMap.execute(InputMap.java:197)
	at jfx.incubator.input/jfx.incubator.scene.control.input.InputMap.handleKeyBindingEvent(InputMap.java:187)
	at jfx.incubator.input/jfx.incubator.scene.control.input.InputMap.lambda$1(InputMap.java:170)
	at jfx.incubator.input/com.sun.jfx.incubator.scene.control.input.PHList.forEach(PHList.java:172)
	at jfx.incubator.input/jfx.incubator.scene.control.input.InputMap.handleEvent(InputMap.java:168)
	at javafx.base/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:247)
	at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
	at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:232)
	at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:189)
	at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at javafx.graphics/javafx.scene.Scene.processKeyEvent(Scene.java:2240)
	at javafx.graphics/javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:2770)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.get(GlassViewEventHandler.java:175)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.get(GlassViewEventHandler.java:1)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:424)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(GlassViewEventHandler.java:203)
	at javafx.graphics/com.sun.glass.ui.View.handleKeyEvent(View.java:550)
	at javafx.graphics/com.sun.glass.ui.View.notifyKeyAndReturnConsumed(View.java:979)
	Suppressed: java.lang.ClassCastException: class java.lang.Object cannot be cast to class java.lang.String (java.lang.Object and java.lang.String are in module java.base of loader 'bootstrap')
		at jfx.incubator.richtext/com.sun.jfx.incubator.scene.control.richtext.rtf.RTFReader$StylesheetDestination.close(RTFReader.java:785)
		at jfx.incubator.richtext/com.sun.jfx.incubator.scene.control.richtext.rtf.RTFReader.endgroup(RTFReader.java:281)
		at jfx.incubator.richtext/com.sun.jfx.incubator.scene.control.richtext.rtf.RTFParser.close(RTFParser.java:339)
		at jfx.incubator.richtext/com.sun.jfx.incubator.scene.control.richtext.rtf.RTFReader.close(RTFReader.java:319)
		at jfx.incubator.richtext/jfx.incubator.scene.control.richtext.model.RtfFormatHandler.createStyledInput(RtfFormatHandler.java:66)
		... 31 more

Comments
A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jfx24u/pull/11 Date: 2025-03-10 15:00:32 +0000
10-03-2025

[jfx24u-fix-request] Approval Request from Andy Goryachev clean backport
10-03-2025

Changeset: 1c3cfcb8 Branch: master Author: Andy Goryachev <angorya@openjdk.org> Date: 2025-03-10 14:22:45 +0000 URL: https://git.openjdk.org/jfx/commit/1c3cfcb8bb4e8874406d3a5b507f38859f4c1d9b
10-03-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jfx/pull/1731 Date: 2025-03-06 23:16:41 +0000
06-03-2025