private static int getEndMessage()

in gradle-runner-agent/src/main/java/jetbrains/buildServer/gradle/runtime/output/TestOutputParser.java [48:66]


  private static int getEndMessage(@NotNull String msg, int position) {
    char lastChar = 0;
    while (position < msg.length()) {
      char currentChar = msg.charAt(position);
      if (lastChar != ESCAPE_CHARACTER && currentChar == SERVICE_MESSAGE_END.charAt(SERVICE_MESSAGE_END.length() - 1)) {
        return position;
      }
      if (lastChar == ESCAPE_CHARACTER && currentChar == ESCAPE_CHARACTER) {
        lastChar = 0;
      }
      else {
        lastChar = currentChar;
      }

      position++;
    }

    return -1;
  }