You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by houssemgaga <be...@gmail.com> on 2012/08/16 15:17:02 UTC

Bindy : CSV Header is incorrect

Hello,

I use the library Bindy for quite some time, and she is great .
However, I recently found a problem. Let me explain:
I'm developing on Windows machine, everything goes well. Once deployed on
the target machine (Linux), csv files generated are not correct: the header
is not good.
In fact, I created for each file type csv a model object, in each package
separately. There are common fields between the models and the concern comes
from there: camel-bindy is lost when generating the header. The generated
header contains fields that come from another model.

An example :
*Model 1 :*
@CsvRecord(separator=";", generateHeaderColumns=true, skipFirstLine=true) 
 public class OpportunityDTO implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@DataField(columnName = "OpportunityId", pos = 1 )
	String opportunityId;
	
	@DataField(columnName = "AccountId", pos = 2 )
	String accountId;
	
	@DataField(columnName = "Country", pos = 3 )
	String country;
	
	@DataField(columnName = "OpportunityType", pos = 4 )
	String opportunityType;
	
	@DataField(columnName = "ValidStartDate", pos = 5, pattern
="\"dd/MM/yyyy\"" )
	Date validStartDate;
	
	@DataField(columnName = "ValidEndDate", pos = 6, pattern ="\"dd/MM/yyyy\""
)
	Date validEndDate;
	
	@DataField(columnName = "OpportunityCurrency", pos = 7 )
	String opportunityCurrency;
	
	@DataField(columnName = "ParentOpportunityId", pos = 8 )
	String parentOpportunityId;
	
	@DataField(columnName = "SalesMonitoring", pos = 9 )
	String salesMonitoring;

// Getter and setter
}

*Model 2 :*
	@CsvRecord(separator=";", generateHeaderColumns=true, skipFirstLine=true)
public class OpportunityLeaserDTO {
	
	@DataField(columnName = "OpportunityId", pos = 1 )
	String opportunityId;
	
	@DataField(columnName = "LeaserId", pos = 2 )
	String leaserID;
	
	@DataField(columnName = "ValidStartDate", pos = 3, pattern
="\"dd/MM/yyyy\"" )
	Date validStartDate;
	
	@DataField(columnName = "ValidEndDate", pos = 4, pattern ="\"dd/MM/yyyy\""
)
	Date validEndDate;
	// Getter and setter
}



For the first model "OpportunityDTO", the header is incorrect and generated
as follows:
OpportunityId;*LeaserId*;*ValidStartDate*;*ValidEndDate*;Country;ValidStartDate;ValidEndDate;ParentOpportunityId;SalesMonitoring

For the second model "OpportunityLeaserDTO" the generated header is correct

I still do not understand where is the problem and why only on linux???

I use the latest release of Bindy: 2.10.0

Thank you for your support.



--
View this message in context: http://camel.465427.n5.nabble.com/Bindy-CSV-Header-is-incorrect-tp5717531.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Bindy : CSV Header is incorrect

Posted by houssemgaga <be...@gmail.com>.
Hello,

Thank you for your responses.

I just found where it comes from the problem. The process of scanning to
find the package on Windows models is different on linux (due to
classloading, I think).
In fact the two models in my example is successively in the following
packages:
- Model 1: *com. [...].opportunity*
- Model 2: *com. [...].opportunity*leaser

Scanning the package "com. [...].opportunity" on Windows return the model
OpportrunityDTO by cons on Linux returns the two models (ie it has also
scanned the second package). So, we found in the CSV header the fields of
the 2nd model they have the same "pos" as in model 1. I think the
classloading policy is différent between Linux and Windows. So to correct
the problem, i changed the package names.

And here are the logs:

- Before:

