private static @Nullable String unescapeString(@Nullable String str) {
    if (str == null) return null;
    StringBuilder builder = new StringBuilder();
    for (int index = 0; index < str.length(); index++) {
      if (str.charAt(index) == '\\') {
        if (index == str.length() - 1) {
          logErrorTestSafe("Invalid escaped string: backslash at the last position");
          LOG.debug(str);
          return null;
        }
        switch (str.charAt(index + 1)) {
          case '\\' -> builder.append('\\');
          case 'n' -> builder.append('\n');
          case 'r' -> builder.append('\r');
          default -> {
            logErrorTestSafe("Invalid character after an escape symbol: " + str.charAt(index + 1));
            LOG.debug(str);
            return null;
          }
        }
        index++;
        continue;
      }
      builder.append(str.charAt(index));
    }
    return builder.toString();
  }
private static @Nullable String unescapeString(@Nullable String str)