Skip to content

Commit 8a49e18

Browse files
committed
Address review
1 parent cd1f4c2 commit 8a49e18

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

sentry-android-core/src/main/java/io/sentry/android/core/AnrIntegration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void reportANR(
144144
if (thread == null) {
145145
error = new ApplicationNotResponding(message);
146146
} else {
147-
error = new ApplicationNotResponding(message, anr.getThread());
147+
error = new ApplicationNotResponding(message, thread);
148148
}
149149

150150
final Mechanism mechanism = new Mechanism();

sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfilingIntegration.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -95,24 +95,24 @@ public void close() throws IOException {
9595
}
9696

9797
final @Nullable SentryAndroidOptions opts = options;
98+
final @Nullable AnrProfileManager pm;
99+
try (final @NotNull ISentryLifecycleToken ignored = profileManagerLock.acquire()) {
100+
pm = profileManager;
101+
profileManager = null;
102+
}
98103
if (opts != null) {
99104
try {
100105
opts.getExecutorService()
101106
.submit(
102-
new Runnable() {
103-
@Override
104-
public void run() {
105-
try (final @NotNull ISentryLifecycleToken ignored =
106-
profileManagerLock.acquire()) {
107-
if (profileManager != null) {
108-
//noinspection DataFlowIssue
109-
profileManager.close();
110-
}
111-
} catch (IOException e) {
112-
logger.log(SentryLevel.WARNING, "Failed to close AnrProfileManager");
113-
} finally {
114-
profileManager = null;
115-
}
107+
() -> {
108+
if (pm == null) {
109+
return;
110+
}
111+
112+
try {
113+
pm.close();
114+
} catch (IOException e) {
115+
logger.log(SentryLevel.WARNING, "Failed to close AnrProfileManager");
116116
}
117117
});
118118
} catch (Throwable e) {

0 commit comments

Comments
 (0)