Committing small patch for CPD (Ruby). See https://sourceforge.net/tracker/index.php?func=detail&aid=2338341&group_id=56262&atid=479921 for more details. This small fix does not break unit test, but more testing will be nice.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/4.2.x@6698 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Romain Pelisse 2008-11-24 19:04:55 +00:00
parent 51ca03348c
commit 6836ae8bcd

View File

@ -126,8 +126,8 @@ public class SourceCode {
public String getSlice(int startLine, int endLine) {
StringBuffer sb = new StringBuffer();
List lines = cl.getCode();
for (int i = startLine - 1; i < endLine && i < lines.size(); i++) {
if (sb.length() != 0) {
for (int i = (startLine == 0 ? startLine :startLine - 1); i < endLine && i < lines.size(); i++) {
if (sb.length() != 0) {
sb.append(PMD.EOL);
}
sb.append((String) lines.get(i));