我正在尝试执行此代码:
Date date = null;
if (detailsBean.getDiscoveryProjectBean ().getCreatedDate ()==null ||
detailsBean.getDiscoveryProjectBean ().getCreatedDate ().equalsIgnoreCase(""))
{
projectDetails.getDiscoveryProject().setCreationTime(new Date());
}
else
{
try
{
date = new SimpleDateFormat (FormatUtils.simpleFormat).
parse (detailsBean.getDiscoveryProjectBean ().getCreatedDate ());
} catch (Exception e) {
throw new PanDaApplicationException (e.getMessage ());
}
projectDetails.getDiscoveryProject().setCreationTime(date);
}
在 try 块中抛出 ParseException 异常。但是,我不知道其原因,因为代码看起来不错。FormatUtils.simpleFormat
is的定义public static final String simpleFormat = "dd-MMM-yyyy"
并且detailsBean.getDiscoveryProjectBean().getCreatedDate()
具有类似的值28-Feb-2013
我真的不知道为什么会抛出这个异常,我需要帮助。