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

fix: 🐛 for throwing NPE during initializing middleware android sdk #8

Merged
merged 3 commits into from
Apr 29, 2024
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
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ dependencies {
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+"
implementation ('io.github.middleware-labs:android-sdk:2.0.4')
implementation ('io.github.middleware-labs:android-sdk:2.0.5')
implementation 'io.opentelemetry.android:instrumentation:+'
implementation 'io.opentelemetry:opentelemetry-sdk:+'
runtimeOnly 'io.opentelemetry:opentelemetry-semconv:1.30.1-alpha'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ public void initialize(ReadableMap configMap, Promise promise) {
.setGlobalAttributes(attributesFromMap(globalAttributes))
.setDeploymentEnvironment(deploymentEnvironment)
.disableActivityLifecycleMonitoring()
.build(Objects.requireNonNull(getReactApplicationContext().getCurrentActivity()).getApplication());
.build((Application) getReactApplicationContext().getApplicationContext());

if("true".equals(sessionRecording)) {
if (Boolean.TRUE.toString().equals(sessionRecording)) {
Middleware middleware = Middleware.getInstance();
middleware.startNativeRecording(getCurrentActivity());
}
Expand All @@ -103,7 +103,8 @@ public void nativeCrash() {
new Thread(() -> {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {}
} catch (InterruptedException e) {
}
throw new RuntimeException("test crash");
Archish27 marked this conversation as resolved.
Show resolved Hide resolved
}).start();
}
Expand Down Expand Up @@ -242,7 +243,7 @@ private ReactSpanProperties propertiesFromMap(SpanMapReader mapReader) {

final ReadableArray readerEvents = mapReader.getEvents();
final List<EventData> newEvents = new ArrayList<>();
for(int index = 0; index < readerEvents.size(); index++) {
for (int index = 0; index < readerEvents.size(); index++) {
Archish27 marked this conversation as resolved.
Show resolved Hide resolved
final ReadableMap readableMap = readerEvents.getMap(index);
final EventData eventData = EventData.create(
Long.parseLong(Objects.requireNonNull(readableMap.getString("time"))),
Expand Down
Loading