2012-08-16 16:39:22,164 DEBUG
(org.apache.camel.impl.DefaultPackageScanClassResolver:160) - Found: [class
com.sfl.dto.csv.opportunity.OpportunitiesDTO, class
com....sfl.dto.csv.opportunity.OpportunityDTO, class
com.sfl.dto.csv.opportunitydealer.OpportunityDealerDTO, class
com.sfl.dto.csv.opportunityleaser.OpportunityLeaserDTO]
2012-08-16 16:39:22,164 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:107) - Class retrieved: *
com.sfl.dto.csv.opportunity.OpportunitiesDTO*
2012-08-16 16:39:22,165 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunity.OpportunitiesDTO, position: 1,
Field: @org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=OpportunityId, required=false, defaultValue=, trim=false, pos=1)
2012-08-16 16:39:22,166 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunity.OpportunitiesDTO, position: 2,
Field: @org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=AccountId, required=false, defaultValue=, trim=false, pos=2)
2012-08-16 16:39:22,167 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunity.OpportunitiesDTO, position: 3,
Field: @org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=Country, required=false, defaultValue=, trim=false, pos=3)
2012-08-16 16:39:22,167 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunity.OpportunitiesDTO, position: 4,
Field: @org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=OpportunityType, required=false, defaultValue=, trim=false,
pos=4)
2012-08-16 16:39:22,168 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunity.OpportunitiesDTO, position: 5,
Field: @org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern="dd/MM/yyyy", align=R, paddingChar= ,
name=, length=0, columnName=ValidStartDate, required=false, defaultValue=,
trim=false, pos=5)
2012-08-16 16:39:22,169 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunity.OpportunitiesDTO, position: 6,
Field: @org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern="dd/MM/yyyy", align=R, paddingChar= ,
name=, length=0, columnName=ValidEndDate, required=false, defaultValue=,
trim=false, pos=6)
2012-08-16 16:39:22,169 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunity.OpportunitiesDTO, position: 7,
Field: @org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=OpportunityCurrency, required=false, defaultValue=, trim=false,
pos=7)
2012-08-16 16:39:22,170 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunity.OpportunitiesDTO, position: 8,
Field: @org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=ParentOpportunityId, required=false, defaultValue=, trim=false,
pos=8)
2012-08-16 16:39:22,171 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunity.OpportunitiesDTO, position: 9,
Field: @org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=SalesMonitoring, required=false, defaultValue=, trim=false,
pos=9)
2012-08-16 16:39:22,171 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:146) - Number of
optional fields: 9
2012-08-16 16:39:22,172 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:147) - Number of
mandatory fields: 0
2012-08-16 16:39:22,172 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:148) - Total: 9
2012-08-16 16:39:22,181 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:107) - Class retrieved: *
com..sfl.dto.csv.opportunitydealer.OpportunityDealerDTO*
2012-08-16 16:39:22,182 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunitydealer.OpportunityDealerDTO,
position: 1, Field:
@org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=OpportunityId, required=false, defaultValue=, trim=false, pos=1)
2012-08-16 16:39:22,183 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunitydealer.OpportunityDealerDTO,
position: 2, Field:
@org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=RRDI7, required=false, defaultValue=, trim=false, pos=2)
2012-08-16 16:39:22,183 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunitydealer.OpportunityDealerDTO,
position: 3, Field:
@org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=FRR/BRS Code, required=false, defaultValue=, trim=false, pos=3)
2012-08-16 16:39:22,184 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunitydealer.OpportunityDealerDTO,
position: 4, Field:
@org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=Brand, required=false, defaultValue=, trim=false, pos=4)
2012-08-16 16:39:22,185 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunitydealer.OpportunityDealerDTO,
position: 5, Field:
@org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=Country, required=false, defaultValue=, trim=false, pos=5)
2012-08-16 16:39:22,185 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunitydealer.OpportunityDealerDTO,
position: 6, Field:
@org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern="dd/MM/yyyy", align=R, paddingChar= ,
name=, length=0, columnName=ValidStartDate, required=false, defaultValue=,
trim=false, pos=6)
2012-08-16 16:39:22,186 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com..sfl.dto.csv.opportunitydealer.OpportunityDealerDTO,
position: 7, Field:
@org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern="dd/MM/yyyy", align=R, paddingChar= ,
name=, length=0, columnName=ValidEndDate, required=false, defaultValue=,
trim=false, pos=7)
2012-08-16 16:39:22,187 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:146) - Number of
optional fields: 16
2012-08-16 16:39:22,187 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:147) - Number of
mandatory fields: 0
2012-08-16 16:39:22,188 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:148) - Total: 16
2012-08-16 16:39:22,188 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:107) - Class retrieved: *
com.sfl.dto.csv.opportunityleaser.OpportunityLeaserDTO*
2012-08-16 16:39:22,189 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunityleaser.OpportunityLeaserDTO,
position: 1, Field:
@org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=OpportunityId, required=false, defaultValue=, trim=false, pos=1)
2012-08-16 16:39:22,190 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunityleaser.OpportunityLeaserDTO,
position: 2, Field:
@org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=LeaserId, required=false, defaultValue=, trim=false, pos=2)
2012-08-16 16:39:22,190 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunityleaser.OpportunityLeaserDTO,
position: 3, Field:
@org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern="dd/MM/yyyy", align=R, paddingChar= ,
name=, length=0, columnName=ValidStartDate, required=false, defaultValue=,
trim=false, pos=3)
2012-08-16 16:39:22,191 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunityleaser.OpportunityLeaserDTO,
position: 4, Field:
@org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern="dd/MM/yyyy", align=R, paddingChar= ,
name=, length=0, columnName=ValidEndDate, required=false, defaultValue=,
trim=false, pos=4)
2012-08-16 16:39:22,192 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:146) - Number of
optional fields: 20
2012-08-16 16:39:22,192 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:147) - Number of
mandatory fields: 0
2012-08-16 16:39:22,193 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:148) - Total: 20
2012-08-16 16:39:22,196 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:533) - Csv record:
@org.apache.camel.dataformat.bindy.annotation.CsvRecord(isOrdered=false,
quote=, name=, crlf=WINDOWS, skipFirstLine=true,
generateHeaderColumns=true, separator=;)
2012-08-16 16:39:22,197 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:537) - Skip First Line
parameter of the CSV: {}true
2012-08-16 16:39:22,198 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:541) - Generate header
column names parameter of the CSV: true
2012-08-16 16:39:22,198 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:546) - Separator defined
for the CSV: ;
2012-08-16 16:39:22,199 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:550) - Carriage return
defined for the CSV: WINDOWS
2012-08-16 16:39:22,199 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:554) - Must CSV record
be ordered: false
2012-08-16 16:39:22,200 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:533) - Csv record:
@org.apache.camel.dataformat.bindy.annotation.CsvRecord(isOrdered=false,
quote=, name=, crlf=WINDOWS, skipFirstLine=true,
generateHeaderColumns=true, separator=;)
2012-08-16 16:39:22,200 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:537) - Skip First Line
parameter of the CSV: {}true
2012-08-16 16:39:22,201 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:541) - Generate header
column names parameter of the CSV: true
2012-08-16 16:39:22,201 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:546) - Separator defined
for the CSV: ;
2012-08-16 16:39:22,202 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:550) - Carriage return
defined for the CSV: WINDOWS
2012-08-16 16:39:22,202 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:554) - Must CSV record
be ordered: false
2012-08-16 16:39:22,203 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:533) - Csv record:
@org.apache.camel.dataformat.bindy.annotation.CsvRecord(isOrdered=false,
quote=, name=, crlf=WINDOWS, skipFirstLine=true,
generateHeaderColumns=true, separator=;)
2012-08-16 16:39:22,204 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:537) - Skip First Line
parameter of the CSV: {}true
2012-08-16 16:39:22,204 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:541) - Generate header
column names parameter of the CSV: true
2012-08-16 16:39:22,205 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:546) - Separator defined
for the CSV: ;
2012-08-16 16:39:22,205 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:550) - Carriage return
defined for the CSV: WINDOWS
2012-08-16 16:39:22,206 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:554) - Must CSV record
be ordered: false
2012-08-16 16:39:22,206 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:246) - Separator
converted: '0x3b', from: ;
2012-08-16 16:39:22,207 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:254) - Model object:
com.sfl.dto.csv.opportunity.OpportunitiesDTO@13c53da[opportunityId=<null>,accountId=<null>,country=<null>,opportunityType=<null>,validStartDate=<null>,validEndDate=<null>,opportunityCurrency=<null>,parentOpportunityId=<null>,salesMonitoring=<null>],
class: com.sfl.dto.csv.opportunity.OpportunitiesDTO
2012-08-16 16:39:22,208 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:416) - Value to be
formatted: null, position: 1, and its formatted value:
2012-08-16 16:39:22,209 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:416) - Value to be
formatted: null, position: 2, and its formatted value:
2012-08-16 16:39:22,209 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:416) - Value to be
formatted: null, position: 3, and its formatted value:
2012-08-16 16:39:22,210 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:416) - Value to be
formatted: null, position: 4, and its formatted value:
2012-08-16 16:39:22,210 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:416) - Value to be
formatted: null, position: 5, and its formatted value:
2012-08-16 16:39:22,211 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:416) - Value to be
formatted: null, position: 6, and its formatted value:
2012-08-16 16:39:22,212 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:416) - Value to be
formatted: null, position: 7, and its formatted value:
2012-08-16 16:39:22,212 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:416) - Value to be
formatted: null, position: 8, and its formatted value:
2012-08-16 16:39:22,213 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:416) - Value to be
formatted: null, position: 9, and its formatted value:


