Java Code Examples for java.text.ParseException#toString()

The following examples show how to use java.text.ParseException#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CalendarParsedResult.java    From reacteu-app with MIT License 6 votes vote down vote up
public CalendarParsedResult(String summary,
                            String startString,
                            String endString,
                            String location,
                            String organizer,
                            String[] attendees,
                            String description,
                            double latitude,
                            double longitude) {
  super(ParsedResultType.CALENDAR);
  this.summary = summary;
  try {
    this.start = parseDate(startString);
    this.end = endString == null ? null : parseDate(endString);
  } catch (ParseException pe) {
    throw new IllegalArgumentException(pe.toString());
  }
  this.startAllDay = startString.length() == 8;
  this.endAllDay = endString != null && endString.length() == 8;
  this.location = location;
  this.organizer = organizer;
  this.attendees = attendees;
  this.description = description;
  this.latitude = latitude;
  this.longitude = longitude;
}
 
Example 2
Source File: CalendarBinder.java    From restcommander with Apache License 2.0 6 votes vote down vote up
public Calendar bind(String name, Annotation[] annotations, String value, Class actualClass, Type genericType) throws Exception {
    if (value == null || value.trim().length() == 0) {
        return null;
    }
    Calendar cal = Calendar.getInstance(Lang.getLocale());
    try {
        Date date = AnnotationHelper.getDateAs(annotations, value);
        if (date != null) {
            cal.setTime(date);
        } else {
            SimpleDateFormat sdf = new SimpleDateFormat(I18N.getDateFormat());
            sdf.setLenient(false);
            cal.setTime(sdf.parse(value));
        }
    } catch (ParseException e) {
        throw new IllegalArgumentException("Cannot convert [" + value + "] to a Calendar: " + e.toString());
    }

    return cal;
}
 
Example 3
Source File: Kingbase8Dictionary.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
public Date getDate(ResultSet paramResultSet, int paramInt) throws SQLException {
	try {
		return super.getDate(paramResultSet, paramInt);
	} catch (StringIndexOutOfBoundsException localStringIndexOutOfBoundsException) {
		String str = paramResultSet.getString(paramInt);
		SimpleDateFormat localSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SS");
		try {
			return localSimpleDateFormat.parse(str);
		} catch (ParseException localParseException) {
			throw new SQLException(localParseException.toString());
		}
	}
}