On Sun, May 29, 2011 at 1:00 PM, Christian Müller <christian.muel...@gmail.com> wrote: > The problem are the wrong bean annotations. The unit test [1] should be > helpful for you. May be we can make Camel a bit smarter. > > Your correct bean annotations should look like the following: > @FixedLengthRecord(length=71, paddingChar=' ') > public class FixedLengthBean implements Serializable { > > @DataField(pos=1, length=15, pattern="000000000000000") > private long field1; > @DataField(pos=16, length=10, pattern="0000000000", required=true) > private long field2; > @DataField(pos=26, length=10, pattern="0000000000", required=true) > private long field3; > @DataField(pos=36, length=1, required=true) > private char field4; > @DataField(pos=37, length=10) > private String field5; > @DataField(pos=47, length=12, required=true) > private String field6; > @DataField(pos=59, length=1, required=true) > private char field7; > @DataField(pos=60, length=2) > private String field8; > @DataField(pos=62, length=8, pattern="yyyyMMdd") > private Date field9; > @DataField(pos=70, length=2) > private String field10; > } > With this configuration my unit test passed all tests. >
Ah so for the long/int fields we have to set pattern="000000000000" ? If so yeah that should be enhanced/fixed. Can you create a ticket? > [1] > https://svn.apache.org/repos/asf/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trim/BindySimpleFixedLengthUnmarshallTest.java > > Best, > Christian > > On Fri, May 27, 2011 at 1:37 PM, Claus Ibsen <claus.ib...@gmail.com> wrote: > >> Hi >> >> Yeah it seems odd why the field at position 9 is not grabbing further >> into the text, where the date is. >> >> Fell free to create a JIRA ticket and attach an unit test showing the >> problem. Then we can use that to fix the bug. >> >> >> On Fri, May 27, 2011 at 11:41 AM, cconesa >> <carlos.con...@rulefinancial.com> wrote: >> > <p> >> > This is my route configuration for test. I think I am using the rigth >> > bindy.. >> > </p> >> > >> > >> > <code> >> > @Configuration >> > public static class ContextConfig extends >> SingleRouteCamelConfiguration { >> > BindyFixedLengthDataFormat camelDataFormat = new >> > BindyFixedLengthDataFormat( >> > >> "org.mypckg.dataformat.fixedlength.model"); >> > >> > @Override >> > @Bean >> > public RouteBuilder route() { >> > return new RouteBuilder() { >> > @Override >> > public void configure() { >> > >> from("direct:start").marshal(camelDataFormat).to( >> > "mock:result"); >> > } >> > }; >> > } >> > } >> > </code> >> > >> > -- >> > View this message in context: >> http://camel.465427.n5.nabble.com/Issue-unmarshalling-Fixed-Length-message-date-tp4431276p4431347.html >> > Sent from the Camel - Users mailing list archive at Nabble.com. >> > >> >> >> >> -- >> Claus Ibsen >> ----------------- >> FuseSource >> Email: cib...@fusesource.com >> Web: http://fusesource.com >> CamelOne 2011: http://fusesource.com/camelone2011/ >> Twitter: davsclaus, fusenews >> Blog: http://davsclaus.blogspot.com/ >> Author of Camel in Action: http://www.manning.com/ibsen/ >> > -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com CamelOne 2011: http://fusesource.com/camelone2011/ Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/