- After :

2012-08-16 17:00:06,731 DEBUG
(org.apache.camel.impl.DefaultPackageScanClassResolver:151) - Searching for
annotations of [interface
org.apache.camel.dataformat.bindy.annotation.CsvRecord, interface
org.apache.camel.dataformat.bindy.annotation.Link, interface
org.apache.camel.dataformat.bindy.annotation.Message, interface
org.apache.camel.dataformat.bindy.annotation.Section, interface
org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord] in
packages: [com.sfl.dto.csv.opportunities]
2012-08-16 17:00:06,789 DEBUG
(org.apache.camel.impl.DefaultPackageScanClassResolver:160) - Found: [class
com.sfl.dto.csv.opportunities.OpportunitiesDTO]
2012-08-16 17:00:06,790 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:107) - Class retrieved: *
com.sfl.dto.csv.opportunities.OpportunitiesDTO*
2012-08-16 17:00:06,790 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunities.OpportunitiesDTO, position: 1,
Field: @org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=Padding, required=false, defaultValue=, trim=false, pos=1)
2012-08-16 17:00:06,791 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunities.OpportunitiesDTO, position: 2,
Field: @org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=OpportunityId, required=false, defaultValue=, trim=false, pos=2)
2012-08-16 17:00:06,792 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunities.OpportunitiesDTO, position: 3,
Field: @org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=AccountId, required=false, defaultValue=, trim=false, pos=3)
2012-08-16 17:00:06,792 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunities.OpportunitiesDTO, position: 4,
Field: @org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=Country, required=false, defaultValue=, trim=false, pos=4)
2012-08-16 17:00:06,793 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunities.OpportunitiesDTO, position: 5,
Field: @org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=OpportunityType, required=false, defaultValue=, trim=false,
pos=5)
2012-08-16 17:00:06,793 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunities.OpportunitiesDTO, position: 6,
Field: @org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern="dd/MM/yyyy", align=R, paddingChar= ,
name=, length=0, columnName=ValidStartDate, required=false, defaultValue=,
trim=false, pos=6)
2012-08-16 17:00:06,794 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunities.OpportunitiesDTO, position: 7,
Field: @org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern="dd/MM/yyyy", align=R, paddingChar= ,
name=, length=0, columnName=ValidEndDate, required=false, defaultValue=,
trim=false, pos=7)
2012-08-16 17:00:06,795 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunities.OpportunitiesDTO, position: 8,
Field: @org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=OpportunityCurrency, required=false, defaultValue=, trim=false,
pos=8)
2012-08-16 17:00:06,795 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunities.OpportunitiesDTO, position: 9,
Field: @org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=ParentOpportunityId, required=false, defaultValue=, trim=false,
pos=9)
2012-08-16 17:00:06,796 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:114) - Position defined
in the class: com.sfl.dto.csv.opportunities.OpportunitiesDTO, position: 10,
Field: @org.apache.camel.dataformat.bindy.annotation.DataField(clip=false,
position=0, precision=0, pattern=, align=R, paddingChar= , name=, length=0,
columnName=SalesMonitoring, required=false, defaultValue=, trim=false,
pos=10)
2012-08-16 17:00:06,796 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:146) - Number of
optional fields: 10
2012-08-16 17:00:06,797 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:147) - Number of
mandatory fields: 0
2012-08-16 17:00:06,797 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:148) - Total: 10
2012-08-16 17:00:06,798 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:533) - Csv record:
@org.apache.camel.dataformat.bindy.annotation.CsvRecord(isOrdered=false,
quote=, name=, crlf=WINDOWS, skipFirstLine=true,
generateHeaderColumns=true, separator=;)
2012-08-16 17:00:06,798 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:537) - Skip First Line
parameter of the CSV: {}true
2012-08-16 17:00:06,799 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:541) - Generate header
column names parameter of the CSV: true
2012-08-16 17:00:06,799 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:546) - Separator defined
for the CSV: ;
2012-08-16 17:00:06,800 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:550) - Carriage return
defined for the CSV: WINDOWS
2012-08-16 17:00:06,800 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:554) - Must CSV record
be ordered: false
2012-08-16 17:00:06,801 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:246) - Separator
converted: '0x3b', from: ;
2012-08-16 17:00:06,802 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:254) - Model object:
com.sfl.dto.csv.opportunities.OpportunitiesDTO@1d6af61[padding=<null>,opportunityId=<null>,accountId=<null>,country=<null>,opportunityType=<null>,validStartDate=<null>,validEndDate=<null>,opportunityCurrency=<null>,parentOpportunityId=<null>,salesMonitoring=<null>],
class: com.sfl.dto.csv.opportunities.OpportunitiesDTO
2012-08-16 17:00:06,802 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:416) - Value to be
formatted: null, position: 1, and its formatted value:
2012-08-16 17:00:06,803 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:416) - Value to be
formatted: null, position: 2, and its formatted value:
2012-08-16 17:00:06,803 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:416) - Value to be
formatted: null, position: 3, and its formatted value:
2012-08-16 17:00:06,804 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:416) - Value to be
formatted: null, position: 4, and its formatted value:
2012-08-16 17:00:06,804 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:416) - Value to be
formatted: null, position: 5, and its formatted value:
2012-08-16 17:00:06,805 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:416) - Value to be
formatted: null, position: 6, and its formatted value:
2012-08-16 17:00:06,805 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:416) - Value to be
formatted: null, position: 7, and its formatted value:
2012-08-16 17:00:06,806 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:416) - Value to be
formatted: null, position: 8, and its formatted value:
2012-08-16 17:00:06,807 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:416) - Value to be
formatted: null, position: 9, and its formatted value:
2012-08-16 17:00:06,807 DEBUG
(org.apache.camel.dataformat.bindy.BindyCsvFactory:416) - Value to be
formatted: null, position: 10, and its formatted value:


