Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow any Collection to be encoded as OPAQUE in NDK metadata #1728

Merged
merged 1 commit into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -11,7 +11,9 @@

import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;

public class CXXConfigurationMetadataNativeCrashScenario extends Scenario {

Expand Down Expand Up @@ -54,6 +56,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