/** * Returns the value of the RFC 822 "Date" field. This is the date * on which this message was sent. Returns null if this field is * unavailable or its value is absent. <p> * * This implementation uses the <code>getHeader</code> method * to obtain the requisite header field. * * @return The sent Date * @exception MessagingException for failures */ public Date getSentDate() throws MessagingException { String s = getHeader("Date", null); if (s != null) { try { synchronized (mailDateFormat) { return mailDateFormat.parse(s); } } catch (ParseException pex) { return null; } } return null; }
/** * Returns the value of the RFC 822 "Date" field. This is the date * on which this message was sent. Returns null if this field is * unavailable or its value is absent. <p> * * This implementation uses the <code>getHeader</code> method * to obtain the requisite header field. * * @return The sent Date * @exception MessagingException for failures */ @Override public Date getSentDate() throws MessagingException { String s = getHeader("Date", null); if (s != null) { try { synchronized (mailDateFormat) { return mailDateFormat.parse(s); } } catch (ParseException pex) { return null; } } return null; }
try { synchronized (mailDateFormat) { date = mailDateFormat.parse(s);
try { synchronized (mailDateFormat) { date = mailDateFormat.parse(s);
/** * Constructor. * * @param r the FetchResponse * @exception ParsingException for parsing failures */ public INTERNALDATE(FetchResponse r) throws ParsingException { msgno = r.getNumber(); r.skipSpaces(); String s = r.readString(); if (s == null) throw new ParsingException("INTERNALDATE is NIL"); try { synchronized (mailDateFormat) { date = mailDateFormat.parse(s); } } catch (ParseException pex) { throw new ParsingException("INTERNALDATE parse error"); } }
/** * Constructor. * * @param r the FetchResponse * @exception ParsingException for parsing failures */ public INTERNALDATE(FetchResponse r) throws ParsingException { msgno = r.getNumber(); r.skipSpaces(); String s = r.readString(); if (s == null) throw new ParsingException("INTERNALDATE is NIL"); try { synchronized (mailDateFormat) { date = mailDateFormat.parse(s); } } catch (ParseException pex) { throw new ParsingException("INTERNALDATE parse error"); } }
protected Date getDateFromParam(String inStr) { Date rc = null; try { if (inStr != null && 0 < inStr.length()) { MailDateFormat formatter = new MailDateFormat(); rc = formatter.parse(inStr); } } catch (java.text.ParseException e) { rc = null; } return rc; }
/** * Parse a date from RSS feeds. Uses {@link MailDateFormat} to parse the date. * * @deprecated Use {@link com.atlassian.jira.datetime.DateTimeFormatter#format(java.util.Date)} instead. Since v4.4. * @see #format(java.util.Date) * * @param rssDate RSS date * @return new Date created from the given string * @throws ParseException if string parsing fails * @deprecated Use {@link com.atlassian.jira.datetime.DateTimeFormatter#parse(String)} instead. Since v5.0. */ @Deprecated public static Date parseRss(final String rssDate) throws ParseException { return new MailDateFormat().parse(rssDate); }
/** * Get the value of the "Date" header field. Returns null if * if the field is absent or the date is not in a parseable format. * * @return A Date object parsed according to RFC 822. * @exception MessagingException */ public Date getSentDate() throws MessagingException { String value = getSingleHeader("Date"); if (value == null) { return null; } try { return dateFormat.parse(value); } catch (java.text.ParseException e) { return null; } }
/** * Read a date from a response string. This is expected to be in * Internet Date format, but there's a lot of variation implemented * out there. If we're unable to format this correctly, we'll * just return null. * * @return A Date object created from the source date. */ public Date readDate() throws MessagingException { String value = readString(); try { return dateParser.parse(value); } catch (Exception e) { // we're just skipping over this, so return null return null; } }
/** * Get the value of the "Date" header field. Returns null if * if the field is absent or the date is not in a parseable format. * * @return A Date object parsed according to RFC 822. * @exception MessagingException */ public Date getSentDate() throws MessagingException { String value = getSingleHeader("Date"); if (value == null) { return null; } try { return dateFormat.parse(value); } catch (java.text.ParseException e) { return null; } }
/** * Read a date from a response string. This is expected to be in * Internet Date format, but there's a lot of variation implemented * out there. If we're unable to format this correctly, we'll * just return null. * * @return A Date object created from the source date. */ public Date readDateOrNil() throws MessagingException { String value = readStringOrNil(); // this might be optional if (value == null) { return null; } try { return dateParser.parse(value); } catch (Exception e) { // we're just skipping over this, so return null return null; } }
protected static Date getReceivedDate(final javax.mail.Message message) throws MessagingException { final Date today = new Date(); final String[] received = message.getHeader("received"); if (received != null) { for (final String v : received) { String dateStr = null; try { dateStr = getDateString(v); final Date receivedDate = new MailDateFormat().parse(dateStr); if (!receivedDate.after(today)) { return receivedDate; } } catch (final ParseException e) { // ignore } } } return null; }
private static Date getReceivedDate(javax.mail.Message message) throws MessagingException { Date today = new Date(); final String[] received = message.getHeader("received"); if (received != null) { for (final String v : received) { String dateStr = null; try { dateStr = getDateString(v); final Date receivedDate = new MailDateFormat().parse(dateStr); if (!receivedDate.after(today)) { return receivedDate; } } catch (ParseException e) { // ignore } } } return null; }
/** * Returns the date and time the email was submitted by the user, or <code>null</code> * if the value cannot be parsed. */ public Date getCreateTime() { String dateStr = getProperty(PROPERTY_CREATE_TIME); Date createTime; try { createTime = new MailDateFormat().parse(dateStr); } catch (ParseException e) { log.error("Can't parse create time.", e); createTime = null; } return createTime; }
/** * Constructor */ public INTERNALDATE(FetchResponse r) throws ParsingException { msgno = r.getNumber(); r.skipSpaces(); String s = r.readString(); if (s == null) throw new ParsingException("INTERNALDATE is NIL"); try { date = mailDateFormat.parse(s); } catch (ParseException pex) { throw new ParsingException("INTERNALDATE parse error"); } }
/** * Constructor */ public INTERNALDATE(FetchResponse r) throws ParsingException { msgno = r.getNumber(); r.skipSpaces(); String s = r.readString(); if (s == null) throw new ParsingException("INTERNALDATE is NIL"); try { date = mailDateFormat.parse(s); } catch (ParseException pex) { throw new ParsingException("INTERNALDATE parse error"); } }
/** * Constructor. * * @param r the FetchResponse * @exception ParsingException for parsing failures */ public INTERNALDATE(FetchResponse r) throws ParsingException { msgno = r.getNumber(); r.skipSpaces(); String s = r.readString(); if (s == null) throw new ParsingException("INTERNALDATE is NIL"); try { synchronized (mailDateFormat) { date = mailDateFormat.parse(s); } } catch (ParseException pex) { throw new ParsingException("INTERNALDATE parse error"); } }
/** * Constructor. * * @param r the FetchResponse * @exception ParsingException for parsing failures */ public INTERNALDATE(FetchResponse r) throws ParsingException { msgno = r.getNumber(); r.skipSpaces(); String s = r.readString(); if (s == null) throw new ParsingException("INTERNALDATE is NIL"); try { synchronized (mailDateFormat) { date = mailDateFormat.parse(s); } } catch (ParseException pex) { throw new ParsingException("INTERNALDATE parse error"); } }
/** * Constructor. * * @param r the FetchResponse * @exception ParsingException for parsing failures */ public INTERNALDATE(FetchResponse r) throws ParsingException { msgno = r.getNumber(); r.skipSpaces(); String s = r.readString(); if (s == null) throw new ParsingException("INTERNALDATE is NIL"); try { synchronized (mailDateFormat) { date = mailDateFormat.parse(s); } } catch (ParseException pex) { throw new ParsingException("INTERNALDATE parse error"); } }