[QFJ-801] Validation fail on ClassCastException if using XML Created: 14/Jul/14 Updated: 14/Jul/14 |
|
Status: | Open |
Project: | QuickFIX/J |
Component/s: | Engine |
Affects Version/s: | 1.5.3 |
Fix Version/s: | None |
Type: | Bug | Priority: | Default |
Reporter: | Benoit Xhenseval | Assignee: | Unassigned |
Resolution: | Unresolved | Votes: | 0 |
Labels: | validation | ||
Environment: |
Mac OSX |
Attachments: | IOIValidation.java |
Description |
It appears that the Message validation fails on a ClassCastException if the message contains the XmlDataLen tag. Example: It seems that the validation code only expects StringField but the XmlDataLen is an IntField. The output is: Testing WITHOUT XML 8=FIXT.1.19=7935=649=Sender56=Target15=USD22=523=IOD-127=M28=N48=IBM.N54=255=IBM.N10=079 Testing WITH XML 8=FIXT.1.19=10335=649=Sender56=Target212=12213=<a>Hello</a>15=USD22=523=IOD-127=M28=N48=IBM.N54=255=IBM.N10=086 Exception in thread "main" java.lang.ClassCastException: quickfix.field.XmlDataLen cannot be cast to quickfix.StringField at quickfix.DataDictionary.iterate(DataDictionary.java:668) at quickfix.DataDictionary.validate(DataDictionary.java:653) at quickfix.DataDictionary.validate(DataDictionary.java:624) at quickfix.DataDictionary.validate(DataDictionary.java:606) at fixfun.IOIValidation.validateIoi(IOIValidation.java:45) at fixfun.IOIValidation.validateIoiWithXml(IOIValidation.java:37) at fixfun.IOIValidation.main(IOIValidation.java:78) |
Comments |
Comment by Benoit Xhenseval [ 14/Jul/14 ] |
test case. |
Comment by Christoph John [ 14/Jul/14 ] |
It turned out that the setField( int, Field<?> ) method should rather not be used with non-String tags. Rather use setField( Field ), e.g.: Of course, there should be means to prevent your original error. Either setField( int, Field<?> ) should convert the values (as setField( Field ) does) or the validate-method should not assume that all fields are Strings. |