leomillon / uuid-generator-plugin

An IntelliJ Idea plugin to generate UUID (Universally Unique Identifier), ULID (Universally Unique Lexicographically Sortable Identifier) and CUID (Collision Resistant Unique Identifier)
MIT License
34 stars 13 forks source link

StringIndexOutOfBoundsException #112

Open Noodlex opened 2 years ago

Noodlex commented 2 years ago

Hi,

I use Intellij 2021.3 and I have this error when I want to replace "#gen.uuid#".

java.lang.StringIndexOutOfBoundsException: begin 726, end 736, length 322 at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319) at java.base/java.lang.String.substring(String.java:1874) at java.base/java.lang.String.subSequence(String.java:1913) at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.prepareReplaceString(DocumentWindowImpl.java:317) at com.intellij.psi.impl.source.tree.injected.DocumentWindowImpl.replaceString(DocumentWindowImpl.java:366) at com.github.leomillon.uuidgenerator.EditorDocumentUtils.replaceTextAtRange(EditorDocumentUtils.kt:38) at com.github.leomillon.uuidgenerator.quickfix.IdPlaceholderQuickFix.invoke$lambda-0(IdPlaceholderQuickFix.kt:25) at com.intellij.openapi.command.WriteCommandAction.lambda$runWriteCommandAction$4(WriteCommandAction.java:361) at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$doRunWriteCommandAction$1(WriteCommandAction.java:150) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:947) at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$doRunWriteCommandAction$2(WriteCommandAction.java:148) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:210) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:184) at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.doRunWriteCommandAction(WriteCommandAction.java:157) at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.run(WriteCommandAction.java:124) at com.intellij.openapi.command.WriteCommandAction.runWriteCommandAction(WriteCommandAction.java:361) at com.intellij.openapi.command.WriteCommandAction.runWriteCommandAction(WriteCommandAction.java:349) at com.github.leomillon.uuidgenerator.quickfix.IdPlaceholderQuickFix.invoke(IdPlaceholderQuickFix.kt:24) at com.intellij.codeInsight.intention.impl.IntentionActionWithTextCaching$MyIntentionAction.lambda$invoke$0(IntentionActionWithTextCaching.java:229) at com.intellij.util.SlowOperations.allowSlowOperations(SlowOperations.java:147) at com.intellij.codeInsight.intention.impl.IntentionActionWithTextCaching$MyIntentionAction.invoke(IntentionActionWithTextCaching.java:229) at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.lambda$invokeIntention$4(ShowIntentionActionsHandler.java:263) at com.intellij.openapi.application.WriteAction.lambda$run$1(WriteAction.java:86) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:935) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:961) at com.intellij.openapi.application.WriteAction.run(WriteAction.java:85) at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.invokeIntention(ShowIntentionActionsHandler.java:263) at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.lambda$chooseActionAndInvoke$3(ShowIntentionActionsHandler.java:239) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:219) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:174) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:164) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:150) at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.chooseActionAndInvoke(ShowIntentionActionsHandler.java:238) at com.intellij.codeInsight.intention.impl.IntentionListStep.chooseActionAndInvoke(IntentionListStep.java:134) at com.intellij.codeInsight.intention.impl.IntentionListStep.lambda$applyAction$3(IntentionListStep.java:126) at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:94) at com.intellij.ui.popup.AbstractPopup.lambda$dispose$18(AbstractPopup.java:1508) at com.intellij.util.ui.EdtInvocationManager.invokeLaterIfNeeded(EdtInvocationManager.java:101) at com.intellij.ide.IdeEventQueue.ifFocusEventsInTheQueue(IdeEventQueue.java:186) at com.intellij.ide.IdeEventQueue.executeWhenAllFocusEventsLeftTheQueue(IdeEventQueue.java:140) at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:175) at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.doWhenFocusSettlesDown(IdeFocusManagerImpl.java:36) at com.intellij.ui.popup.AbstractPopup.dispose(AbstractPopup.java:1505) at com.intellij.ui.popup.WizardPopup.dispose(WizardPopup.java:164) at com.intellij.ui.popup.list.ListPopupImpl.dispose(ListPopupImpl.java:326) at com.intellij.openapi.util.ObjectTree.runWithTrace(ObjectTree.java:136) at com.intellij.openapi.util.ObjectTree.executeAll(ObjectTree.java:166) at com.intellij.openapi.util.Disposer.dispose(Disposer.java:169) at com.intellij.openapi.util.Disposer.dispose(Disposer.java:157) at com.intellij.ui.popup.WizardPopup.disposeAllParents(WizardPopup.java:268) at com.intellij.ui.popup.list.ListPopupImpl.handleNextStep(ListPopupImpl.java:433) at com.intellij.ui.popup.list.ListPopupImpl._handleSelect(ListPopupImpl.java:405) at com.intellij.ui.popup.list.ListPopupImpl.handleSelect(ListPopupImpl.java:356) at com.intellij.ui.popup.list.ListPopupImpl$1.actionPerformed(ListPopupImpl.java:270) at com.intellij.ui.popup.WizardPopup.proceedKeyEvent(WizardPopup.java:380) at com.intellij.ui.popup.WizardPopup.dispatch(WizardPopup.java:356) at com.intellij.ui.popup.PopupDispatcher.dispatchKeyEvent(PopupDispatcher.java:112) at com.intellij.ui.popup.PopupDispatcher.dispatch(PopupDispatcher.java:148) at com.intellij.ide.IdePopupManager.dispatch(IdePopupManager.java:101) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:724) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:447) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:818) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:446) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:805) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:498) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

leomillon commented 2 years ago

Hi @Noodlex !

Thanks for your feedback, could you please join the content of the file you're currently using (if there is no sensible data in it of course) to replace the placeholder?

As it's a matter of "virtual position in the file" (aka. IntelliJ may collapse lines etc.) it could be useful to see your context.

Noodlex commented 2 years ago

No problem.

V16_5__Add_Role_UserCodeList.txt

Noodlex commented 2 years ago

Hi @Noodlex !

Thanks for your feedback, could you please join the content of the file you're currently using (if there is no sensible data in it of course) to replace the placeholder?

As it's a matter of "virtual position in the file" (aka. IntelliJ may collapse lines etc.) it could be useful to see your context.

Yes, it's about the limit character per line. If, I add some returns, I don't have the problem.

leomillon commented 2 years ago

Oh that's a really useful information! Thx