Codota Logo
DateUtil$DateParseException
Code IndexAdd Codota to your IDE (free)

How to use
DateUtil$DateParseException
in
freemarker.template.utility

Best Java code snippets using freemarker.template.utility.DateUtil$DateParseException (Showing top 20 results out of 315)

  • Common ways to obtain DateUtil$DateParseException
private void myMethod () {
DateUtil$DateParseException d =
  • Codota Iconnew DateParseException("Hour 24 is only allowed in the case of " + "midnight.")
  • Codota IconString message;new DateParseException(message)
  • Codota Iconnew DateParseException("Date calculation faliure. " + "Probably the date is formally correct, but refers " + "to an unexistent date (like February 30).")
  • Smart code suggestions by Codota
}
origin: org.freemarker/freemarker

/**
 * Parses the time zone part from a W3C XML Schema date/time/dateTime. 
 * @throws DateParseException if the zone is malformed.
 */
public static TimeZone parseXSTimeZone(String timeZoneStr)
    throws DateParseException {
  Matcher m = PATTERN_XS_TIME_ZONE.matcher(timeZoneStr);
  if (!m.matches()) {
    throw new DateParseException(
        "The time zone offset didn't match the expected pattern: " + PATTERN_XS_TIME_ZONE);
  }
  return parseMatchingTimeZone(timeZoneStr, null);
}
origin: org.freemarker/freemarker-gae

/**
 * Parses the time zone part from a W3C XML Schema date/time/dateTime. 
 * @throws DateParseException if the zone is malformed.
 */
