Skip to content

Exception: Cannot construct a Paragraph with StyleSpans object that contains no StyleSpan objects #696

@JFormDesigner

Description

@JFormDesigner

I'm getting the below exception with current master branch of RichTextFX in Markdown Writer FX, but it works fine with RichTextFX 0.8.2.

Was able to find the commit that causes the exception: PR #685
Before this PR was merged, it worked. After merging, it fails.

The exception assumes a problem on my side, but I have no idea how to fix this.

I'm having a StyleClassedTextArea and using a StyleSpansBuilder<Collection<String>> to build style spans for the whole text.

Any ideas?

Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException:
 Cannot construct a Paragraph with StyleSpans object that contains no StyleSpan objects
	at org.fxmisc.richtext.model.Paragraph.<init>(Paragraph.java:124)
	at org.fxmisc.richtext.model.Paragraph.restyle(Paragraph.java:325)
	at org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.lambda$11(GenericEditableStyledDocumentBase.java:170)
	at org.fxmisc.richtext.model.ReadOnlyStyledDocument.lambda$14(ReadOnlyStyledDocument.java:366)
	at org.reactfx.util.Tuple2.map(Tuple2.java:31)
	at org.fxmisc.richtext.model.ReadOnlyStyledDocument.lambda$12(ReadOnlyStyledDocument.java:365)
	at org.reactfx.util.Tuple2.map(Tuple2.java:31)
	at org.fxmisc.richtext.model.ReadOnlyStyledDocument.replace(ReadOnlyStyledDocument.java:364)
	at org.fxmisc.richtext.model.ReadOnlyStyledDocument.replace(ReadOnlyStyledDocument.java:354)
	at org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.setStyleSpans(GenericEditableStyledDocumentBase.java:164)
	at org.fxmisc.richtext.model.SimpleEditableStyledDocument.setStyleSpans(SimpleEditableStyledDocument.java:1)
	at org.fxmisc.richtext.GenericStyledArea.setStyleSpans(GenericStyledArea.java:1138)
	at org.markdownwriterfx.editor.MarkdownSyntaxHighlighter.highlight(MarkdownSyntaxHighlighter.java:278)
	at org.markdownwriterfx.editor.MarkdownSyntaxHighlighter.highlight(MarkdownSyntaxHighlighter.java:198)
	at org.markdownwriterfx.editor.MarkdownEditorPane.applyHighlighting(MarkdownEditorPane.java:299)
	at org.markdownwriterfx.editor.MarkdownEditorPane.textChanged(MarkdownEditorPane.java:273)
	at org.markdownwriterfx.editor.MarkdownEditorPane.lambda$0(MarkdownEditorPane.java:100)
	at org.reactfx.value.ChangeListenerWrapper.accept(Val.java:786)
	at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.SuspendableBase.resume(SuspendableBase.java:64)
	at org.reactfx.CloseableOnceGuard.close(Guard.java:49)
	at org.reactfx.MultiGuard.close(Guard.java:83)
	at org.reactfx.Suspendable$1.resumeSource(Suspendable.java:118)
	at org.reactfx.Suspendable$1.suspendSource(Suspendable.java:104)
	at org.reactfx.util.NonAccumulativeStreamNotifications.lambda$head$0(NotificationAccumulator.java:134)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.ProperEventStream.emit(ProperEventStream.java:18)
	at org.reactfx.EventStreams$3.lambda$observeInputs$0(EventStreams.java:105)
	at org.reactfx.value.ChangeListenerWrapper.accept(Val.java:786)
	at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.value.ValBase.invalidate(ValBase.java:32)
	at org.reactfx.SuspendableBoolean.release(SuspendableBoolean.java:24)
	at org.reactfx.CloseableOnceGuard.close(Guard.java:49)
	at org.reactfx.Suspendable.suspendWhile(Suspendable.java:49)
	at org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.update(GenericEditableStyledDocumentBase.java:228)
	at org.reactfx.util.Tuple3.exec(Tuple3.java:43)
	at org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.replace(GenericEditableStyledDocumentBase.java:135)
	at org.fxmisc.richtext.model.SimpleEditableStyledDocument.replace(SimpleEditableStyledDocument.java:1)
	at org.fxmisc.richtext.GenericStyledArea.replace(GenericStyledArea.java:1187)
	at org.fxmisc.richtext.GenericStyledArea.replaceText(GenericStyledArea.java:1174)
	at org.fxmisc.richtext.EditActions.replaceText(EditActions.java:148)
	at org.markdownwriterfx.editor.MarkdownEditorPane.setMarkdown(MarkdownEditorPane.java:225)
	at org.markdownwriterfx.FileEditor.load(FileEditor.java:267)
	at org.markdownwriterfx.FileEditor.activated(FileEditor.java:216)
	at org.markdownwriterfx.FileEditor.lambda$5(FileEditor.java:97)
	at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
	at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
	at java.lang.Thread.run(Thread.java:748)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions