Class ParserUtil


  • public class ParserUtil
    extends Object
    • Method Detail

      • trimQuotation

        public static String trimQuotation​(String comment)
        Trims the quotation that email clients add Example: On Sun, Nov 20, 2016 at 10:33 PM, wrote:
        Parameters:
        comment - Comment parsed from an email.
        Returns:
        Trimmed comment.
      • isCommentUrl

        public static boolean isCommentUrl​(String str,
                                           String changeUrl,
                                           Comment comment)
        Check if string is an inline comment url on a patch set or the base
      • filePath

        public static String filePath​(String changeUrl,
                                      Comment comment)
        Generate the fully qualified filepath
      • appendOrAddNewComment

        public static void appendOrAddNewComment​(MailComment comment,
                                                 List<MailComment> comments)
        When parsing mail content, we need to append comments prematurely since we are parsing block-by-block and never know what comes next. This can result in a comment being parsed as two comments when it spans multiple blocks. This method takes care of merging those blocks or adding a new comment to the list of appropriate.