kstenschke / shifter-plugin

Intelligent string/code manipulation plugin for Jetbrains IDEs: Detects shiftable type of word/line/selection and manipulates it on keyboard shortcut
http://plugins.jetbrains.com/plugin/6149
Apache License 2.0
107 stars 13 forks source link

StringIndexOutOfBoundsException: String index out of range: -1 #17

Closed halilim closed 9 years ago

halilim commented 9 years ago

Happened as soon as I've clicked on a project on the project list in the main screen (before indexing completed).

OS X 10.10.1 PhpStorm 8.0.2 Shifter 1.2.6

String index out of range: -1
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.charAt(String.java:686)
    at com.kstenschke.shifter.utils.UtilsLinesList$DelimiterDetector.<init>(UtilsLinesList.java:81)
    at com.kstenschke.shifter.actions.ActionsPerformer.sortLines(ActionsPerformer.java:343)
    at com.kstenschke.shifter.actions.ActionsPerformer.sortLinesInDocument(ActionsPerformer.java:330)
    at com.kstenschke.shifter.actions.ActionsPerformer.shiftSelection(ActionsPerformer.java:278)
    at com.kstenschke.shifter.actions.ActionsPerformer.write(ActionsPerformer.java:80)
    at com.kstenschke.shifter.actions.ShiftUpAction$1$1.run(ShiftUpAction.java:54)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:974)
    at com.kstenschke.shifter.actions.ShiftUpAction$1.run(ShiftUpAction.java:52)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:85)
    at com.kstenschke.shifter.actions.ShiftUpAction.actionPerformed(ShiftUpAction.java:50)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:614)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:663)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.d(IdeKeyEventDispatcher.java:513)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:211)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:546)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:384)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.charAt(String.java:686)
    at com.kstenschke.shifter.utils.UtilsLinesList$DelimiterDetector.<init>(UtilsLinesList.java:81)
    at com.kstenschke.shifter.actions.ActionsPerformer.sortLines(ActionsPerformer.java:343)
    at com.kstenschke.shifter.actions.ActionsPerformer.sortLinesInDocument(ActionsPerformer.java:330)
    at com.kstenschke.shifter.actions.ActionsPerformer.shiftSelection(ActionsPerformer.java:278)
    at com.kstenschke.shifter.actions.ActionsPerformer.write(ActionsPerformer.java:80)
    at com.kstenschke.shifter.actions.ShiftUpAction$1$1.run(ShiftUpAction.java:54)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:974)
    at com.kstenschke.shifter.actions.ShiftUpAction$1.run(ShiftUpAction.java:52)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:85)
    at com.kstenschke.shifter.actions.ShiftUpAction.actionPerformed(ShiftUpAction.java:50)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:614)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:663)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.d(IdeKeyEventDispatcher.java:513)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:211)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:546)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:384)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.charAt(String.java:686)
    at com.kstenschke.shifter.utils.UtilsLinesList$DelimiterDetector.<init>(UtilsLinesList.java:81)
    at com.kstenschke.shifter.actions.ActionsPerformer.sortLines(ActionsPerformer.java:343)
    at com.kstenschke.shifter.actions.ActionsPerformer.sortLinesInDocument(ActionsPerformer.java:330)
    at com.kstenschke.shifter.actions.ActionsPerformer.shiftSelection(ActionsPerformer.java:278)
    at com.kstenschke.shifter.actions.ActionsPerformer.write(ActionsPerformer.java:80)
    at com.kstenschke.shifter.actions.ShiftUpAction$1$1.run(ShiftUpAction.java:54)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:974)
    at com.kstenschke.shifter.actions.ShiftUpAction$1.run(ShiftUpAction.java:52)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:85)
    at com.kstenschke.shifter.actions.ShiftUpAction.actionPerformed(ShiftUpAction.java:50)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:614)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:663)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.d(IdeKeyEventDispatcher.java:513)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:211)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:546)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:384)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
kstenschke commented 9 years ago

Hi Halil, thank you for reporting this issue. the bug should be fixed with commit https://github.com/kstenschke/shifter-plugin/commit/872ec8535ac380e39550ffb7449a66bd6b9034d5 and will be published with the next release. P.S: If you like shifter, please give it a vote at the repository page at https://plugins.jetbrains.com/plugin/6149 ;)

halilim commented 9 years ago

OK, thanks for the plugin :)