Skip to content

Commit

Permalink
Unmapped polymorphic elements will no longer be added to collections …
Browse files Browse the repository at this point in the history
…as nulls
  • Loading branch information
alturkovic committed Sep 18, 2020
1 parent 46f323a commit 41c8a52
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.github.alturkovic</groupId>
<artifactId>asn-parser</artifactId>
<version>1.4.1</version>
<version>1.4.2</version>

<name>asn-parser</name>
<description>ASN.1 Decoding/Encoding</description>
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/github/alturkovic/asn/decoder/BerDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ private void decodeCollection(final Collection<Object> collection, final byte[]

if (taggedField.getType().isInterface()) {
final var asnClassDescription = loadAsnClassDescription(taggedField.getType());
collection.add(decodePolymorphic(asnClassDescription, elementBerData.toTlv()));
final var decodedType = decodePolymorphic(asnClassDescription, elementBerData.toTlv());
if (decodedType != null) {
collection.add(decodedType);
}
} else if (taggedField.getElementTag().equals(parsedElementTag)) {
if (taggedField.isStructured()) {
final Object decoded = decodeStructure(taggedField.getType(), elementBerData.toTlv());
if (decoded != null) {
collection.add(decoded);
}
collection.add(decodeStructure(taggedField.getType(), elementBerData.toTlv()));
} else {
//noinspection unchecked
final var asnConverter = loadAsnConverterFromCache((Class<? extends AsnConverter<byte[], Object>>) taggedField.getConverter());
Expand Down

0 comments on commit 41c8a52

Please sign in to comment.