Skip to content
This repository was archived by the owner on Apr 10, 2021. It is now read-only.
This repository was archived by the owner on Apr 10, 2021. It is now read-only.

StringIndexOutOfBoundsException while adding more lines to the end of the file #110

Open
@Chris2011

Description

@Chris2011

Because of testing my PR, I added some new lines to the end of the file and I got the following exception. This should not happen.

java.lang.StringIndexOutOfBoundsException: String index out of range: 2664
	at java.lang.String.substring(String.java:1963)
	at com.welovecoding.nbeditorconfig.processor.operation.TrimTrailingWhiteSpaceOperation.detectCaretOffset(TrimTrailingWhiteSpaceOperation.java:51)
	at com.welovecoding.nbeditorconfig.processor.operation.TrimTrailingWhiteSpaceOperation.operate(TrimTrailingWhiteSpaceOperation.java:28)
	at com.welovecoding.nbeditorconfig.processor.operation.TrimTrailingWhiteSpaceOperation.operate(TrimTrailingWhiteSpaceOperation.java:18)
	at com.welovecoding.nbeditorconfig.processor.EditorConfigProcessor.excuteOperations(EditorConfigProcessor.java:192)
	at com.welovecoding.nbeditorconfig.processor.EditorConfigProcessor.applyRulesToFile(EditorConfigProcessor.java:96)
[catch] at com.welovecoding.nbeditorconfig.listener.FileChangeListener.fileChanged(FileChangeListener.java:58)
	at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectKeeper.fileChanged(FileObjectKeeper.java:365)
	at org.openide.filesystems.FCLSupport$DispatchEventWrapper.dispatchEventImpl(FCLSupport.java:178)
	at org.openide.filesystems.FCLSupport$DispatchEventWrapperSingle.dispatchAllEventsSync(FCLSupport.java:224)
	at org.openide.filesystems.FCLSupport$DispatchEventWrapper.dispatchEvent(FCLSupport.java:137)
	at org.openide.filesystems.FCLSupport.dispatchEvent(FCLSupport.java:105)
	at org.openide.filesystems.FileObject$ED.dispatch(FileObject.java:1398)
	at org.openide.filesystems.EventControl.invokeDispatchers(EventControl.java:213)
	at org.openide.filesystems.EventControl.exitAtomicAction(EventControl.java:188)
	at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:129)
	at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:519)
	at org.openide.filesystems.FileUtil.runAtomicAction(FileUtil.java:420)
	at org.openide.text.DataEditorSupport.saveDocument(DataEditorSupport.java:603)
	at org.netbeans.modules.csl.core.GsfDataObject$GenericEditorSupport$Environment$SaveSupport.save(GsfDataObject.java:224)
	at org.openide.actions.SaveAction.performAction(SaveAction.java:132)
	at org.openide.actions.SaveAction.performAction(SaveAction.java:102)
	at org.openide.actions.SaveAction$Delegate.actionPerformed(SaveAction.java:249)
	at org.openide.awt.ContextAction$Performer.actionPerformed(ContextAction.java:231)
	at org.openide.awt.ContextManager.actionPerformed(ContextManager.java:260)
	at org.openide.awt.ContextAction.actionPerformed(ContextAction.java:109)
	at org.openide.util.actions.ActionInvoker$1.run(ActionInvoker.java:93)
	at org.openide.util.actions.ActionInvoker$ActionRunnable.actionPerformed(ActionInvoker.java:162)
	at org.netbeans.core.ModuleActions.invokeAction(ModuleActions.java:109)
	at org.netbeans.modules.openide.actions.ActionsBridgeImpl.invokeAction(ActionsBridgeImpl.java:60)
	at org.openide.util.actions.ActionInvoker$ActionRunnable.doRun(ActionInvoker.java:153)
	at org.openide.util.actions.ActionInvoker$2.run(ActionInvoker.java:110)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)

Cheers

Chris

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