Skip to content

Commit

Permalink
Merge pull request #59 from hansemannn/androidFix
Browse files Browse the repository at this point in the history
fix(android): split length
  • Loading branch information
hansemannn authored Sep 23, 2022
2 parents e347d53 + 298f072 commit ef28671
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion android/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 2.5.0
version: 2.5.1
apiversion: 4
architectures: arm64-v8a armeabi-v7a x86 x86_64
description: titanium-crashlytics
Expand Down
34 changes: 18 additions & 16 deletions android/src/ti/crashlytics/TitaniumCrashlyticsModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,25 @@ public static StackTraceElement[] generateStackTrace(String javaStack, String js

String fileName = "";
int lineNumber = 0;
if (splitByParen[1].indexOf(":") > -1) {
String[] insideParen = splitByParen[1].split(":");
for (int j = 0; j < insideParen.length; j++) {
if ((insideParen[j].matches("[0-9]+"))) {
// within the parenthesis, the first number is the line number, for both javaStack and jsStack
lineNumber = Integer.parseInt(insideParen[j]);
break;
} else {
// within the parenthesis, everything before first number is the fileName
fileName += insideParen[j] + ":";
}
if (splitByParen.length > 1) {
if (splitByParen[1].indexOf(":") > -1) {
String[] insideParen = splitByParen[1].split(":");
for (int j = 0; j < insideParen.length; j++) {
if ((insideParen[j].matches("[0-9]+"))) {
// within the parenthesis, the first number is the line number, for both javaStack and jsStack
lineNumber = Integer.parseInt(insideParen[j]);
break;
} else {
// within the parenthesis, everything before first number is the fileName
fileName += insideParen[j] + ":";
}
}
// remove extra ":"
fileName = fileName.substring(0, fileName.length() - 1);
} else {
fileName = splitByParen[1];
lineNumber = 0;
}
// remove extra ":"
fileName = fileName.substring(0, fileName.length() - 1);
} else {
fileName = splitByParen[1];
lineNumber = 0;
}

int lastIndex = splitByParen[0].lastIndexOf('.');
Expand Down

0 comments on commit ef28671

Please sign in to comment.