So pay attention to the naming of packages, it can save you time ;-).

I still remark. Since the last release of 2.10.0 camel, you can go to a
class Bindy (a model), in addition to package names (I was expecting it for
a long time :). But looking in more detail, even if you pass a class, the
scanning packages is always behind: So it's the same!. I expect this
development we can finally put all the templates in one package. Will there
plans in the next releases?

On Fri, Aug 17, 2012 at 8:37 AM, Claus Ibsen-2 [via Camel] <
ml-node+s465427n5717580h54@n5.nabble.com> wrote:

> I wonder if its related to line terminators on windows vs linux being
> different.
> There is an option on bindy to set if its windows, mac or unix. (I think)
>
>
>
> On Thu, Aug 16, 2012 at 3:17 PM, houssemgaga
> <[hidden email] <http://user/SendEmail.jtp?type=node&node=5717580&i=0>>
> wrote:
>
> > Hello,
> >
> > I use the library Bindy for quite some time, and she is great .
> > However, I recently found a problem. Let me explain:
> > I'm developing on Windows machine, everything goes well. Once deployed
> on
> > the target machine (Linux), csv files generated are not correct: the
> header
> > is not good.
> > In fact, I created for each file type csv a model object, in each
> package
> > separately. There are common fields between the models and the concern
> comes
> > from there: camel-bindy is lost when generating the header. The
> generated
> > header contains fields that come from another model.
> >
> > An example :
> > *Model 1 :*
> > @CsvRecord(separator=";", generateHeaderColumns=true,
> skipFirstLine=true)
> >  public class OpportunityDTO implements Serializable{
> >
> >         /**
> >          *
> >          */
> >         private static final long serialVersionUID = 1L;
> >
> >         @DataField(columnName = "OpportunityId", pos = 1 )
> >         String opportunityId;
> >
> >         @DataField(columnName = "AccountId", pos = 2 )
> >         String accountId;
> >
> >         @DataField(columnName = "Country", pos = 3 )
> >         String country;
> >
> >         @DataField(columnName = "OpportunityType", pos = 4 )
> >         String opportunityType;
> >
> >         @DataField(columnName = "ValidStartDate", pos = 5, pattern
> > ="\"dd/MM/yyyy\"" )
> >         Date validStartDate;
> >
> >         @DataField(columnName = "ValidEndDate", pos = 6, pattern
> ="\"dd/MM/yyyy\""
> > )
> >         Date validEndDate;
> >
> >         @DataField(columnName = "OpportunityCurrency", pos = 7 )
> >         String opportunityCurrency;
> >
> >         @DataField(columnName = "ParentOpportunityId", pos = 8 )
> >         String parentOpportunityId;
> >
> >         @DataField(columnName = "SalesMonitoring", pos = 9 )
> >         String salesMonitoring;
> >
> > // Getter and setter
> > }
> >
> > *Model 2 :*
> >         @CsvRecord(separator=";", generateHeaderColumns=true,
> skipFirstLine=true)
> > public class OpportunityLeaserDTO {
> >
> >         @DataField(columnName = "OpportunityId", pos = 1 )
> >         String opportunityId;
> >
> >         @DataField(columnName = "LeaserId", pos = 2 )
> >         String leaserID;
> >
> >         @DataField(columnName = "ValidStartDate", pos = 3, pattern
> > ="\"dd/MM/yyyy\"" )
> >         Date validStartDate;
> >
> >         @DataField(columnName = "ValidEndDate", pos = 4, pattern
> ="\"dd/MM/yyyy\""
> > )
> >         Date validEndDate;
> >         // Getter and setter
> > }
> >
> >
> >
> > For the first model "OpportunityDTO", the header is incorrect and
> generated
> > as follows:
> >
> OpportunityId;*LeaserId*;*ValidStartDate*;*ValidEndDate*;Country;ValidStartDate;ValidEndDate;ParentOpportunityId;SalesMonitoring
>
> >
> > For the second model "OpportunityLeaserDTO" the generated header is
> correct
> >
> > I still do not understand where is the problem and why only on linux???
> >
> > I use the latest release of Bindy: 2.10.0
> >
> > Thank you for your support.
> >
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/Bindy-CSV-Header-is-incorrect-tp5717531.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5717580&i=1>
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/Bindy-CSV-Header-is-incorrect-tp5717531p5717580.html
>  To unsubscribe from Bindy : CSV Header is incorrect, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5717531&code=YmVsaGFzc2luZS5ob3Vzc2VtQGdtYWlsLmNvbXw1NzE3NTMxfC01NTY4MTUyOTE=>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>



