Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StringIndexOutOfBoundsException #7

Open
filippsudanov opened this issue Dec 12, 2024 · 2 comments
Open

StringIndexOutOfBoundsException #7

filippsudanov opened this issue Dec 12, 2024 · 2 comments

Comments

@filippsudanov
Copy link

filippsudanov commented Dec 12, 2024

Hi,

We use commonmark-java with your extension in our java app. We've ran some tests from https://github.com/michelf/mdtest/tree/master and the extension failed on https://github.com/michelf/mdtest/blob/master/Markdown.mdtest/Ordered%20and%20unordered%20lists.text (here's that file attached here: Ordered and unordered lists.txt )

13:03:15.679 [main] ERROR org.netxms.nxmc.Startup - Unhandled event loop exception
java.lang.StringIndexOutOfBoundsException: begin 8, end 7, length 7
	at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4606)
	at java.base/java.lang.String.substring(String.java:2709)
	at java.base/java.lang.String.subSequence(String.java:2747)
	at nxmc-loader//fr.brouillard.oss.commonmark.ext.notifications.NotificationBlockParser$Factory.tryStart(NotificationBlockParser.java:75)
	at nxmc-loader//org.commonmark.internal.DocumentParser.findBlockStart(DocumentParser.java:461)
	at nxmc-loader//org.commonmark.internal.DocumentParser.parseLine(DocumentParser.java:252)
	at nxmc-loader//org.commonmark.internal.DocumentParser.parse(DocumentParser.java:131)
	at nxmc-loader//org.commonmark.parser.Parser.parse(Parser.java:78)
	at nxmc-loader//org.netxms.nxmc.base.widgets.MarkdownViewer.setText(MarkdownViewer.java:145)
	at nxmc-loader//org.netxms.nxmc.modules.objects.views.CommentsView.onObjectUpdate(CommentsView.java:112)
	at nxmc-loader//org.netxms.nxmc.modules.objects.views.CommentsView.onObjectChange(CommentsView.java:99)
	at nxmc-loader//org.netxms.nxmc.modules.objects.views.ObjectView.contextChanged(ObjectView.java:165)
	at nxmc-loader//org.netxms.nxmc.base.views.ViewWithContext.setContext(ViewWithContext.java:122)
	at nxmc-loader//org.netxms.nxmc.base.views.ViewWithContext.setContext(ViewWithContext.java:105)
	at nxmc-loader//org.netxms.nxmc.base.views.ViewFolder.setContext(ViewFolder.java:830)
	at nxmc-loader//org.netxms.nxmc.base.views.Perspective.setContext(Perspective.java:155)
	at nxmc-loader//org.netxms.nxmc.base.views.Perspective.navigationSelectionChanged(Perspective.java:118)
	at nxmc-loader//org.netxms.nxmc.modules.objects.ObjectsPerspective.navigationSelectionChanged(ObjectsPerspective.java:547)
	at nxmc-loader//org.netxms.nxmc.base.views.Perspective$1.selectionChanged(Perspective.java:96)
	at nxmc-loader//org.eclipse.jface.viewers.Viewer$1.run(Viewer.java:151)
	at nxmc-loader//org.netxms.nxmc.Startup$2.run(Startup.java:168)
	at nxmc-loader//org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)
	at nxmc-loader//org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:148)
	at nxmc-loader//org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2132)
	at nxmc-loader//org.eclipse.jface.viewers.ColumnViewer.updateSelection(ColumnViewer.java:1055)
	at nxmc-loader//org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1170)
	at nxmc-loader//org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1199)
	at nxmc-loader//org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:262)
	at nxmc-loader//org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:420)
	at nxmc-loader//org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91)
	at nxmc-loader//org.eclipse.swt.widgets.Display.sendEvent(Display.java:5855)
	at nxmc-loader//org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1617)
	at nxmc-loader//org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5065)
	at nxmc-loader//org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4517)
	at nxmc-loader//org.eclipse.jface.window.Window.runEventLoop(Window.java:823)
	at nxmc-loader//org.eclipse.jface.window.Window.open(Window.java:799)
	at nxmc-loader//org.netxms.nxmc.Startup.openWindows(Startup.java:343)
	at nxmc-loader//org.netxms.nxmc.Startup.main(Startup.java:207)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at org.netxms.nxmc.BootstrapLoader.main(BootstrapLoader.java:138)
McFoggy added a commit that referenced this issue Dec 30, 2024
McFoggy added a commit that referenced this issue Dec 30, 2024
McFoggy added a commit that referenced this issue Dec 30, 2024
@McFoggy
Copy link
Owner

McFoggy commented Dec 30, 2024

@filippsudanov as you can see in branch isse/#7 I do not reproduce the error with your sample file. Do you have more information to enable reproduction ?

McFoggy added a commit that referenced this issue Jan 2, 2025
McFoggy added a commit that referenced this issue Jan 2, 2025
@McFoggy
Copy link
Owner

McFoggy commented Jan 2, 2025

@filippsudanov can you please try with

<dependency>
    <groupId>fr.brouillard.oss</groupId>
    <artifactId>commonmark-ext-notifications</artifactId>
    <version>2.0.0-beta1</version>
</dependency>    

I slightly changed the extension, it might helps to pass your use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants