StringIndexOutOfBoundsException possibly caused by IntelliLang

I got this error while navigating around a file with extensive use of
regular expressions.  The error reporting dialog told me to blame
IntelliLang, so I guess I will :)


String index out of range: -33
java.lang.StringIndexOutOfBoundsException: String index out of range: -33
     at java.lang.String.substring(String.java:1768)
     at
com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil$1.visitLeaf(InjectedLanguageUtil.java:3)
     at
com.intellij.psi.impl.source.tree.LeafElement.acceptTree(LeafElement.java:44)
     at
com.intellij.psi.impl.source.tree.RecursiveTreeElementVisitor.visitComposite(RecursiveTreeElementVisitor.java:0)
     at
com.intellij.psi.impl.source.tree.CompositeElement.acceptTree(CompositeElement.java:241)
     at
com.intellij.psi.impl.source.tree.RecursiveTreeElementVisitor.visitComposite(RecursiveTreeElementVisitor.java:0)
     at
com.intellij.psi.impl.source.tree.CompositeElement.acceptTree(CompositeElement.java:241)
     at
com.intellij.psi.impl.source.tree.RecursiveTreeElementVisitor.visitComposite(RecursiveTreeElementVisitor.java:0)
     at
com.intellij.psi.impl.source.tree.CompositeElement.acceptTree(CompositeElement.java:241)
     at
com.intellij.psi.impl.source.tree.RecursiveTreeElementVisitor.visitComposite(RecursiveTreeElementVisitor.java:0)
     at
com.intellij.psi.impl.source.tree.CompositeElement.acceptTree(CompositeElement.java:241)
     at
com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil.a(InjectedLanguageUtil.java:167)
     at
com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil.a(InjectedLanguageUtil.java:88)
     at
com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil.access$300(InjectedLanguageUtil.java:120)
     at
com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil$InjectedPsiProvider$1.addPlace(InjectedLanguageUtil.java:3)
     at
org.intellij.plugins.intelliLang.inject.CustomLanguageInjector$MyLanguageInjector.getLanguagesToInject(CustomLanguageInjector.java:285)
     at
com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil$InjectedPsiProvider.b(InjectedLanguageUtil.java:19)
     at
com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil$InjectedPsiProvider.compute(InjectedLanguageUtil.java:28)
     at com.intellij.psi.impl.CachedValueImpl.getValue(CachedValueImpl.java:3)
     at
com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil.getInjectedPsiFiles(InjectedLanguageUtil.java:72)
     at
com.intellij.psi.impl.source.tree.java.PsiLiteralExpressionImpl.getInjectedPsi(PsiLiteralExpressionImpl.java:200)
     at
com.intellij.codeInsight.daemon.impl.analysis.HighlightVisitorImpl.a(HighlightVisitorImpl.java:449)
     at
com.intellij.codeInsight.daemon.impl.analysis.HighlightVisitorImpl.visitElement(HighlightVisitorImpl.java:514)
     at
com.intellij.psi.JavaElementVisitor.visitExpression(JavaElementVisitor.java:120)
     at
com.intellij.codeInsight.daemon.impl.analysis.HighlightVisitorImpl.visitExpression(HighlightVisitorImpl.java:485)
     at
com.intellij.psi.JavaElementVisitor.visitLiteralExpression(JavaElementVisitor.java:192)
     at
com.intellij.codeInsight.daemon.impl.analysis.HighlightVisitorImpl.visitLiteralExpression(HighlightVisitorImpl.java:112)
     at
com.intellij.psi.impl.source.tree.java.PsiLiteralExpressionImpl.accept(PsiLiteralExpressionImpl.java:101)
     at
com.intellij.codeInsight.daemon.impl.analysis.HighlightVisitorImpl.visit(HighlightVisitorImpl.java:454)
     at
com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.a(GeneralHighlightingPass.java:147)
     at
com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.doCollectInformation(GeneralHighlightingPass.java:2)
     at
com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:59)
     at
com.intellij.codeInsight.daemon.impl.UpdateThread$2.run(UpdateThread.java:11)
     at
com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:324)
     at
com.intellij.codeInsight.daemon.impl.UpdateThread.a(UpdateThread.java:36)
     at
com.intellij.codeInsight.daemon.impl.UpdateThread.access$100(UpdateThread.java:23)
     at
com.intellij.codeInsight.daemon.impl.UpdateThread$1.run(UpdateThread.java:1)
     at
com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:86)
     at
com.intellij.codeInsight.daemon.impl.UpdateThread.run(UpdateThread.java:13)

2 comments

Hello Jonas,

the exception comes deep from the IDEA core and there's very little the plugin
can do wrong at this point. Actually the stacktrace is quite the same as the one
I reported here: http://www.jetbrains.net/jira/browse/IDEA-10143

What kind of file were you browsing? Java-code or XML? It might help if you
could create a small example that can be used to reproduce the crash.

Sascha

Jonas Kvarnström wrote:

I got this error while navigating around a file with extensive use of
regular expressions.  The error reporting dialog told me to blame
IntelliLang, so I guess I will :)


String index out of range: -33
java.lang.StringIndexOutOfBoundsException: String index out of range: -33
    at java.lang.String.substring(String.java:1768)
    at
com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil$1.visitLeaf(InjectedLanguageUtil.java:3)

    at
com.intellij.psi.impl.source.tree.LeafElement.acceptTree(LeafElement.java:44)

    at
com.intellij.psi.impl.source.tree.RecursiveTreeElementVisitor.visitComposite(RecursiveTreeElementVisitor.java:0)

    at
com.intellij.psi.impl.source.tree.CompositeElement.acceptTree(CompositeElement.java:241)

    at
com.intellij.psi.impl.source.tree.RecursiveTreeElementVisitor.visitComposite(RecursiveTreeElementVisitor.java:0)

    at
com.intellij.psi.impl.source.tree.CompositeElement.acceptTree(CompositeElement.java:241)

    at
com.intellij.psi.impl.source.tree.RecursiveTreeElementVisitor.visitComposite(RecursiveTreeElementVisitor.java:0)

    at
com.intellij.psi.impl.source.tree.CompositeElement.acceptTree(CompositeElement.java:241)

    at
com.intellij.psi.impl.source.tree.RecursiveTreeElementVisitor.visitComposite(RecursiveTreeElementVisitor.java:0)

    at
com.intellij.psi.impl.source.tree.CompositeElement.acceptTree(CompositeElement.java:241)

    at
com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil.a(InjectedLanguageUtil.java:167)

    at
com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil.a(InjectedLanguageUtil.java:88)

    at
com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil.access$300(InjectedLanguageUtil.java:120)

    at
com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil$InjectedPsiProvider$1.addPlace(InjectedLanguageUtil.java:3)

    at
org.intellij.plugins.intelliLang.inject.CustomLanguageInjector$MyLanguageInjector.getLanguagesToInject(CustomLanguageInjector.java:285)

    at
com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil$InjectedPsiProvider.b(InjectedLanguageUtil.java:19)

    at
com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil$InjectedPsiProvider.compute(InjectedLanguageUtil.java:28)

    at
com.intellij.psi.impl.CachedValueImpl.getValue(CachedValueImpl.java:3)
    at
com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil.getInjectedPsiFiles(InjectedLanguageUtil.java:72)

    at
com.intellij.psi.impl.source.tree.java.PsiLiteralExpressionImpl.getInjectedPsi(PsiLiteralExpressionImpl.java:200)

    at
com.intellij.codeInsight.daemon.impl.analysis.HighlightVisitorImpl.a(HighlightVisitorImpl.java:449)

    at
com.intellij.codeInsight.daemon.impl.analysis.HighlightVisitorImpl.visitElement(HighlightVisitorImpl.java:514)

    at
com.intellij.psi.JavaElementVisitor.visitExpression(JavaElementVisitor.java:120)

    at
com.intellij.codeInsight.daemon.impl.analysis.HighlightVisitorImpl.visitExpression(HighlightVisitorImpl.java:485)

    at
com.intellij.psi.JavaElementVisitor.visitLiteralExpression(JavaElementVisitor.java:192)

    at
com.intellij.codeInsight.daemon.impl.analysis.HighlightVisitorImpl.visitLiteralExpression(HighlightVisitorImpl.java:112)

    at
com.intellij.psi.impl.source.tree.java.PsiLiteralExpressionImpl.accept(PsiLiteralExpressionImpl.java:101)

    at
com.intellij.codeInsight.daemon.impl.analysis.HighlightVisitorImpl.visit(HighlightVisitorImpl.java:454)

    at
com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.a(GeneralHighlightingPass.java:147)

    at
com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.doCollectInformation(GeneralHighlightingPass.java:2)

    at
com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:59)

    at
com.intellij.codeInsight.daemon.impl.UpdateThread$2.run(UpdateThread.java:11)

    at
com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:324)

    at
com.intellij.codeInsight.daemon.impl.UpdateThread.a(UpdateThread.java:36)
    at
com.intellij.codeInsight.daemon.impl.UpdateThread.access$100(UpdateThread.java:23)

    at
com.intellij.codeInsight.daemon.impl.UpdateThread$1.run(UpdateThread.java:1)

    at
com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:86)

    at
com.intellij.codeInsight.daemon.impl.UpdateThread.run(UpdateThread.java:13)

0

Sascha Weinreuter wrote:

Hello Jonas,

the exception comes deep from the IDEA core and there's very little the plugin
can do wrong at this point. Actually the stacktrace is quite the same as the one
I reported here: http://www.jetbrains.net/jira/browse/IDEA-10143


Yes, I assumed something like that might be the case and maybe
IntelliLang only got blamed because it was part of the stack trace.

I was browsing a Java file which had quite a lot of regular expressions.
  I'd like to help you more, but I haven't reproduced the error and I'm
not sure whether I can.

0

Please sign in to leave a comment.