java.text.ParseException.toString()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中java.text.ParseException.toString()方法的一些代码示例,展示了ParseException.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ParseException.toString()方法的具体详情如下:
包路径:java.text.ParseException
类名称:ParseException
方法名:toString

ParseException.toString介绍

暂无

代码示例

代码示例来源:origin: chewiebug/GCViewer

private long parseGCCycleStart(final String line) throws IOException {
  try {
    final int idx = line.indexOf("GC cycle started ");
    final Date date = cycleStartGCFormat.parse(line.substring(idx + "GC cycle started ".length()));
    return date.getTime();
  }
  catch (java.text.ParseException e) {
    throw new com.tagtraum.perf.gcviewer.imp.ParseException(e.toString());
  }
}

代码示例来源:origin: chewiebug/GCViewer

private long parseGCCycleStart(final String line) throws IOException {
  try {
    final int idx = line.indexOf("GC cycle started ");
    final Date date = cycleStartGCFormat.parse(line.substring(idx + "GC cycle started ".length()));
    return date.getTime();
  }
  catch (java.text.ParseException e) {
    throw new ParseException(e.toString());
  }
}

代码示例来源:origin: chewiebug/GCViewer

/**
 * Parses the line which holds the GC Cycle start date/time. The
 * date/time is extracted and returned as a long.
 *
 * @param line The line which holds the date
 * @return The date represented as a long
 * @throws IOException When parsing the date fails.
 */
private long parseGCCycleStart(final String line) throws IOException {
  try {
    final int idx = line.indexOf("collection starting ");
    final Date date = cycleStartGCFormat.parse(line.substring(idx + "collection starting ".length()));
    return date.getTime();
  }
  catch (java.text.ParseException e) {
    throw new ParseException(e.toString());
  }
}

代码示例来源:origin: org.apache.commons/commons-lang3

private void testLocales(final String format, final boolean eraBC) throws Exception {
  final Calendar cal= Calendar.getInstance(GMT);
  cal.clear();
  cal.set(2003, Calendar.FEBRUARY, 10);
  if (eraBC) {
    cal.set(Calendar.ERA, GregorianCalendar.BC);
  }
  for(final Locale locale : Locale.getAvailableLocales() ) {
    // ja_JP_JP cannot handle dates before 1868 properly
    if (eraBC && locale.equals(FastDateParser.JAPANESE_IMPERIAL)) {
      continue;
    }
    final SimpleDateFormat sdf = new SimpleDateFormat(format, locale);
    final DateParser fdf = getInstance(format, locale);
    try {
      checkParse(locale, cal, sdf, fdf);
    } catch(final ParseException ex) {
      fail("Locale "+locale+ " failed with "+format+" era "+(eraBC?"BC":"AD")+"\n" + trimMessage(ex.toString()));
    }
  }
}

代码示例来源:origin: org.apache.commons/commons-lang3

