java.lang.StringIndexOutOfBoundsException

If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.
tip

You need to make sure that capitalisation of the case for the plugin in the
properties file is exactly: "AllocinePlugin" and not "allocineplugin"


rprp
tip

This is a bug when using Micromax devices with VideoView. You can either exclude these devices or look at this workaround: http://stackoverflow.com/a/31942841/4347859

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • Bug in pushdown String
    via GitHub by yossigil
    ,
  • Bug in pushdown String
    via GitHub by yossigil
    ,
  • GitHub comment 474#150932295
    via GitHub by melvinzhang
    ,
  • GitHub comment 52#163535786
    via GitHub by shekmun
    ,
  • String index out of range: -3
    via GitHub by tjons
    ,
  • FULL PRODUCT VERSION : java version "1.8.0_112" Java(TM) SE Runtime Environment (build 1.8.0_112-b15) Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode) ADDITIONAL OS VERSION INFORMATION : Ubuntu 16.04 LTS (4.4.0-53-generic x86_64) A DESCRIPTION OF THE PROBLEM : I get the following exception when programmatically replace text (in specific order) in TextArea: Exception in thread "JavaFX Application Thread" java.lang.StringIndexOutOfBoundsException: String index out of range: -3 at java.lang.String.substring(String.java:1967) at javafx.scene.control.TextInputControl.updateContent(TextInputControl.java:571) at javafx.scene.control.TextInputControl.replaceText(TextInputControl.java:548) at com.test.Text.lambda$1(Text.java:33) at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) at com.sun.glass.ui.gtk.GtkApplication.lambda$null$49(GtkApplication.java:139) at java.lang.Thread.run(Thread.java:745) REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- TextArea txt = new TextArea(); txt.replaceText(0, 0, "a"); txt.replaceText(1, 1, "b"); txt.replaceText(2, 2, "c"); txt.replaceText(3, 3, "d"); txt.replaceText(3, 4, "efg"); txt.replaceText(3, 6, "d"); txt.replaceText(0, 4, ""); ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : TextArea txt = new TextArea(); txt.replaceText(0, 0, "a"); txt.deselect(); txt.selectPositionCaret(1); txt.replaceText(1, 1, "b"); txt.deselect(); txt.selectPositionCaret(2); txt.replaceText(2, 2, "c"); txt.deselect(); txt.selectPositionCaret(3); txt.replaceText(3, 3, "d"); txt.deselect(); txt.selectPositionCaret(3); txt.replaceText(3, 4, "efg"); txt.deselect(); txt.selectPositionCaret(3); txt.replaceText(3, 6, "d"); txt.deselect(); txt.selectPositionCaret(0); txt.replaceText(0, 4, "");
    via by Webbug Group,
    • java.lang.StringIndexOutOfBoundsException: String index out of range: -3 at java.lang.String.substring(String.java:1967) at il.org.spartan.spartanizer.wrings.TernaryPusdownStrings.getPrefix(TernaryPusdownStrings.java:68) at il.org.spartan.spartanizer.wrings.TernaryPusdownStrings.replaceSuffix(TernaryPusdownStrings.java:127) at il.org.spartan.spartanizer.wrings.TernaryPusdownStrings.simplifyStrings(TernaryPusdownStrings.java:207) at il.org.spartan.spartanizer.wrings.TernaryPusdownStrings.simplify(TernaryPusdownStrings.java:137) at il.org.spartan.spartanizer.wrings.TernaryPusdownStrings.replacement(TernaryPusdownStrings.java:36) at il.org.spartan.spartanizer.wrings.TernaryPusdownStrings.replacement(TernaryPusdownStrings.java:218) at il.org.spartan.spartanizer.wrings.TernaryPusdownStrings.replacement(TernaryPusdownStrings.java:1) at il.org.spartan.spartanizer.wringing.ReplaceCurrentNode.suggest(ReplaceCurrentNode.java:19) at il.org.spartan.spartanizer.wringing.CarefulWring.canSuggest(CarefulWring.java:12) at il.org.spartan.spartanizer.wringing.CarefulWring.demandsToSuggestButPerhapsCant(CarefulWring.java:16) at il.org.spartan.spartanizer.dispatch.Toolbox.find(Toolbox.java:205) at il.org.spartan.spartanizer.dispatch.Toolbox.find(Toolbox.java:217) at il.org.spartan.spartanizer.dispatch.Trimmer$2.go(Trimmer.java:66) at il.org.spartan.spartanizer.dispatch.DispatchingVisitor.cautiousGo(DispatchingVisitor.java:119) at il.org.spartan.spartanizer.dispatch.DispatchingVisitor.visit(DispatchingVisitor.java:33) at org.eclipse.jdt.core.dom.ConditionalExpression.accept0(ConditionalExpression.java:187) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711) at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2759) at org.eclipse.jdt.core.dom.ReturnStatement.accept0(ReturnStatement.java:137) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711) at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2782) at org.eclipse.jdt.core.dom.Block.accept0(Block.java:137) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711) at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2759) at org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:635) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711) at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2782) at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:470) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711) at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2782) at org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:212) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711) at il.org.spartan.plugin.GUI$Applicator.collectSuggesions(GUI$Applicator.java:113) at il.org.spartan.plugin.Builder.addMarkers(Builder.java:77) at il.org.spartan.plugin.Builder.addMarkers(Builder.java:72) at il.org.spartan.plugin.Builder.addMarkers(Builder.java:56) at il.org.spartan.plugin.Builder.lambda$0(Builder.java:49) at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:64) at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:75) at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:75) at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:75) at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:75) at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:75) at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:75) at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:75) at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:75) at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:48) at il.org.spartan.plugin.Builder.incrementalBuild(Builder.java:44) at il.org.spartan.plugin.Builder.build(Builder.java:113) at il.org.spartan.plugin.Builder.build(Builder.java:121) at il.org.spartan.plugin.Builder.build(Builder.java:91) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:735) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246) at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:301) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:304) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:360) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:383) at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144) at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

    Users with the same issue

    harshgharshg
    4 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    zsambokizsamboki
    1 times, last one,
    osvzsosvzs
    7 times, last one,
    92 more bugmates