Skip to content

Commit

Permalink
read file name and line number from matched text
Browse files Browse the repository at this point in the history
  • Loading branch information
mielnikk committed Aug 30, 2024
1 parent b67720a commit 00fe8d8
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ protected LinkInTrace findLinkInTrace(String line, Matcher matchedMatcher) {
if (!enabled.getValue()) {
return super.findLinkInTrace(line, matchedMatcher);
}
final String fileName = matchedMatcher.group(1).replace('\\', '/');
final int lineNumber = Integer.parseInt(matchedMatcher.group(2));
final String file1 = matchedMatcher.group("file");
final String file2 = matchedMatcher.group("file2");

String fileName = (file1 != null ? file1 : file2).replace('\\', '/');

String lineNumber1 = matchedMatcher.group("line");
String lineNumber2 = matchedMatcher.group("line2");
int lineNumber = Integer.parseInt((lineNumber1 != null ? lineNumber1 : lineNumber2));
final int startPos = line.indexOf('\"') + 1;
final int endPos = line.indexOf('\"', startPos);
return new LinkInTrace(getCanonicalFilePath(fileName), lineNumber, startPos, endPos);
Expand Down

0 comments on commit 00fe8d8

Please sign in to comment.