question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

phpStorm exception - java.lang.StringIndexOutOfBoundsException: String index out of range: 0

See original GitHub issue

Describe the bug (*)

PhpStorm Error Notification

java.lang.StringIndexOutOfBoundsException: String index out of range: 0
	at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:47)
	at java.base/java.lang.String.charAt(String.java:693)
	at com.magento.idea.magento2plugin.inspections.php.PluginInspection$1.getTargetMethodName(PluginInspection.java:323)
	at com.magento.idea.magento2plugin.inspections.php.PluginInspection$1.visitPhpMethod(PluginInspection.java:93)
	at com.jetbrains.php.lang.psi.elements.impl.MethodImpl.accept(MethodImpl.java:93)
	at com.jetbrains.php.lang.psi.elements.impl.PhpPsiElementImpl.accept(PhpPsiElementImpl.java:73)
	at com.intellij.codeInspection.InspectionEngine.acceptElements(InspectionEngine.java:65)
	at com.intellij.codeInspection.InspectionEngine.createVisitorAndAcceptElements(InspectionEngine.java:56)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.runToolOnElements(LocalInspectionsPass.java:294)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitPriorityElementsAndInit$3(LocalInspectionsPass.java:263)
	at com.intellij.util.AstLoadingFilter.forceAllowTreeLoading(AstLoadingFilter.java:155)
	at com.intellij.util.AstLoadingFilter.forceAllowTreeLoading(AstLoadingFilter.java:147)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitPriorityElementsAndInit$4(LocalInspectionsPass.java:262)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:126)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:115)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitPriorityElementsAndInit$5(LocalInspectionsPass.java:262)
	at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:149)
	at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:162)
	at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:162)
	at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:162)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1110)
	at com.intellij.concurrency.ApplierCompleter.lambda$wrapInReadActionAndIndicator$1(ApplierCompleter.java:105)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:629)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:581)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
	at com.intellij.concurrency.ApplierCompleter.wrapInReadActionAndIndicator(ApplierCompleter.java:117)
	at com.intellij.concurrency.ApplierCompleter.lambda$compute$0(ApplierCompleter.java:96)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:170)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:182)
	at com.intellij.concurrency.ApplierCompleter.compute(ApplierCompleter.java:96)
	at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

To Reproduce (*)

Steps to reproduce the behavior:

  1. There is not specific conditions for reproduce this issue.

Expected behavior (*)

Works without any errors)

Screenshots

image

Please complete the following information: (*)

  • OS: Ubuntu 20.04.1 LTS
  • PhpStorm 2020.2.2 Build #PS-202.7319.77, built on September 23, 2020
  • Plugin Version - 1.0.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
bohdan-harniukcommented, Nov 30, 2021

Hello!

It is already fixed in the scope of #798. The fix will be delivered in the next bug-fix release (4.2.1).

cc. @gnysek, @VitaliyBoyko, @phpWebStudio.

Thanks, Bohdan

0reactions
gnysekcommented, Aug 26, 2021

I’m also getting com.magento.idea.magento2plugin.actions.CopyMagentoPath.getIndexOf(CopyMagentoPath.java:82), Phpstorm 2021.2 (newest, even if integration isn’t enabled for current project)

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.StringIndexOutOfBoundsException: String index out ...
It seems pretty clear why you would get an index out of bounds exception, seeing as when i is length - 1, j...
Read more >
String index out of range: -287 : SCL-964 - YouTrack - JetBrains
java.lang.StringIndexOutOfBoundsException: String index out of range: -287 ; Project, Scala ; Subsystem, No Subsystem ; Type, Exception ; Priority, Normal N.
Read more >
STRING INDEX OUT OF RANGE: 0 AT TEST GENERATION
ACTUAL BEHAVIOR : The test generation fails with an exception of type : ava.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.
Read more >
StringIndexOutOfBoundsException: String index out of range ...
The following code below leads to throwing "java.lang.StringIndexOutOfBoundsException: String index out of range: 0" JDK7 b70 - PASSES JDK7 b73 - FAILS JDK7 ......
Read more >
String index out of range: 0” when workflow engine is not ...
ERROR : “java.lang.StringIndexOutOfBoundsException: String index out of range: 0” when workflow engine is not starting in 10.1.1 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found