[QFJ-636] Custom fields in component blocks are not added to parent Created: 26/Sep/11  Updated: 17/Jun/20  Resolved: 03/Jun/20

Status: Closed
Project: QuickFIX/J
Component/s: None
Affects Version/s: 1.5.0
Fix Version/s: 2.2.0

Type: Bug Priority: Major
Reporter: Mate Varga Assignee: Marcin L
Resolution: Fixed Votes: 0
Labels: None


 Description   

I'm creating an Instrument repeating group and I want to add a custom field to it – this works fine so far.

Instrument instrument = new Instrument(new Symbol("VOD.L"));
instrument.set(new SecurityID("GB012345689"));
instrument.set(new SecurityIDSource(SecurityIDSource.ISIN_NUMBER));
instrument.set(new SecurityExchange("L"));
instrument.setString(9001, "BLAH");

However, if I add that instrument group to another fieldmap, like
QuoteRequest.NoRelatedSym nrs = new QuoteRequest.NoRelatedSym();
nrs.set(instrument);

... then the custom field won't be copied. I know that regenerating QuickFix using the extended data dictionary would solve the problem, but this should not be required.

The problem lies in MessageComponent.java:

public void copyFrom(FieldMap fields) {
try {
int[] componentFields = getFields();
for (int i = 0; i < componentFields.length; i++) {
if (fields.isSetField(componentFields[i]))

{ setField(componentFields[i], fields.getField(componentFields[i])); }

}

This shows that copyFrom (used by FieldMap.set()) only copies the fields which are present in the data dictionary.



 Comments   
Comment by Mate Varga [ 03/Oct/11 ]

If a project owner confirms that this is a bug, then I'm happy to submit a patch.

Comment by Christoph John [ 19/Dec/13 ]

Sounds like a bug to me...

Generated at Mon Apr 29 11:13:37 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.