sbt / util

util modules for sbt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ConsoleLogger.removeEscapeSequences throws StringIndexOutOfBoundsException

dwijnand opened this issue · comments

From https://travis-ci.org/sbt/util/jobs/189181474#L849:

[info] ! Escapes.No escape characters remain after removeEscapeSequences: Exception raised on property evaluation.
[info] > ARG_0: "\u001b"
[info] > ARG_0_ORIGINAL: "㫅ᜨ㭾\u001b"
[info] > Exception: java.lang.StringIndexOutOfBoundsException: String index out of range: 1

Reproduced in the REPL:

> utilLogging/console
[info] Starting scala interpreter...
[info]
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions for evaluation. Or try :help.

scala> sbt.internal.util.ConsoleLogger.removeEscapeSequences("㫅ᜨ㭾\u001b")
java.lang.StringIndexOutOfBoundsException: String index out of range: 4
  at java.lang.String.charAt(String.java:658)
  at sbt.internal.util.ConsoleLogger$.nextESC(ConsoleLogger.scala:75)
  at sbt.internal.util.ConsoleLogger$.removeEscapeSequences(ConsoleLogger.scala:63)
  ... 42 elided

Actually the real reproduction is

scala> sbt.internal.util.ConsoleLogger.removeEscapeSequences("\u001b")
java.lang.StringIndexOutOfBoundsException: String index out of range: 1
  at java.lang.String.charAt(String.java:658)
  at sbt.internal.util.ConsoleLogger$.nextESC(ConsoleLogger.scala:75)
  at sbt.internal.util.ConsoleLogger$.removeEscapeSequences(ConsoleLogger.scala:63)
  ... 42 elided