You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by s2010in <sa...@mphasis.com> on 2011/01/19 18:29:05 UTC

Camel 2.4.0 BindyFixedLengthDataFormat does a trim on Fixed Length record

BindyFixedLengthDataFormat does a trim on Fixed Length record, although Fixed
Length recordare strictly positional in nature and may contain lot of
fillers with empty spaces, doing a trim causes Bindy to fail the message
length validation and exception is thrown on message length

// Read the line
String line = scanner.nextLine().trim();

Should be changed to 

// Read the line
String line = scanner.nextLine();

Or a conditional option should be provided in FixedLengthRecord annotation
whether or not to trim the entire record
-- 
View this message in context: http://camel.465427.n5.nabble.com/Camel-2-4-0-BindyFixedLengthDataFormat-does-a-trim-on-Fixed-Length-record-tp3348188p3348188.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel 2.4.0 BindyFixedLengthDataFormat does a trim on Fixed Length record

Posted by Ashwin Karpe <ak...@fusesource.com>.
Hi,

I agree. It certainly looks like there could be an option introduced here so
that we do not break existing users (bug may have graduated to feature) and
support this requirement with a switch/option.

I have raised a JIRA issue shown below. Please add yourself as a watcher.
BTW, you are also welcome to submit a patch if you are so inclined :) 

https://issues.apache.org/jira/browse/CAMEL-3562
https://issues.apache.org/jira/browse/CAMEL-3562 

Cheers,

Ashwin...

-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com
http://opensourceknowledge.blogspot.com 
---------------------------------------------------------
-- 
View this message in context: http://camel.465427.n5.nabble.com/Camel-2-4-0-BindyFixedLengthDataFormat-does-a-trim-on-Fixed-Length-record-tp3348188p3348840.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel 2.4.0 BindyFixedLengthDataFormat does a trim on Fixed Length record

Posted by Ashwin Karpe <ak...@fusesource.com>.
BTW, I have starting work on this request. Stay tuned to the issue.

Cheers,

Ashwin...

-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com
http://opensourceknowledge.blogspot.com 
---------------------------------------------------------
-- 
View this message in context: http://camel.465427.n5.nabble.com/Camel-2-4-0-BindyFixedLengthDataFormat-does-a-trim-on-Fixed-Length-record-tp3348188p3348869.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel 2.4.0 BindyFixedLengthDataFormat does a trim on Fixed Length record

Posted by s2010in <sa...@mphasis.com>.
Thanks for the fix Ashwin, I checked out the test case on my local using
Camel 2.5.0 to verify it fails as expected and it does 

Please let me know as I have never done this before, how to get the fixed
code, which version of Camel should be downloaded? or do we need to build
the Camel Bindy locally for implementing the fix


-- 
View this message in context: http://camel.465427.n5.nabble.com/Camel-2-4-0-BindyFixedLengthDataFormat-does-a-trim-on-Fixed-Length-record-tp3348188p3350244.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel 2.4.0 BindyFixedLengthDataFormat does a trim on Fixed Length record

Posted by Ashwin Karpe <ak...@fusesource.com>.
Hi,

I have just committed a fix for this issue to the camel trunk.

Can you please check out this fix. I have added an option to the
FixedLengthRecord annotation called trimRecordOnUnmarshal which takes a
boolean with default set to true so that existing users are not impacted. In
your case you need to set this annotation to false. A unit test for this fix
is available at

https://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/notrim/BindySimpleFixedLengthNoTrimUnmarshallTest.java?view=markup
https://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/notrim/BindySimpleFixedLengthNoTrimUnmarshallTest.java?view=markup 

Please check it out.

Cheers,

Ashwin...


-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com
http://opensourceknowledge.blogspot.com 
---------------------------------------------------------
-- 
View this message in context: http://camel.465427.n5.nabble.com/Camel-2-4-0-BindyFixedLengthDataFormat-does-a-trim-on-Fixed-Length-record-tp3348188p3350109.html
Sent from the Camel - Users mailing list archive at Nabble.com.