I have inherited a UDF in some mapping that on the whole, works okay...
but it throws an error after mapping a few dates:
Parse Exception : java.text.ParseException: Unparseable date: "2010-03-18T00:00:00.000Z"
Parse Exception : java.text.ParseException: Unparseable date: "2010-03-23T23:59:00.000Z"
Parse Exception : java.text.ParseException: Unparseable date: "2010-03-18T00:00:00.000Z"
Parse Exception : java.text.ParseException: Unparseable date: "2010-03-23T23:59:00.000Z"
Parse Exception : java.text.ParseException: Unparseable date: "2010-03-18T00:00:00.000Z"
Parse Exception : java.text.ParseException: Unparseable date: "2010-03-23T23:59:00.000Z"
the first few map okay... then i get the exception.
the UDF is as follows:
public String convertDateTimeToUTC(String strDate, Container container) throws StreamTransformationException{ AbstractTrace trace = container.getTrace(); Date date=null; SimpleDateFormat sdfSource = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); try{ String dt = strDate; date = sdfSource.parse(dt); trace.addInfo("Local Date:"+date); SimpleDateFormat sdfDestination = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); strDate = sdfDestination.format(date); } catch(ParseException pe){ trace.addInfo("Parse Exception : " + pe); } return strDate;
can anyone see why this fails after successfully mapping a few fields???