You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by cconesa <ca...@rulefinancial.com> on 2011/05/27 10:54:31 UTC
Issue unmarshalling Fixed Length message date
I am having an issue when unmarshalling a message into a FixedLengthRecord.
The feed I am reading from contains the message below
00000001500014400006874510000015000L X45011S**********SCPFI20110527RT
It seems that the BindyFixedLengthFactory is not obtaining correctly the
value for field9,
it format the value 20110527 into a date, but it picks up 50001440 instead.
I am using version 2.7.1,
is FixedLength unmarshalling a supported feature?
is this a known issue or I may be defining something incorrectly?
Caused by: java.text.ParseException: Unparseable date: "50001440"
The bean
@FixedLengthRecord(length=71, paddingChar=' ')
public class FixedLengthBean implements Serializable {
@DataField(pos=1, length=15, pattern="000000000000000")
private long field1;
@DataField(pos=2, length=10, pattern="0000000000", required=true)
private long field2;
@DataField(pos=3, length=10, pattern="0000000000", required=true)
private long field3;
@DataField(pos=4, length=1, required=true)
private char field4;
@DataField(pos=5, length=10)
private String field5;
@DataField(pos=6, length=12, required=true)
private String field6;
@DataField(pos=7, length=1, required=true)
private char field7;
@DataField(pos=8, length=2)
private String field8;
@DataField(pos=9, length=8, pattern="yyyyMMdd")
private Date field9;
@DataField(pos=10, length=2)
private String field10;
...
Instantiating the bean
Map<String, Object> model = new HashMap<String, Object>();
FixedLengthBean contract= new FixedLengthBean();
contract.setField1(15000144);
contract.setField2(687451);
contract.setField3(15000);
contract.setField4('L');
contract.setField5("X45011S");
contract.setField6("**********SC");
contract.setField7('P');
contract.setField8("FI");
calendar.set(2011, 4, 27);
contract.setField9( calendar.getTime() );
contract.setField10("RT");
...
The exception
9063 [Camel (camel-1) thread #0 - file:///c:/bindy.inbound/fixedlength] WARN
org.apache.camel.component.file.GenericFileOnCompletion - Rollback file
strategy:
org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@ee1ede
for file: GenericFile[c:\bindy.inbound\fixedlength\test.txt]
9563 [Camel (camel-1) thread #0 - file:///c:/bindy.inbound/fixedlength]
ERROR org.apache.camel.processor.DefaultErrorHandler - Failed delivery for
exchangeId: ID-BAW0011-1744-1306485736643-0-32. Exhausted after delivery
attempt: 1 caught: java.lang.IllegalArgumentException: Parsing error
detected for field defined at the position/offset: 9, line: 1
java.lang.IllegalArgumentException: Parsing error detected for field defined
at the position/offset: 9, line: 1
at
org.apache.camel.dataformat.bindy.BindyFixedLengthFactory.bind(BindyFixedLengthFactory.java:229)
at
org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat.unmarshal(BindyFixedLengthDataFormat.java:141)
at
org.apache.camel.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:56)
at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:299)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:269)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:125)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:109)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
at
org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:330)
at
org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:157)
at
org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:121)
at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:97)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.text.ParseException: Unparseable date: "50001440"
at java.text.DateFormat.parse(DateFormat.java:337)
at
org.apache.camel.dataformat.bindy.format.DatePatternFormat.parse(DatePatternFormat.java:63)
at
org.apache.camel.dataformat.bindy.format.DatePatternFormat.parse(DatePatternFormat.java:29)
at
org.apache.camel.dataformat.bindy.BindyFixedLengthFactory.bind(BindyFixedLengthFactory.java:225)
... 36 more
9563 [Camel (camel-1) thread #0 - file:///c:/bindy.inbound/fixedlength] WARN
org.apache.camel.component.file.GenericFileOnCompletion - Rollback file
strategy:
org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@ee1ede
for file: GenericFile[c:\bindy.inbound\fixedlength\test.txt]
10064 [Camel (camel-1) thread #0 - file:///c:/bindy.inbound/fixedlength]
ERROR org.apache.camel.processor.DefaultErrorHandler - Failed delivery for
exchangeId: ID-BAW0011-1744-1306485736643-0-34. Exhausted after delivery
attempt: 1 caught: java.lang.IllegalArgumentException: Parsing error
detected for field defined at the position/offset: 9, line: 1
java.lang.IllegalArgumentException: Parsing error detected for field defined
at the position/offset: 9, line: 1
at
org.apache.camel.dataformat.bindy.BindyFixedLengthFactory.bind(BindyFixedLengthFactory.java:229)
at
org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat.unmarshal(BindyFixedLengthDataFormat.java:141)
at
org.apache.camel.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:56)
at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:299)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:269)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:125)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:109)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
at
org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:330)
at
org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:157)
at
org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:121)
at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:97)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.text.ParseException: Unparseable date: "50001440"
at java.text.DateFormat.parse(DateFormat.java:337)
at
org.apache.camel.dataformat.bindy.format.DatePatternFormat.parse(DatePatternFormat.java:63)
at
org.apache.camel.dataformat.bindy.format.DatePatternFormat.parse(DatePatternFormat.java:29)
at
org.apache.camel.dataformat.bindy.BindyFixedLengthFactory.bind(BindyFixedLengthFactory.java:225)
... 36 more
10064 [Camel (camel-1) thread #0 - file:///c:/bindy.inbound/fixedlength]
WARN org.apache.camel.component.file.GenericFileOnCompletion - Rollback file
strategy:
org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@ee1ede
for file: GenericFile[c:\bindy.inbound\fixedlength\test.txt]
10564 [Camel (camel-1) thread #0 - file:///c:/bindy.inbound/fixedlength]
ERROR org.apache.camel.processor.DefaultErrorHandler - Failed delivery for
exchangeId: ID-BAW0011-1744-1306485736643-0-36. Exhausted after delivery
attempt: 1 caught: java.lang.IllegalArgumentException: Parsing error
detected for field defined at the position/offset: 9, line: 1
java.lang.IllegalArgumentException: Parsing error detected for field defined
at the position/offset: 9, line: 1
at
org.apache.camel.dataformat.bindy.BindyFixedLengthFactory.bind(BindyFixedLengthFactory.java:229)
at
org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat.unmarshal(BindyFixedLengthDataFormat.java:141)
at
org.apache.camel.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:56)
at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:299)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:269)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:125)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:109)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
at
org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:330)
at
org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:157)
at
org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:121)
at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:97)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.text.ParseException: Unparseable date: "50001440"
at java.text.DateFormat.parse(DateFormat.java:337)
at
org.apache.camel.dataformat.bindy.format.DatePatternFormat.parse(DatePatternFormat.java:63)
at
org.apache.camel.dataformat.bindy.format.DatePatternFormat.parse(DatePatternFormat.java:29)
at
org.apache.camel.dataformat.bindy.BindyFixedLengthFactory.bind(BindyFixedLengthFactory.java:225)
... 36 more
10564 [Camel (camel-1) thread #0 - file:///c:/bindy.inbound/fixedlength]
WARN org.apache.camel.component.file.GenericFileOnCompletion - Rollback file
strategy:
org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@ee1ede
for file: GenericFile[c:\bindy.inbound\fixedlength\test.txt]
11064 [Camel (camel-1) thread #0 - file:///c:/bindy.inbound/fixedlength]
ERROR org.apache.camel.processor.DefaultErrorHandler - Failed delivery for
exchangeId: ID-BAW0011-1744-1306485736643-0-38. Exhausted after delivery
attempt: 1 caught: java.lang.IllegalArgumentException: Parsing error
detected for field defined at the position/offset: 9, line: 1
java.lang.IllegalArgumentException: Parsing error detected for field defined
at the position/offset: 9, line: 1
at
org.apache.camel.dataformat.bindy.BindyFixedLengthFactory.bind(BindyFixedLengthFactory.java:229)
at
org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat.unmarshal(BindyFixedLengthDataFormat.java:141)
at
org.apache.camel.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:56)
at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:299)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:269)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:125)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:109)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
at
org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:330)
at
org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:157)
at
org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:121)
at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:97)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.text.ParseException: Unparseable date: "50001440"
at java.text.DateFormat.parse(DateFormat.java:337)
at
org.apache.camel.dataformat.bindy.format.DatePatternFormat.parse(DatePatternFormat.java:63)
at
org.apache.camel.dataformat.bindy.format.DatePatternFormat.parse(DatePatternFormat.java:29)
at
org.apache.camel.dataformat.bindy.BindyFixedLengthFactory.bind(BindyFixedLengthFactory.java:225)
... 36 more
11064 [Camel (camel-1) thread #0 - file:///c:/bindy.inbound/fixedlength]
WARN org.apache.camel.component.file.GenericFileOnCompletion - Rollback file
strategy:
org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@ee1ede
for file: GenericFile[c:\bindy.inbound\fixedlength\test.txt]
27-May-2011 10:42:27
org.springframework.context.support.AbstractApplicationContext doClose
--
View this message in context: http://camel.465427.n5.nabble.com/Issue-unmarshalling-Fixed-Length-message-date-tp4431276p4431276.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Issue unmarshalling Fixed Length message date
Posted by Christian Müller <ch...@gmail.com>.
If you use the BindyFixedLengthDataFormat, the pos attribute (lowered by
one) describes the start position of this field and the length attribute the
length of the attribute. This means for this example, because the first
field has a length of 15 characters, it must be annotated with pos=1,
length=15. The second field also has a length of 10 characters, it must be
annotated with pos=16, length=10.
the value of the pos attribute must be the value of the pos attribute of the
previous field plus the value of the length attribute of the previous field.
For field 2: 1 + 15 = 16
Best,
Christian
On Mon, May 30, 2011 at 11:50 AM, Claus Ibsen <cl...@gmail.com> wrote:
> On Sun, May 29, 2011 at 11:46 PM, Christian Müller
> <ch...@gmail.com> wrote:
> > The problem was the wrong pos parameter in the @DataField annotation. We
> > cannot use pos=1, pos=2, pos=3 and so on, if the fields are longer than
> only
> > one character.
> >
>
> Weird. Can you highlight this, eg the problem?
>
> I would expect the pos attribute to be mandatory and unique, to
> indicate the order of the fields.
>
>
> > Christian
> >
> > On Sun, May 29, 2011 at 2:27 PM, Claus Ibsen <cl...@gmail.com>
> wrote:
> >
> >> On Sun, May 29, 2011 at 1:00 PM, Christian Müller
> >> <ch...@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 <cl...@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
> >> >> <ca...@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: cibsen@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: cibsen@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: cibsen@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/
>
Re: Issue unmarshalling Fixed Length message date
Posted by Claus Ibsen <cl...@gmail.com>.
On Sun, May 29, 2011 at 11:46 PM, Christian Müller
<ch...@gmail.com> wrote:
> The problem was the wrong pos parameter in the @DataField annotation. We
> cannot use pos=1, pos=2, pos=3 and so on, if the fields are longer than only
> one character.
>
Weird. Can you highlight this, eg the problem?
I would expect the pos attribute to be mandatory and unique, to
indicate the order of the fields.
> Christian
>
> On Sun, May 29, 2011 at 2:27 PM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> On Sun, May 29, 2011 at 1:00 PM, Christian Müller
>> <ch...@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 <cl...@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
>> >> <ca...@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: cibsen@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: cibsen@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: cibsen@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/
Re: Issue unmarshalling Fixed Length message date
Posted by Christian Müller <ch...@gmail.com>.
The problem was the wrong pos parameter in the @DataField annotation. We
cannot use pos=1, pos=2, pos=3 and so on, if the fields are longer than only
one character.
Christian
On Sun, May 29, 2011 at 2:27 PM, Claus Ibsen <cl...@gmail.com> wrote:
> On Sun, May 29, 2011 at 1:00 PM, Christian Müller
> <ch...@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 <cl...@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
> >> <ca...@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: cibsen@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: cibsen@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/
>
Re: Issue unmarshalling Fixed Length message date
Posted by Claus Ibsen <cl...@gmail.com>.
On Sun, May 29, 2011 at 1:00 PM, Christian Müller
<ch...@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 <cl...@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
>> <ca...@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: cibsen@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: cibsen@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/
Re: Issue unmarshalling Fixed Length message date
Posted by Christian Müller <ch...@gmail.com>.
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.
[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 <cl...@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
> <ca...@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: cibsen@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/
>
Re: Issue unmarshalling Fixed Length message date
Posted by Claus Ibsen <cl...@gmail.com>.
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
<ca...@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: cibsen@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/
Re: Issue unmarshalling Fixed Length message date
Posted by cconesa <ca...@rulefinancial.com>.
<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.
Re: Issue unmarshalling Fixed Length message date
Posted by Claus Ibsen <cl...@gmail.com>.
Can you ost the camel route. Make sure you set bindy to fixed mode in the route
On Friday, May 27, 2011, cconesa <ca...@rulefinancial.com> wrote:
> I am having an issue when unmarshalling a message into a FixedLengthRecord.
> The feed I am reading from contains the message below
>
>
> 00000001500014400006874510000015000L X45011S**********SCPFI20110527RT
>
>
> It seems that the BindyFixedLengthFactory is not obtaining correctly the
> value for field9,
> it format the value 20110527 into a date, but it picks up 50001440 instead.
>
> I am using version 2.7.1,
> is FixedLength unmarshalling a supported feature?
> is this a known issue or I may be defining something incorrectly?
>
>
>
> Caused by: java.text.ParseException: Unparseable date: "50001440"
>
>
> The bean
>
>
> @FixedLengthRecord(length=71, paddingChar=' ')
> public class FixedLengthBean implements Serializable {
>
> @DataField(pos=1, length=15, pattern="000000000000000")
> private long field1;
> @DataField(pos=2, length=10, pattern="0000000000", required=true)
> private long field2;
> @DataField(pos=3, length=10, pattern="0000000000", required=true)
> private long field3;
> @DataField(pos=4, length=1, required=true)
> private char field4;
> @DataField(pos=5, length=10)
> private String field5;
> @DataField(pos=6, length=12, required=true)
> private String field6;
> @DataField(pos=7, length=1, required=true)
> private char field7;
> @DataField(pos=8, length=2)
> private String field8;
> @DataField(pos=9, length=8, pattern="yyyyMMdd")
> private Date field9;
> @DataField(pos=10, length=2)
> private String field10;
> ...
>
>
> Instantiating the bean
>
>
> Map<String, Object> model = new HashMap<String, Object>();
> FixedLengthBean contract= new FixedLengthBean();
> contract.setField1(15000144);
> contract.setField2(687451);
> contract.setField3(15000);
> contract.setField4('L');
> contract.setField5("X45011S");
> contract.setField6("**********SC");
> contract.setField7('P');
> contract.setField8("FI");
> calendar.set(2011, 4, 27);
> contract.setField9( calendar.getTime() );
> contract.setField10("RT");
> ...
>
>
> The exception
>
>
> 9063 [Camel (camel-1) thread #0 - file:///c:/bindy.inbound/fixedlength] WARN
> org.apache.camel.component.file.GenericFileOnCompletion - Rollback file
> strategy:
> org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@ee1ede
> for file: GenericFile[c:\bindy.inbound\fixedlength\test.txt]
> 9563 [Camel (camel-1) thread #0 - file:///c:/bindy.inbound/fixedlength]
> ERROR org.apache.camel.processor.DefaultErrorHandler - Failed delivery for
> exchangeId: ID-BAW0011-1744-1306485736643-0-32. Exhausted after delivery
> attempt: 1 caught: java.lang.IllegalArgumentException: Parsing error
> detected for field defined at the position/offset: 9, line: 1
> java.lang.IllegalArgumentException: Parsing error detected for field defined
> at the position/offset: 9, line: 1
> at
> org.apache.camel.dataformat.bindy.BindyFixedLengthFactory.bind(BindyFixedLengthFactory.java:229)
> at
> org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat.unmarshal(BindyFixedLengthDataFormat.java:141)
> at
> org.apache.camel.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:56)
> at
> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
> at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
> at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
> at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:299)
> at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)
> at
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:269)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:125)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
> at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:109)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
> at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
> at
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:330)
> at
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:157)
> at
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:121)
> at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:97)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at
> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
> Caused by: java.text.ParseException: Unparseable date: "50001440"
> at java.text.DateFormat.parse(DateFormat.java:337)
> at
> org.apache.camel.dataformat.bindy.format.DatePatternFormat.parse(DatePatternFormat.java:63)
> at
> org.apache.camel.dataformat.bindy.format.DatePatternFormat.parse(DatePatternFormat.java:29)
> at
> org.apache.camel.dataformat.bindy.BindyFixedLengthFactory.bind(BindyFixedLengthFactory.java:225)
> ... 36 more
> 9563 [Camel (camel-1) thread #0 - file:///c:/bindy.inbound/fixedlength] WARN
> org.apache.camel.component.file.GenericFileOnCompletion - Rollback file
> strategy:
> org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@ee1ede
> for file: GenericFile[c:\bindy.inbound\fixedlength\test.txt]
> 10064 [Camel (camel-1) thread #0 - file:///c:/bindy.inbound/fixedlength]
> ERROR org.apache.camel.processor.DefaultErrorHandler - Failed delivery for
> exchangeId: ID-BAW0011-1744-1306485736643-0-34. Exhausted after delivery
> attempt: 1 caught: java.lang.IllegalArgumentException: Parsing error
> detected for field defined at the position/offset: 9, line: 1
> java.lang.IllegalArgumentException: Parsing error detected for field defined
> at the position/offset: 9, line: 1
> at
> org.apache.camel.dataformat.bindy.BindyFixedLengthFactory.bind(BindyFixedLengthFactory.java:229)
> at
> org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat.unmarshal(BindyFixedLengthDataFormat.java:141)
> at
> org.apache.camel.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:56)
> at
> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
> at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
> at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
> at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:299)
> at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)
> at
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:269)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:125)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
> at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:109)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
> at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
> at
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:330)
> at
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:157)
> at
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:121)
> at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:97)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at
> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
> Caused by: java.text.ParseException: Unparseable date: "50001440"
> at java.text.DateFormat.parse(DateFormat.java:337)
> at
> org.apache.camel.dataformat.bindy.format.DatePatternFormat.parse(DatePatternFormat.java:63)
> at
> org.apache.camel.dataformat.bindy.format.DatePatternFormat.parse(DatePatternFormat.java:29)
> at
> org.apache.camel.dataformat.bindy.BindyFixedLengthFactory.bind(BindyFixedLengthFactory.java:225)
> ... 36 more
> 10064 [Camel (camel-1) thread #0 - file:///c:/bindy.inbound/fixedlength]
> WARN org.apache.camel.component.file.GenericFileOnCompletion - Rollback file
> strategy:
> org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@ee1ede
> for file: GenericFile[c:\bindy.inbound\fixedlength\test.txt]
> 10564 [Camel (camel-1) thread #0 - file:///c:/bindy.inbound/fixedlength]
> ERROR org.apache.camel.processor.DefaultErrorHandler - Failed delivery for
> exchangeId: ID-BAW0011-1744-1306485736643-0-36. Exhausted after delivery
> attempt: 1 caught: java.lang.IllegalArgumentException: Parsing error
> detected for field defined at the position/offset: 9, line: 1
> java.lang.IllegalArgumentException: Parsing error detected for field defined
> at the position/offset: 9, line: 1
> at
> org.apache.camel.dataformat.bindy.BindyFixedLengthFactory.bind(BindyFixedLengthFactory.java:229)
> at
> org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat.unmarshal(BindyFixedLengthDataFormat.java:141)
> at
> org.apache.camel.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:56)
> at
> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
> at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
> at
> org.apache.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Issue-unmarshalling-Fixed-Length-message-date-tp4431276p4431276.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@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/