Fix 1909929 - clean violation review is not selective enough

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5888 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Ryan Gustafson 2008-03-11 01:21:10 +00:00
parent 1e810aa4e1
commit 8c0e1d6b3d

View File

@ -266,6 +266,10 @@ public class ClearReviewsAction implements IObjectActionDelegate, IResourceVisit
* @return
*/
private String removeReviews(IFile file) {
String name = file.getName().toLowerCase();
if (!(name.endsWith(".java") || name.endsWith(".jsp"))) {
return null;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
boolean noChange = true;
try {
@ -277,6 +281,7 @@ public class ClearReviewsAction implements IObjectActionDelegate, IResourceVisit
String origLine = reader.readLine();
String line = origLine.trim();
int index = origLine.indexOf(PMDRuntimeConstants.PMD_STYLE_REVIEW_COMMENT);
int quoteIndex = origLine.indexOf('"');
if (line.startsWith("/*")) {
if (line.indexOf("*/") == -1) {
@ -288,7 +293,7 @@ public class ClearReviewsAction implements IObjectActionDelegate, IResourceVisit
out.println(origLine);
} else if (!comment && line.startsWith(PMDRuntimeConstants.PLUGIN_STYLE_REVIEW_COMMENT)) {
noChange = false;
} else if (!comment && (index != -1)) {
} else if (!comment && (index != -1) && !(quoteIndex != -1 && quoteIndex < index && index < origLine.lastIndexOf('"'))) {
noChange = false;
out.println(origLine.substring(0, index));
} else {