Example usage for org.eclipse.jgit.util GitDateParser parse

List of usage examples for org.eclipse.jgit.util GitDateParser parse

Introduction

In this page you can find the example usage for org.eclipse.jgit.util GitDateParser parse.

Prototype

public static Date parse(String dateStr, Calendar now, Locale locale) throws ParseException 

Source Link

Document

Parses a string into a java.util.Date using the given locale.

Usage

From source file:com.google.gerrit.server.notedb.CommentsInNotesUtil.java

License:Apache License

private static Timestamp parseTimestamp(byte[] note, MutableInteger curr, Change.Id changeId, Charset enc)
        throws ConfigInvalidException {
    int endOfLine = RawParseUtils.nextLF(note, curr.value);
    Timestamp commentTime;/*from   w  w  w . j a v  a  2s  .  co m*/
    String dateString = RawParseUtils.decode(enc, note, curr.value, endOfLine - 1);
    try {
        commentTime = new Timestamp(GitDateParser.parse(dateString, null, Locale.US).getTime());
    } catch (ParseException e) {
        throw new ConfigInvalidException("could not parse comment timestamp", e);
    }
    curr.value = endOfLine;
    return checkResult(commentTime, "comment timestamp", changeId);
}