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

Exceptions #25

Closed krasa closed 8 years ago

krasa commented 8 years ago

select 2 empty line, shift

String index out of range: 165
java.lang.StringIndexOutOfBoundsException: String index out of range: 165
    at java.lang.String.charAt(String.java:646)
    at com.kstenschke.shifter.utils.UtilsTextual.extractLineAroundOffset(UtilsTextual.java:396)
    at com.kstenschke.shifter.models.ShifterTypesManager.getShiftedWord(ShifterTypesManager.java:273)
    at com.kstenschke.shifter.actions.ActionsPerformer.shiftSelection(ActionsPerformer.java:335)
    at com.kstenschke.shifter.actions.ActionsPerformer.write(ActionsPerformer.java:82)
    at com.kstenschke.shifter.actions.ShiftUpAction$1$1.run(ShiftUpAction.java:55)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1009)
    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:49)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:595)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:646)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.b(IdeKeyEventDispatcher.java:485)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:215)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:631)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:386)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

dunno how to get this one:

null
java.lang.NullPointerException
    at com.kstenschke.shifter.models.shiftertypes.Dictionary.getShifted(Dictionary.java:190)
    at com.kstenschke.shifter.models.ShifterTypesManager.getShiftedWord(ShifterTypesManager.java:224)
    at com.kstenschke.shifter.models.ShiftableWord.getShifted(ShiftableWord.java:89)
    at com.kstenschke.shifter.actions.ActionsPerformer.getShiftedWord(ActionsPerformer.java:207)
    at com.kstenschke.shifter.actions.ActionsPerformer.shiftWordAtCaret(ActionsPerformer.java:145)
    at com.kstenschke.shifter.actions.ActionsPerformer.write(ActionsPerformer.java:92)
    at com.kstenschke.shifter.actions.ShiftUpAction$1$1.run(ShiftUpAction.java:55)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1009)
    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:49)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:595)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:646)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.b(IdeKeyEventDispatcher.java:485)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:215)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:631)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:386)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

select empty line, shift, - it produces some unknown character, shift few times more:

Wrong line separators: '\r' at offset 0
java.lang.AssertionError: Wrong line separators: '\r' at offset 0
    at com.intellij.openapi.diagnostic.DefaultLogger.error(DefaultLogger.java:68)
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:127)
    at com.intellij.openapi.util.text.StringUtil.assertValidSeparators(StringUtil.java:2620)
    at com.intellij.openapi.editor.impl.DocumentImpl.b(DocumentImpl.java:617)
    at com.intellij.openapi.editor.impl.DocumentImpl.a(DocumentImpl.java:542)
    at com.intellij.openapi.editor.impl.DocumentImpl.replaceString(DocumentImpl.java:535)
    at com.kstenschke.shifter.actions.ActionsPerformer.shiftSelection(ActionsPerformer.java:348)
    at com.kstenschke.shifter.actions.ActionsPerformer.write(ActionsPerformer.java:82)
    at com.kstenschke.shifter.actions.ShiftUpAction$1$1.run(ShiftUpAction.java:55)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1009)
    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:49)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:595)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:646)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.b(IdeKeyEventDispatcher.java:485)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:215)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:631)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:386)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.Throwable
    ... 26 more
kstenschke commented 8 years ago

why would you shift an empty line? but thanks for reporting.

krasa commented 8 years ago

why don't you handle edge cases?

kstenschke commented 8 years ago

i do, see 31ab1a6d51ea982879263b14822554d2fe039d98. Feel free to comment other edge cases that happen to you.

krasa commented 8 years ago

another one: image

String index out of range: 4
java.lang.StringIndexOutOfBoundsException: String index out of range: 4
    at java.lang.String.charAt(String.java:686)
    at com.kstenschke.shifter.utils.UtilsTextual.extractLineAroundOffset(UtilsTextual.java:396)
    at com.kstenschke.shifter.models.ShifterTypesManager.getShiftedWord(ShifterTypesManager.java:273)
    at com.kstenschke.shifter.actions.ActionsPerformer.shiftSelection(ActionsPerformer.java:342)
    at com.kstenschke.shifter.actions.ActionsPerformer.write(ActionsPerformer.java:82)
    at com.kstenschke.shifter.actions.ShiftUpAction$1$1.run(ShiftUpAction.java:55)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:931)
    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:49)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:593)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:644)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:483)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:213)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:538)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
kstenschke commented 8 years ago

thanks 👍