-- 
Houssem BELHASSINE
Ingénieur d'études
Tel Perso: 06 37 43 84 08




--
View this message in context: http://camel.465427.n5.nabble.com/Bindy-CSV-Header-is-incorrect-tp5717531p5717587.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Bindy : CSV Header is incorrect

Posted by Claus Ibsen <cl...@gmail.com>.
I wonder if its related to line terminators on windows vs linux being different.
There is an option on bindy to set if its windows, mac or unix. (I think)



On Thu, Aug 16, 2012 at 3:17 PM, houssemgaga
<be...@gmail.com> wrote:
> Hello,
>
> I use the library Bindy for quite some time, and she is great .
> However, I recently found a problem. Let me explain:
> I'm developing on Windows machine, everything goes well. Once deployed on
> the target machine (Linux), csv files generated are not correct: the header
> is not good.
> In fact, I created for each file type csv a model object, in each package
> separately. There are common fields between the models and the concern comes
> from there: camel-bindy is lost when generating the header. The generated
> header contains fields that come from another model.
>
> An example :
> *Model 1 :*
> @CsvRecord(separator=";", generateHeaderColumns=true, skipFirstLine=true)
>  public class OpportunityDTO implements Serializable{
>
>         /**
>          *
>          */
>         private static final long serialVersionUID = 1L;
>
>         @DataField(columnName = "OpportunityId", pos = 1 )
>         String opportunityId;
>
>         @DataField(columnName = "AccountId", pos = 2 )
>         String accountId;
>
>         @DataField(columnName = "Country", pos = 3 )
>         String country;
>
>         @DataField(columnName = "OpportunityType", pos = 4 )
>         String opportunityType;
>
>         @DataField(columnName = "ValidStartDate", pos = 5, pattern
> ="\"dd/MM/yyyy\"" )
>         Date validStartDate;
>
>         @DataField(columnName = "ValidEndDate", pos = 6, pattern ="\"dd/MM/yyyy\""
> )
>         Date validEndDate;
>
>         @DataField(columnName = "OpportunityCurrency", pos = 7 )
>         String opportunityCurrency;
>
>         @DataField(columnName = "ParentOpportunityId", pos = 8 )
>         String parentOpportunityId;
>
>         @DataField(columnName = "SalesMonitoring", pos = 9 )
>         String salesMonitoring;
>
> // Getter and setter
> }
>
> *Model 2 :*
>         @CsvRecord(separator=";", generateHeaderColumns=true, skipFirstLine=true)
> public class OpportunityLeaserDTO {
>
>         @DataField(columnName = "OpportunityId", pos = 1 )
>         String opportunityId;
>
>         @DataField(columnName = "LeaserId", pos = 2 )
>         String leaserID;
>
>         @DataField(columnName = "ValidStartDate", pos = 3, pattern
> ="\"dd/MM/yyyy\"" )
>         Date validStartDate;
>
>         @DataField(columnName = "ValidEndDate", pos = 4, pattern ="\"dd/MM/yyyy\""
> )
>         Date validEndDate;
>         // Getter and setter
> }
>
>
>
> For the first model "OpportunityDTO", the header is incorrect and generated
> as follows:
> OpportunityId;*LeaserId*;*ValidStartDate*;*ValidEndDate*;Country;ValidStartDate;ValidEndDate;ParentOpportunityId;SalesMonitoring
>
> For the second model "OpportunityLeaserDTO" the generated header is correct
>
> I still do not understand where is the problem and why only on linux???
>
> I use the latest release of Bindy: 2.10.0
>
> Thank you for your support.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Bindy-CSV-Header-is-incorrect-tp5717531.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Bindy : CSV Header is incorrect

