I try to use Camel bindy to process my csv file. Rows of the file look like this:
1111;"2016-06-21";"12:15";"Test1";"1";
2222;"2016-06-21";"12:16";"Test2";"2";
My model file is:
@CsvRecord(separator = ";")
public class CsvBean implements Serializable {
@DataField(pos = 1)
private Integer key;
@DataField(pos = 2, pattern = "yyyy-MM-dd")
private Date date;
@DataField(pos = 3, pattern = "hh-mm")
private Date time;
@DataField(pos = 4)
private String title;
@DataField(pos = 5)
private int status;
}
and I use unmarshall(bindy) method. The exception I got is:
java.lang.IllegalArgumentException: Parsing error detected for field defined at the position: 3, line: 1
at org.apache.camel.dataformat.bindy.BindyCsvFactory.bind(BindyCsvFactory.java:207)
I suppose that the problem is that first "id" value is without quotes and the rest of columns have. How can I solve it?
Your pattern for pos 3 is wrong . Try the below code
@DataField(pos = 3, pattern = "hh:mm")