Skip to content

XER: untagged optional union decoding error

Summary

The XER decoder doesn't move on to the next record/set field if an untagged optional field of union type fails to decode.

Original report: https://www.eclipse.org/forums/index.php/t/1110154/

Steps and/or TTCN-3 code to reproduce

module xml {

type record Rec {
  integer num,
  Uni1 u1 optional,
  Uni2 u2
}

type union Uni1 {
  charstring x1,
  octetstring x2
}
with {
  variant "untagged";
}

type union Uni2 {
  charstring y1,
  octetstring y2
}
with {
  variant "untagged";
}

control {
  var Rec y; // { 4, omit, { y2 := 'ABCD'O } };
  var universal charstring x := "<ns:Rec xmlns:ns='www.somewhere.com/xml2'>\n\t<ns:num>4</ns:num>\n\t<ns:y2>ABCD</ns:y2>\n</ns:Rec>\n\n";
  var integer res := decvalue_unichar(x, y);
  action(res);
  action(y);
}

}
with {
  encode "XML";
  variant "elementFormQualified";
  variant "namespace as 'www.somewhere.com/xml2' prefix 'ns'";
  variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
}

What is the current bug behavior?

XER decoding error: While XER-decoding type '@xml.Rec': Component 'u1': 'y2' does not match any alternative

What is the expected correct behavior?

Set the optional union field to 'omit' and continue decoding the next field.

Relevant logs and/or screenshots

Possible fixes

Likely something similar to issue #212 (closed).

Titan version

8.1.0

Platform details (OS type and version)

any

/cc @aknappqwt