Java.sql.SQLException: Incorrect String Value

    Problem

    Error detail:
     java.sql.SQLException: Incorrect string value: '\xF0\x9F\x98\x8A",...' for column 'PAYLOAD'.

    Cause

    Some versions of MySQL don't support emojis in the description or comments of issues, raising exceptions like this.

    Seems you're using the version that doesn't support emojis being saved in the database.

    Solution

    1. Add the following snippet to the Outgoing sync (data filter) and paste it at the end of your script:

      //This will ensure that the issues are synchronized after removing any emojis from the description or comments of the issue.
      import java.util.regex.Pattern
      import java.util.regex.Matcher
       
      String regex = "[\\x{0001f300}-\\x{0001f64f}]|[\\x{0001f680}-\\x{0001f6ff}]"
      Pattern pattern = Pattern.compile(regex, Pattern.UNICODE_CHARACTER_CLASS);
                 
      Matcher descMatcher = pattern.matcher(replica.description);
      if (descMatcher.find()) {
          replica.description = descMatcher.replaceAll("");
      }           
      replica.comments = replica.comments.collect{
        Matcher matcher = pattern.matcher(it.body);
        String result = matcher.replaceAll("");
        it.setBody(result)
        it
      }
    2. Clean up the issue.
      To do this navigate to the Exalate admin console > Clean-up tools tab > Clean-up by issue > input Issue key
    3. Try to synchronize the issue again.