Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[java] CommentUtil.multiLinesIn() could lead to StringIndexOutOfBoundsException #1174
Affects PMD Version: latest version
Description: I'm working to develop my own comment rule to find all code in comment , then I use CommentUtils. I tried to multiline the comment ,but found StringIndexOutOfBoundsException when testing by a test project. actually, it happens in line 108,when it goes to charAt(0)
because sometime we make a comment like this
In line 3,when using CommentUtil.multiLinesIn(),this variable string line = "",cause there is nothing!
or we can use if("".equals(line)) to check it.
@phinehasz thanks for the report, that is effectively a bug.
However, bare in mind this class
We will for sure fix this in 6.5.0 release, but along the way we will most probably just deprecate the whole class to flag it for removal in 7.0.0. We will aim to move actually needed behavior into