Posted by Willem jiang <wi...@gmail.com>.
It could be easier for use if you can provide a simple test case to reproduce the error.


-- 
Willem Jiang

FuseSource
Web: http://www.fusesource.com (http://www.fusesource.com/)
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang 
Weibo: willemjiang



On Thursday, August 16, 2012 at 9:17 PM, houssemgaga wrote:

> Hello,
> 
> I use the library Bindy for quite some time, and she is great .
> However, I recently found a problem. Let me explain:
> I'm developing on Windows machine, everything goes well. Once deployed on
> the target machine (Linux), csv files generated are not correct: the header
> is not good.
> In fact, I created for each file type csv a model object, in each package
> separately. There are common fields between the models and the concern comes
> from there: camel-bindy is lost when generating the header. The generated
> header contains fields that come from another model.
> 
> An example :
> *Model 1 :*
> @CsvRecord(separator=";", generateHeaderColumns=true, skipFirstLine=true) 
> public class OpportunityDTO implements Serializable{
> 
> /**
> * 
> */
> private static final long serialVersionUID = 1L;
> 
> @DataField(columnName = "OpportunityId", pos = 1 )
> String opportunityId;
> 
> @DataField(columnName = "AccountId", pos = 2 )
> String accountId;
> 
> @DataField(columnName = "Country", pos = 3 )
> String country;
> 
> @DataField(columnName = "OpportunityType", pos = 4 )
> String opportunityType;
> 
> @DataField(columnName = "ValidStartDate", pos = 5, pattern
> ="\"dd/MM/yyyy\"" )
> Date validStartDate;
> 
> @DataField(columnName = "ValidEndDate", pos = 6, pattern ="\"dd/MM/yyyy\""
> )
> Date validEndDate;
> 
> @DataField(columnName = "OpportunityCurrency", pos = 7 )
> String opportunityCurrency;
> 
> @DataField(columnName = "ParentOpportunityId", pos = 8 )
> String parentOpportunityId;
> 
> @DataField(columnName = "SalesMonitoring", pos = 9 )
> String salesMonitoring;
> 
> // Getter and setter
> }
> 
> *Model 2 :*
> @CsvRecord(separator=";", generateHeaderColumns=true, skipFirstLine=true)
> public class OpportunityLeaserDTO {
> 
> @DataField(columnName = "OpportunityId", pos = 1 )
> String opportunityId;
> 
> @DataField(columnName = "LeaserId", pos = 2 )
> String leaserID;
> 
> @DataField(columnName = "ValidStartDate", pos = 3, pattern
> ="\"dd/MM/yyyy\"" )
> Date validStartDate;
> 
> @DataField(columnName = "ValidEndDate", pos = 4, pattern ="\"dd/MM/yyyy\""
> )
> Date validEndDate;
> // Getter and setter
> }
> 
> 
> 
> For the first model "OpportunityDTO", the header is incorrect and generated
> as follows:
> OpportunityId;*LeaserId*;*ValidStartDate*;*ValidEndDate*;Country;ValidStartDate;ValidEndDate;ParentOpportunityId;SalesMonitoring
> 
> For the second model "OpportunityLeaserDTO" the generated header is correct
> 
> I still do not understand where is the problem and why only on linux???
> 
> I use the latest release of Bindy: 2.10.0
> 
> Thank you for your support.
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Bindy-CSV-Header-is-incorrect-tp5717531.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: Bindy : CSV Header is incorrect