public static TimeZone parseXSTimeZone(String timeZoneStr)
    throws DateParseException {
  Matcher m = PATTERN_XS_TIME_ZONE.matcher(timeZoneStr);
  if (!m.matches()) {
    throw new DateParseException(
        "The time zone offset didn't match the expected pattern: " + PATTERN_XS_TIME_ZONE);
  }
  return parseMatchingTimeZone(timeZoneStr, null);
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

/**
 * Parses the time zone part from a W3C XML Schema date/time/dateTime. 
 * @throws DateParseException if the zone is malformed.
 */
public static TimeZone parseXSTimeZone(String timeZoneStr)
    throws DateParseException {
  Matcher m = PATTERN_XS_TIME_ZONE.matcher(timeZoneStr);
  if (!m.matches()) {
    throw new DateParseException(
        "The time zone offset didn't match the expected pattern: " + PATTERN_XS_TIME_ZONE);
  }
  return parseMatchingTimeZone(timeZoneStr, null);
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

/**
 * Same as {@link #parseXSTime(String, TimeZone, CalendarFieldsToDateConverter)} but for ISO 8601 times.
 */
public static Date parseISO8601Time(
    String timeStr, TimeZone defaultTZ, CalendarFieldsToDateConverter calToDateConverter) 
    throws DateParseException {
  Matcher m = PATTERN_ISO8601_EXTENDED_TIME.matcher(timeStr);
  if (!m.matches()) {
    m = PATTERN_ISO8601_BASIC_TIME.matcher(timeStr);
    if (!m.matches()) {
      throw new DateParseException("The value didn't match the expected pattern: "
            + PATTERN_ISO8601_EXTENDED_TIME + " or "
            + PATTERN_ISO8601_BASIC_TIME);
    }
  }
  return parseTime_parseMatcher(m, defaultTZ, calToDateConverter);
}
 
origin: org.freemarker/freemarker-gae

/**
 * Same as {@link #parseXSDateTime(String, TimeZone, CalendarFieldsToDateConverter)} but for ISO 8601 format. 
 */
public static Date parseISO8601DateTime(
    String dateTimeStr, TimeZone defaultTZ, CalendarFieldsToDateConverter calToDateConverter) 
    throws DateParseException {
  Matcher m = PATTERN_ISO8601_EXTENDED_DATE_TIME.matcher(dateTimeStr);
  if (!m.matches()) {
    m = PATTERN_ISO8601_BASIC_DATE_TIME.matcher(dateTimeStr);
    if (!m.matches()) {
      throw new DateParseException("The value (" + dateTimeStr + ") didn't match the expected pattern: "
            + PATTERN_ISO8601_EXTENDED_DATE_TIME + " or "
            + PATTERN_ISO8601_BASIC_DATE_TIME);
    }
  }
  return parseDateTime_parseMatcher(
      m, defaultTZ, false, calToDateConverter);
}
 
origin: org.freemarker/freemarker-gae

/**
 * Parses an W3C XML Schema time string (not date or date-time).
 * If the time string doesn't specify the time zone offset explicitly,
 * the value of the {@code defaultTZ} paramter will be used. 
 */  
public static Date parseXSTime(
    String timeStr, TimeZone defaultTZ, CalendarFieldsToDateConverter calToDateConverter) 
    throws DateParseException {
  Matcher m = PATTERN_XS_TIME.matcher(timeStr);
  if (!m.matches()) {
    throw new DateParseException("The value didn't match the expected pattern: " + PATTERN_XS_TIME);
  }
  return parseTime_parseMatcher(m, defaultTZ, calToDateConverter);
}
origin: org.freemarker/freemarker-gae

/**
 * Same as {@link #parseXSTime(String, TimeZone, CalendarFieldsToDateConverter)} but for ISO 8601 times.
 */
public static Date parseISO8601Time(
    String timeStr, TimeZone defaultTZ, CalendarFieldsToDateConverter calToDateConverter) 
    throws DateParseException {
  Matcher m = PATTERN_ISO8601_EXTENDED_TIME.matcher(timeStr);
  if (!m.matches()) {
    m = PATTERN_ISO8601_BASIC_TIME.matcher(timeStr);
    if (!m.matches()) {
      throw new DateParseException("The value didn't match the expected pattern: "
            + PATTERN_ISO8601_EXTENDED_TIME + " or "
            + PATTERN_ISO8601_BASIC_TIME);
    }
  }
  return parseTime_parseMatcher(m, defaultTZ, calToDateConverter);
}
 
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

/**
 * Same as {@link #parseXSDate(String, TimeZone, CalendarFieldsToDateConverter)}, but for ISO 8601 dates.
 */
public static Date parseISO8601Date(
    String dateStr, TimeZone defaultTimeZone,
    CalendarFieldsToDateConverter calToDateConverter) 
    throws DateParseException {
  Matcher m = PATTERN_ISO8601_EXTENDED_DATE.matcher(dateStr);
  if (!m.matches()) {
    m = PATTERN_ISO8601_BASIC_DATE.matcher(dateStr);
    if (!m.matches()) {
      throw new DateParseException("The value didn't match the expected pattern: "
            + PATTERN_ISO8601_EXTENDED_DATE + " or "
            + PATTERN_ISO8601_BASIC_DATE);
    }
  }
  return parseDate_parseMatcher(
      m, defaultTimeZone, false, calToDateConverter);
}
 
origin: org.freemarker/freemarker-gae

/**
 * Same as {@link #parseXSDate(String, TimeZone, CalendarFieldsToDateConverter)}, but for ISO 8601 dates.
 */
public static Date parseISO8601Date(
    String dateStr, TimeZone defaultTimeZone,
    CalendarFieldsToDateConverter calToDateConverter) 
    throws DateParseException {
  Matcher m = PATTERN_ISO8601_EXTENDED_DATE.matcher(dateStr);
  if (!m.matches()) {
    m = PATTERN_ISO8601_BASIC_DATE.matcher(dateStr);
    if (!m.matches()) {
      throw new DateParseException("The value didn't match the expected pattern: "
            + PATTERN_ISO8601_EXTENDED_DATE + " or "
            + PATTERN_ISO8601_BASIC_DATE);
    }
  }
  return parseDate_parseMatcher(
      m, defaultTimeZone, false, calToDateConverter);
}
 
origin: org.freemarker/freemarker-gae

@Override
@SuppressFBWarnings(value = "RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN",
    justification = "Known to use the singleton Boolean-s only")
public final Date parse(String s, int dateType) throws UnparsableValueException {
  CalendarFieldsToDateConverter calToDateConverter = factory.getCalendarFieldsToDateCalculator(env);
  TimeZone tz = forceUTC != Boolean.FALSE ? DateUtil.UTC : timeZone;
  try {
    if (dateType == TemplateDateModel.DATE) {
      return parseDate(s, tz, calToDateConverter);
    } else if (dateType == TemplateDateModel.TIME) {
      return parseTime(s, tz, calToDateConverter);
    } else if (dateType == TemplateDateModel.DATETIME) {
      return parseDateTime(s, tz, calToDateConverter);
    } else {
      throw new BugException("Unexpected date type: " + dateType);
    }
  } catch (DateParseException e) {
    throw new UnparsableValueException(e.getMessage(), e);
  }
}
 
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

@Override
@SuppressFBWarnings(value = "RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN",
    justification = "Known to use the singleton Boolean-s only")
public final Date parse(String s, int dateType) throws UnparsableValueException {
  CalendarFieldsToDateConverter calToDateConverter = factory.getCalendarFieldsToDateCalculator(env);
  TimeZone tz = forceUTC != Boolean.FALSE ? DateUtil.UTC : timeZone;
  try {
    if (dateType == TemplateDateModel.DATE) {
      return parseDate(s, tz, calToDateConverter);
    } else if (dateType == TemplateDateModel.TIME) {
      return parseTime(s, tz, calToDateConverter);
    } else if (dateType == TemplateDateModel.DATETIME) {
      return parseDateTime(s, tz, calToDateConverter);
    } else {
      throw new BugException("Unexpected date type: " + dateType);
    }
  } catch (DateParseException e) {
    throw new UnparsableValueException(e.getMessage(), e);
  }
}
 
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

/**
 * Parses an W3C XML Schema time string (not date or date-time).
 * If the time string doesn't specify the time zone offset explicitly,
 * the value of the {@code defaultTZ} paramter will be used. 
 */  
public static Date parseXSTime(
    String timeStr, TimeZone defaultTZ, CalendarFieldsToDateConverter calToDateConverter) 
    throws DateParseException {
  Matcher m = PATTERN_XS_TIME.matcher(timeStr);
  if (!m.matches()) {
    throw new DateParseException("The value didn't match the expected pattern: " + PATTERN_XS_TIME);
  }
  return parseTime_parseMatcher(m, defaultTZ, calToDateConverter);
}
origin: org.freemarker/freemarker-gae

/**
 * Parses an W3C XML Schema date-time string (not date or time).
 * Unlike in ISO 8601:2000 Second Edition, year -1 means B.C 1, and year 0 is invalid. 
 * 
 * @param dateTimeStr the string to parse. 
 * @param defaultTZ used if the dateTime doesn't specify the
 *     time zone offset explicitly. Can't be {@code null}. 
 * 
 * @throws DateParseException if the dateTime is malformed.
 */
public static Date parseXSDateTime(
    String dateTimeStr, TimeZone defaultTZ, CalendarFieldsToDateConverter calToDateConverter) 
    throws DateParseException {
  Matcher m = PATTERN_XS_DATE_TIME.matcher(dateTimeStr);
  if (!m.matches()) {
    throw new DateParseException(
        "The value didn't match the expected pattern: " + PATTERN_XS_DATE_TIME);
  }
  return parseDateTime_parseMatcher(
      m, defaultTZ, true, calToDateConverter);
}
origin: org.freemarker/freemarker

    year = -year + (xsMode ? 0 : 1);
    if (year == 0) {
      throw new DateParseException(MSG_YEAR_0_NOT_ALLOWED);
      throw new DateParseException(
          "Hour 24 is only allowed in the case of "
          + "midnight."); 
} catch (IllegalArgumentException e) {
  throw new DateParseException(
      "Date-time calculation faliure. "
      + "Probably the date-time is formally correct, but "
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

/**
 * Parses an W3C XML Schema date-time string (not date or time).
 * Unlike in ISO 8601:2000 Second Edition, year -1 means B.C 1, and year 0 is invalid. 
 * 
 * @param dateTimeStr the string to parse. 
 * @param defaultTZ used if the dateTime doesn't specify the
 *     time zone offset explicitly. Can't be {@code null}. 
 * 
 * @throws DateParseException if the dateTime is malformed.
 */
public static Date parseXSDateTime(
    String dateTimeStr, TimeZone defaultTZ, CalendarFieldsToDateConverter calToDateConverter) 
    throws DateParseException {
  Matcher m = PATTERN_XS_DATE_TIME.matcher(dateTimeStr);
  if (!m.matches()) {
    throw new DateParseException(
        "The value didn't match the expected pattern: " + PATTERN_XS_DATE_TIME);
  }
  return parseDateTime_parseMatcher(
      m, defaultTZ, true, calToDateConverter);
}
origin: org.freemarker/freemarker

      day = 2;
    } else {
      throw new DateParseException(
          "Hour 24 is only allowed in the case of "
          + "midnight."); 
} catch (IllegalArgumentException e) {
  throw new DateParseException(
      "Unexpected time calculation faliure."); 
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

/**
 * Parses an W3C XML Schema date string (not time or date-time).
 * Unlike in ISO 8601:2000 Second Edition, year -1 means B.C 1, and year 0 is invalid. 
 * 
 * @param dateStr the string to parse. 
 * @param defaultTimeZone used if the date doesn't specify the
 *     time zone offset explicitly. Can't be {@code null}.
 * @param calToDateConverter Used internally to calculate the result from the calendar field values.
 *     If you don't have a such object around, you can just use
 *     {@code new }{@link TrivialCalendarFieldsToDateConverter}{@code ()}. 
 * 
 * @throws DateParseException if the date is malformed, or if the time
 *     zone offset is unspecified and the {@code defaultTimeZone} is
 *     {@code null}.
 */
public static Date parseXSDate(
    String dateStr, TimeZone defaultTimeZone,
    CalendarFieldsToDateConverter calToDateConverter) 
    throws DateParseException {
  Matcher m = PATTERN_XS_DATE.matcher(dateStr);
  if (!m.matches()) {
    throw new DateParseException("The value didn't match the expected pattern: " + PATTERN_XS_DATE); 
  }
  return parseDate_parseMatcher(
      m, defaultTimeZone, true, calToDateConverter);
}
origin: org.freemarker/freemarker

  throws DateParseException {
if (g == null) {
  throw new DateParseException("The " + gName + " part "
      + "is missing.");
    throw new DateParseException("The " + gName + " part "
      + "must be at least " + min + ".");
    throw new DateParseException("The " + gName + " part "
      + "can't be more than " + max + ".");
  throw new DateParseException("The " + gName + " part "
      + "is a malformed integer.");
origin: org.freemarker/freemarker-gae

/**
 * Parses an W3C XML Schema date string (not time or date-time).
 * Unlike in ISO 8601:2000 Second Edition, year -1 means B.C 1, and year 0 is invalid. 
 * 
 * @param dateStr the string to parse. 
 * @param defaultTimeZone used if the date doesn't specify the
 *     time zone offset explicitly. Can't be {@code null}.
 * @param calToDateConverter Used internally to calculate the result from the calendar field values.
 *     If you don't have a such object around, you can just use
 *     {@code new }{@link TrivialCalendarFieldsToDateConverter}{@code ()}. 
 * 
 * @throws DateParseException if the date is malformed, or if the time
 *     zone offset is unspecified and the {@code defaultTimeZone} is
 *     {@code null}.
 */
public static Date parseXSDate(
    String dateStr, TimeZone defaultTimeZone,
    CalendarFieldsToDateConverter calToDateConverter) 
    throws DateParseException {
  Matcher m = PATTERN_XS_DATE.matcher(dateStr);
  if (!m.matches()) {
    throw new DateParseException("The value didn't match the expected pattern: " + PATTERN_XS_DATE); 
  }
  return parseDate_parseMatcher(
      m, defaultTimeZone, true, calToDateConverter);
}
origin: org.freemarker/freemarker

    year = -year + (xsMode ? 0 : 1);
    if (year == 0) {
      throw new DateParseException(MSG_YEAR_0_NOT_ALLOWED);
} catch (IllegalArgumentException e) {
  throw new DateParseException(
      "Date calculation faliure. "
      + "Probably the date is formally correct, but refers "
freemarker.template.utilityDateUtil$DateParseException

Most used methods

  • <init>
  • getMessage

Popular in Java

  • Reading from database using SQL prepared statement
  • notifyDataSetChanged (ArrayAdapter)
  • getSystemService (Context)
  • findViewById (Activity)
  • BufferedReader (java.io)
    Reads text from a character-input stream, buffering characters so as to provide for the efficient re
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now