@Test
public void testJpLocales() {
  final Calendar cal= Calendar.getInstance(GMT);
  cal.clear();
  cal.set(2003, Calendar.FEBRUARY, 10);
  cal.set(Calendar.ERA, GregorianCalendar.BC);
  final Locale locale = LocaleUtils.toLocale("zh"); {
    // ja_JP_JP cannot handle dates before 1868 properly
    final SimpleDateFormat sdf = new SimpleDateFormat(LONG_FORMAT, locale);
    final DateParser fdf = getInstance(LONG_FORMAT, locale);
    try {
      checkParse(locale, cal, sdf, fdf);
    } catch(final ParseException ex) {
      fail("Locale "+locale+ " failed with "+LONG_FORMAT+"\n" + trimMessage(ex.toString()));
    }
  }
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

private void testLocales(final String format, final boolean eraBC) throws Exception {
  final Calendar cal= Calendar.getInstance(GMT);
  cal.clear();
  cal.set(2003, Calendar.FEBRUARY, 10);
  if (eraBC) {
    cal.set(Calendar.ERA, GregorianCalendar.BC);
  }
  for(final Locale locale : Locale.getAvailableLocales() ) {
    // ja_JP_JP cannot handle dates before 1868 properly
    if (eraBC && locale.equals(FastDateParser.JAPANESE_IMPERIAL)) {
      continue;
    }
    final SimpleDateFormat sdf = new SimpleDateFormat(format, locale);
    final DateParser fdf = getInstance(format, locale);
    try {
      checkParse(locale, cal, sdf, fdf);
    } catch(final ParseException ex) {
      Assert.fail("Locale "+locale+ " failed with "+format+" era "+(eraBC?"BC":"AD")+"\n" + trimMessage(ex.toString()));
    }
  }
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Test
public void testJpLocales() {
  final Calendar cal= Calendar.getInstance(GMT);
  cal.clear();
  cal.set(2003, Calendar.FEBRUARY, 10);
  cal.set(Calendar.ERA, GregorianCalendar.BC);
  final Locale locale = LocaleUtils.toLocale("zh"); {
    // ja_JP_JP cannot handle dates before 1868 properly
    final SimpleDateFormat sdf = new SimpleDateFormat(LONG_FORMAT, locale);
    final DateParser fdf = getInstance(LONG_FORMAT, locale);
    try {
      checkParse(locale, cal, sdf, fdf);
    } catch(final ParseException ex) {
      Assert.fail("Locale "+locale+ " failed with "+LONG_FORMAT+"\n" + trimMessage(ex.toString()));
    }
  }
}

代码示例来源:origin: JpressProjects/jpress

article = markdownParser.getArticle();
} catch (ParseException e) {
  LogKit.error(e.toString(), e);
  renderJson(Ret.fail("message", "导入失败,可能markdown文件格式错误"));
} finally {

代码示例来源:origin: weexteam/weex-hackernews

private static Date parseDate(String s) {
  if (dateFormatter == null) {
    dateFormatter = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
  }
  try {
    return dateFormatter.parse(s);
  } catch (ParseException e) {
    //don't worry
    WXLogUtils.w("[DatePickerImpl] " + e.toString());
  }
  return new Date();
}

代码示例来源:origin: weexteam/weex-hackernews

private static Date parseTime(String s) {
    if (timeFormatter == null) {
      timeFormatter = new SimpleDateFormat("HH:mm", Locale.getDefault());
    }

    try {
      return timeFormatter.parse(s);
    } catch (ParseException e) {
      //don't worry
      WXLogUtils.w("[DatePickerImpl] " + e.toString());
    }
    return new Date();
  }
}

代码示例来源:origin: kaku2015/ColorfulNews

/**
 * from yyyy-MM-dd HH:mm:ss to MM-dd HH:mm
 */
public static String formatDate(String before) {
  String after;
  try {
    Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
        .parse(before);
    after = new SimpleDateFormat("MM-dd HH:mm", Locale.getDefault()).format(date);
  } catch (ParseException e) {
    KLog.e("转换新闻日期格式异常:" + e.toString());
    return before;
  }
  return after;
}

代码示例来源:origin: com.mgmtp.gcviewer/gcviewer

private long parseGCCycleStart(final String line) throws IOException {
  try {
    final int idx = line.indexOf("GC cycle started ");
    final Date date = cycleStartGCFormat.parse(line.substring(idx + "GC cycle started ".length()));
    return date.getTime();
  } catch (java.text.ParseException e) {
    throw new ParseException(e.toString());
  }
}

代码示例来源:origin: org.codehaus.castor/castor-jdo

/**
 * {@inheritDoc}
 */
public Object convert(final Object object) {
  try {
    return new org.exolab.castor.types.Duration((String) object);
  } catch (ParseException ex) {
    throw new IllegalArgumentException(ex.toString());
  }
}

代码示例来源:origin: org.codehaus.castor/castor-jdo

/**
 * {@inheritDoc}
 */
public Object convert(final Object object) {
  try {
    return getCustomDateFormat().parse(object.toString());
  } catch (ParseException ex) {
    throw new IllegalArgumentException(ex.toString());
  }
}

代码示例来源:origin: org.codehaus.castor/castor-jdo

/**
 * {@inheritDoc}
 */
public Object convert(final Object object) {
  try {
    return getCustomDateFormat().parse(object.toString());
  } catch (ParseException ex) {
    throw new IllegalArgumentException(ex.toString());
  }
}

代码示例来源:origin: org.codehaus.castor/castor-jdo

/**
 * {@inheritDoc}
 */
public Object convert(final Object object) {
  try {
    return new org.exolab.castor.types.Time((String) object);
  } catch (ParseException ex) {
    throw new IllegalArgumentException(ex.toString());
  }
}

代码示例来源:origin: org.codehaus.castor/castor-jdo

/**
 * {@inheritDoc}
 */
public Object convert(final Object object) {
  try {
    return getCustomDateFormat().parse((String) object);
  } catch (ParseException ex) {
    throw new IllegalArgumentException(ex.toString());
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-core

public void setAsText(String text) throws IllegalArgumentException {
  if ("".equals(text)) { // NOI18N
    setValue(null);
  } else {
    try {
      setValue(fmt.parse(text));
    } catch (ParseException e) {
      throw (IllegalArgumentException)new IllegalArgumentException(e.toString()).initCause(e);
    }
  }
}

代码示例来源:origin: org.codehaus.castor/castor-jdo

/**
 * {@inheritDoc}
 */
public Object convert(final Object object) {
  try {
    return getCustomDateFormat().parse(getDecimalFormat().format(object).trim());
  } catch (ParseException ex) {
    throw new IllegalArgumentException(ex.toString());
  }
}

代码示例来源:origin: senbox-org/s1tbx

protected static ProductData.UTC getProcTime(BinaryRecord volDescRec) {
  try {
    final String procDate = volDescRec.getAttributeString("Logical volume preparation date").trim();
    final String procTime = volDescRec.getAttributeString("Logical volume preparation time").trim();
    return ProductData.UTC.parse(procDate + procTime, "yyyyMMddHHmmss");
  } catch (ParseException e) {
    System.out.println(e.toString());
    return AbstractMetadata.NO_METADATA_UTC;
  }
}

相关文章