Open
Description
I'm aware that the reference below points to generated code, and the culprit is whereever this code gets generated.
SonarQube correctly criticizes the approach as unnecessarily slow.
What should it do:
- replace the longest prefix that ends in either / or \ by empty string.
What it really does:
- the right thing, as above, but then also:
- for each character position of the remaining base filename try to find another / or \
that means if the basename has 100 characters it will try to re-match the regexp on 99 starting points.
My suggestion is to change the generator itself, such that the referenced line gets created that way, instead:
return filename.replaceFirst("^.*[/\\\\]", "");
I hope it makes sense and that others more into the codebase will find the relevant template or generating location instantly...
Metadata
Metadata
Assignees
Labels
No labels