redpen-cc / redpen-intellij-plugin

RedPen plugin for Intellij IDEA and other JetBrains IDEs
https://plugins.jetbrains.com/plugin/8210
Apache License 2.0
18 stars 1 forks source link

ArrayIndexOutOfBoundsException occurs on parsing empty documents #1

Closed alterakey closed 8 years ago

alterakey commented 8 years ago

Hello, I've found that ArrayIndexOutOfBoundsException occuring on parse of empty documents.

Best, -t

Stack trace:

0
java.lang.ArrayIndexOutOfBoundsException: 0
    at cc.redpen.intellij.RedPenInspection.checkFile(RedPenInspection.kt:49)
    at com.intellij.codeInspection.LocalInspectionTool$1.visitFile(LocalInspectionTool.java:156)
    at com.intellij.extapi.psi.PsiFileBase.accept(PsiFileBase.java:70)
    at com.intellij.codeInspection.InspectionEngine.acceptElements(InspectionEngine.java:81)
    at com.intellij.codeInspection.InspectionEngine.createVisitorAndAcceptElements(InspectionEngine.java:69)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.runToolOnElements(LocalInspectionsPass.java:294)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.access$200(LocalInspectionsPass.java:73)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$2.process(LocalInspectionsPass.java:261)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$2.process(LocalInspectionsPass.java:256)
    at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:122)
    at com.intellij.concurrency.ApplierCompleter.tryToExecAllList(ApplierCompleter.java:211)
    at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:140)
    at com.intellij.concurrency.ApplierCompleter.access$000(ApplierCompleter.java:44)
    at com.intellij.concurrency.ApplierCompleter$1.run(ApplierCompleter.java:85)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1177)
    at com.intellij.concurrency.ApplierCompleter$2.run(ApplierCompleter.java:94)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:446)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:443)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
    at com.intellij.concurrency.ApplierCompleter.wrapInReadActionAndIndicator(ApplierCompleter.java:106)
    at com.intellij.concurrency.ApplierCompleter.compute(ApplierCompleter.java:82)
    at jsr166e.CountedCompleter.exec(CountedCompleter.java:684)
    at jsr166e.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at jsr166e.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:858)
    at jsr166e.ForkJoinPool.scan(ForkJoinPool.java:1687)
    at jsr166e.ForkJoinPool.runWorker(ForkJoinPool.java:1642)
    at jsr166e.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:108)
takahi-i commented 8 years ago

:+1:

takahi-i commented 8 years ago

Fixed with #2