Menu

#33 CHOICE with SEQUENCE elements

v1.5
open
Library (14)
5
2008-12-11
2008-12-11
No

I try to implement a CHOICE with SEQUENCE elements from which a single element can be selected.
The Problem when I set the first sequence, it's works fine, but when I set for example the second one, my program throws the following exception:

-------------------------------------------------------------------------
java.lang.IllegalArgumentException: The mandatory field 'farbe' does not have a value!
at org.bn.coders.CoderUtils.checkForOptionalField(CoderUtils.java:259)
at org.bn.coders.Decoder.decodeSequenceField(Decoder.java:317)
at org.bn.coders.Decoder.decodeSequence(Decoder.java:250)
at org.bn.coders.ber.BERDecoder.decodeSequence(BERDecoder.java:115)
at org.bn.metadata.ASN1SequenceMetadata.decode(ASN1SequenceMetadata.java:61)
at org.bn.coders.Decoder.decodePreparedElement(Decoder.java:162)
at org.bn.coders.Decoder.decodeClassType(Decoder.java:47)
at org.bn.coders.Decoder.decodeChoice(Decoder.java:345)
at org.bn.coders.ber.BERDecoder.decodeChoice(BERDecoder.java:323)
at org.bn.metadata.ASN1ChoiceMetadata.decode(ASN1ChoiceMetadata.java:52)
at org.bn.coders.Decoder.decodePreparedElement(Decoder.java:162)
at org.bn.coders.Decoder.decode(Decoder.java:37)
at Choice.LibTestMain.main(LibTestMain.java:84)
java.lang.IllegalArgumentException: The mandatory field 'farbe' does not have a value!
---------------------------------------------------------------

As you can see the function decodeSequenceField throws an exception and it's right, but not in case when it called from a decodeChoice function, because in this example just one SEQUENCE element from the choice could be selected and the rest of SEQUENCE elements are Null

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.