Skip to content

Commit

Permalink
fix(ndk): allow any Collection to be encoded as OPAQUE in NDK metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
lemnik committed Aug 8, 2022
1 parent 0605baf commit 70bef5f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## TBD

### Bug fixes

* Non-List Collections are now correctly handled as OPAQUE values for NDK metadata
[#1728](https://github.com/bugsnag/bugsnag-android/pull/1728)

## 5.25.0 (2022-07-19)

### Enhancements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ internal class OpaqueValue(val json: String) {
value is Boolean -> value
value is Number -> value
value is String && isStringNDKSupported(value) -> value
value is String || value is Map<*, *> || value is List<*> -> OpaqueValue(encode(value))
value is String || value is Map<*, *> || value is Collection<*> -> OpaqueValue(encode(value))
else -> null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.LinkedHashMap;

public class CXXConfigurationMetadataNativeCrashScenario extends Scenario {

Expand Down Expand Up @@ -54,6 +55,11 @@ public CXXConfigurationMetadataNativeCrashScenario(@NonNull Configuration config
"spring",
"autumn"
));

Set<String> set = new LinkedHashSet<>();
set.add("value1");
set.add("2value");
config.addMetadata("complex", "set", set);
}
}

Expand Down
2 changes: 2 additions & 0 deletions features/full_tests/native_metadata.feature
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Feature: Native Metadata API
And the event "metaData.complex.list.1" equals "winter"
And the event "metaData.complex.list.2" equals "spring"
And the event "metaData.complex.list.3" equals "autumn"
And the event "metaData.complex.set.0" equals "value1"
And the event "metaData.complex.set.1" equals "2value"
And the event "unhandled" is true

Scenario: Remove MetaData from the NDK layer
Expand Down

0 comments on commit 70bef5f

Please sign in to comment.