package org.nutz.castor.castor;

import java.text.DateFormat;
import java.text.ParseException;

import org.nutz.lang.Lang;

public class String2Datetime extends DateTimeCastor<String, java.util.Date> {

	@Override
	public java.util.Date cast(String src, Class<?> toType, String... args) {
		try {
			return ((DateFormat) dateTimeFormat.clone()).parse(src);
		}
		catch (ParseException e1) {
			try {
				return ((DateFormat) dateFormat.clone()).parse(src);
			}
			catch (ParseException e) {
				throw Lang.wrapThrow(e);
			}
		}
	}

}

@@ -293,16 +293,88 @@
 rgs) %7B%0D%0A
+%09    if(src == null %7C%7C %22%22.equals(src))%7B%0D%0A%09        return null;%0D%0A%09    %7D%0D%0A
 %09%09try %7B%0D

修复""->data时报异常