Skip to content

Commit 44ba30f

Browse files
committed
refactor tombstone java frame name normalization
1 parent 1fdf9f5 commit 44ba30f

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

sentry-android-core/src/main/java/io/sentry/android/core/internal/tombstone/TombstoneParser.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,9 @@ private SentryStackTrace createStackTrace(@NonNull final TombstoneThread thread)
152152
final SentryStackFrame stackFrame = new SentryStackFrame();
153153
if (isJavaFrame(frame)) {
154154
stackFrame.setPlatform("java");
155-
final String module = extractJavaModuleName(frame.functionName);
156-
stackFrame.setFunction(extractJavaFunctionName(frame.functionName));
155+
final String normalizedFunctionName = normalizeFunctionName(frame.functionName);
156+
final String module = extractJavaModuleName(normalizedFunctionName);
157+
stackFrame.setFunction(extractJavaFunctionName(normalizedFunctionName));
157158
stackFrame.setModule(module);
158159

159160
// For Java frames, check in-app against the module (package name), which is what
@@ -217,21 +218,19 @@ private static String normalizeFunctionName(String fqFunctionName) {
217218
return normalized;
218219
}
219220

220-
private static @Nullable String extractJavaModuleName(String fqFunctionName) {
221-
final String normalized = normalizeFunctionName(fqFunctionName);
222-
if (normalized.contains(".")) {
223-
return normalized.substring(0, normalized.lastIndexOf("."));
221+
private static @Nullable String extractJavaModuleName(String normalizedFunctionName) {
222+
if (normalizedFunctionName.contains(".")) {
223+
return normalizedFunctionName.substring(0, normalizedFunctionName.lastIndexOf("."));
224224
} else {
225225
return null;
226226
}
227227
}
228228

229-
private static @Nullable String extractJavaFunctionName(String fqFunctionName) {
230-
final String normalized = normalizeFunctionName(fqFunctionName);
231-
if (normalized.contains(".")) {
232-
return normalized.substring(normalized.lastIndexOf(".") + 1);
229+
private static @Nullable String extractJavaFunctionName(String normalizedFunctionName) {
230+
if (normalizedFunctionName.contains(".")) {
231+
return normalizedFunctionName.substring(normalizedFunctionName.lastIndexOf(".") + 1);
233232
} else {
234-
return normalized;
233+
return normalizedFunctionName;
235234
}
236235
}
237236

0 commit comments

Comments
 (0)