Posted by Charles Moulliard <ch...@gmail.com>.
Hi

Can you enable to DEBUG org.apache.camel.dataformat.bindy (log4j, ...) to
control which classes (= models) have been loaded by camel on your linux
machine ?

Regards,

Charles



On Thu, Aug 16, 2012 at 3:17 PM, houssemgaga
<be...@gmail.com>wrote:

> Hello,
>
> I use the library Bindy for quite some time, and she is great .
> However, I recently found a problem. Let me explain:
> I'm developing on Windows machine, everything goes well. Once deployed on
> the target machine (Linux), csv files generated are not correct: the header
> is not good.
> In fact, I created for each file type csv a model object, in each package
> separately. There are common fields between the models and the concern
> comes
> from there: camel-bindy is lost when generating the header. The generated
> header contains fields that come from another model.
>
> An example :
> *Model 1 :*
> @CsvRecord(separator=";", generateHeaderColumns=true, skipFirstLine=true)
>  public class OpportunityDTO implements Serializable{
>
>         /**
>          *
>          */
>         private static final long serialVersionUID = 1L;
>
>         @DataField(columnName = "OpportunityId", pos = 1 )
>         String opportunityId;
>
>         @DataField(columnName = "AccountId", pos = 2 )
>         String accountId;
>
>         @DataField(columnName = "Country", pos = 3 )
>         String country;
>
>         @DataField(columnName = "OpportunityType", pos = 4 )
>         String opportunityType;
>
>         @DataField(columnName = "ValidStartDate", pos = 5, pattern
> ="\"dd/MM/yyyy\"" )
>         Date validStartDate;
>
>         @DataField(columnName = "ValidEndDate", pos = 6, pattern
> ="\"dd/MM/yyyy\""
> )
>         Date validEndDate;
>
>         @DataField(columnName = "OpportunityCurrency", pos = 7 )
>         String opportunityCurrency;
>
>         @DataField(columnName = "ParentOpportunityId", pos = 8 )
>         String parentOpportunityId;
>
>         @DataField(columnName = "SalesMonitoring", pos = 9 )
>         String salesMonitoring;
>
> // Getter and setter
> }
>
> *Model 2 :*
>         @CsvRecord(separator=";", generateHeaderColumns=true,
> skipFirstLine=true)
> public class OpportunityLeaserDTO {
>
>         @DataField(columnName = "OpportunityId", pos = 1 )
>         String opportunityId;
>
>         @DataField(columnName = "LeaserId", pos = 2 )
>         String leaserID;
>
>         @DataField(columnName = "ValidStartDate", pos = 3, pattern
> ="\"dd/MM/yyyy\"" )
>         Date validStartDate;
>
>         @DataField(columnName = "ValidEndDate", pos = 4, pattern
> ="\"dd/MM/yyyy\""
> )
>         Date validEndDate;
>         // Getter and setter
> }
>
>
>
> For the first model "OpportunityDTO", the header is incorrect and generated
> as follows:
>
> OpportunityId;*LeaserId*;*ValidStartDate*;*ValidEndDate*;Country;ValidStartDate;ValidEndDate;ParentOpportunityId;SalesMonitoring
>
> For the second model "OpportunityLeaserDTO" the generated header is correct
>
> I still do not understand where is the problem and why only on linux???
>
> I use the latest release of Bindy: 2.10.0
>
> Thank you for your support.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Bindy-CSV-Header-is-incorrect-tp5717531.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Charles Moulliard
Apache Committer / Sr. Pr. Consultant at FuseSource.com
Twitter : @cmoulliard
Blog : http://cmoulliard.blogspot.com