public static String preprocess(String literal) {
    if (literal == null) {
      return null;
    }

    StringBuilder sb = new StringBuilder(literal.length() - 2);

    for (int i = 1; i < literal.length() - 1; i++) {
      char ch = literal.charAt(i);
      if (ch == '\\') {
        if (i >= literal.length() - 2) {
          throw new IllegalArgumentException("Invalid escaped literal string: " + literal);
        }
        char next = literal.charAt(++i);
        switch (next) {
          case 'b':
            ch = '\b';
            break;
          case 'n':
            ch = '\n';
            break;
          case 't':
            ch = '\t';
            break;
          case 'f':
            ch = '\f';
            break;
          case 'r':
            ch = '\r';
            break;
          case '\\':
            ch = '\\';
            break;
          case '\"':
            ch = '\"';
            break;
          case '\'':
            ch = '\'';
            break;
          default:
            throw new IllegalArgumentException("Invalid escaped literal string: " + literal);
        }
      }
      sb.append(ch);
    }
    return sb.toString();
  }
@Test(expected = IllegalArgumentException.class)
  public void preprocessWrongStr() {
    SelTypeUtil.preprocess("\"\\\"");
  }