lineEnd = line.getEndLine(); SourceFinder sourceFinder = AnalysisContext.currentAnalysisContext().getSourceFinder(); String pkgName = line.getPackageName();
return false; criteriaMatches &= srcAnn.getStartLine() <= lineNumber && lineNumber <= srcAnn.getEndLine(); return false; criteriaMatches &= srcAnn.getStartLine()-1 <= lineNumberApprox && lineNumberApprox <= srcAnn.getEndLine()+1; if(srcAnn.getStartLine()-1 <= potentialMatch && potentialMatch <= srcAnn.getEndLine()+1) { found = true;
int numLines = srcLine.getEndLine() - startLine - 1; if (numLines <= 0) { return false;
if (firstSourceLine.getStartLine() == -1 || firstSourceLine.getStartLine() != secondSourceLine.getEndLine()) { priority++;
attributeList.addAttribute("start", String.valueOf(n)); n = getEndLine(); if (n >= 0) { attributeList.addAttribute("end", String.valueOf(n));
static SourceLineAnnotation obfuscate(SourceLineAnnotation m) { SourceLineAnnotation result = new SourceLineAnnotation(hashClass(m.getClassName()), hashFilename(m.getSourceFile()), m.getStartLine(), m.getEndLine(), m.getStartBytecode(), m.getEndBytecode()); result.setDescription(m.getDescription()); return result; }
SourceLineAnnotation lastChange = SourceLineAnnotation.fromVisitedInstruction(getClassContext(), this, constantSince(fcb.item0)); int lastChangeLine = lastChange.getEndLine(); if (loopBottomLine != -1 && lastChangeLine != -1 && loopTopLine != -1 && loopTopLine <= lastChangeLine && lastChangeLine < loopBottomLine) { SourceLineAnnotation lastChange = SourceLineAnnotation.fromVisitedInstruction(getClassContext(), this, constantSince(fcb.item1)); int lastChangeLine = lastChange.getEndLine(); if (loopBottomLine != -1 && lastChangeLine != -1 && loopTopLine != -1 && loopTopLine <= lastChangeLine && lastChangeLine < loopBottomLine) {
int previousLine = prevSourceLineAnnotation.getEndLine(); if (startLine < previousLine) {
private void setAffectedLines(final BugInstance warning, final Bug bug) { Iterator<BugAnnotation> annotationIterator = warning.annotationIterator(); while (annotationIterator.hasNext()) { BugAnnotation bugAnnotation = annotationIterator.next(); if (bugAnnotation instanceof SourceLineAnnotation) { SourceLineAnnotation annotation = (SourceLineAnnotation)bugAnnotation; bug.addLineRange(new LineRange(annotation.getStartLine(), annotation.getEndLine())); } } }
@Override @SuppressWarnings("boxing") public @CheckForNull URL getSourceLink(BugInstance b) { if (sourceFileLinkPattern == null) { return null; } SourceLineAnnotation src = b.getPrimarySourceLineAnnotation(); String fileName = src.getSourcePath(); int startLine = src.getStartLine(); int endLine = src.getEndLine(); java.util.regex.Matcher m = sourceFileLinkPattern.matcher(fileName); boolean isMatch = m.matches(); if (isMatch) { try { URL link; if (startLine > 0) { link = new URL(String.format(sourceFileLinkFormatWithLine, m.group(1), startLine, startLine - 10, endLine)); } else { link = new URL(String.format(sourceFileLinkFormat, m.group(1))); } return link; } catch (Exception e) { AnalysisContext.logError("Error generating source link for " + src, e); } } return null; }
private void setAffectedLines(final BugInstance warning, final Bug bug) { Iterator<BugAnnotation> annotationIterator = warning.annotationIterator(); while (annotationIterator.hasNext()) { BugAnnotation bugAnnotation = annotationIterator.next(); if (bugAnnotation instanceof SourceLineAnnotation) { SourceLineAnnotation annotation = (SourceLineAnnotation)bugAnnotation; bug.addLineRange(new LineRange(annotation.getStartLine(), annotation.getEndLine())); } } }
private void setAffectedLines(final BugInstance warning, final Bug bug) { Iterator<BugAnnotation> annotationIterator = warning.annotationIterator(); while (annotationIterator.hasNext()) { BugAnnotation bugAnnotation = annotationIterator.next(); if (bugAnnotation instanceof SourceLineAnnotation) { SourceLineAnnotation annotation = (SourceLineAnnotation)bugAnnotation; bug.addLineRange(new LineRange(annotation.getStartLine(), annotation.getEndLine())); } } }
/** * @param src * @param sourceAnnotation */ private void highlight(JavaSourceDocument src, SourceLineAnnotation sourceAnnotation, Color color) { int startLine = sourceAnnotation.getStartLine(); if (startLine == -1) { return; } String sourceFile = sourceAnnotation.getSourcePath(); String sourceFile2 = src.getSourceFile().getFullFileName(); if (!java.io.File.separator.equals(String.valueOf(SourceLineAnnotation.CANONICAL_PACKAGE_SEPARATOR))) { sourceFile2 = sourceFile2.replace(java.io.File.separatorChar, SourceLineAnnotation.CANONICAL_PACKAGE_SEPARATOR); } if (!sourceFile2.endsWith(sourceFile)) { return; } src.getHighlightInformation().setHighlight(startLine, sourceAnnotation.getEndLine(), color); }
String srcStr = ""; int start = link.getStartLine(); int end = link.getEndLine(); if (start < 0 && end < 0) { srcStr = sourceCodeLabel; if (link != null && sourceCodeExists(link)) { int start = link.getStartLine(); int end = link.getEndLine(); if (start < 0 && end < 0) { srcStr = sourceCodeLabel;
lineEnd = line.getEndLine(); SourceFinder sourceFinder = AnalysisContext.currentAnalysisContext().getSourceFinder(); String pkgName = line.getPackageName();
int numLines = srcLine.getEndLine() - startLine - 1; if (numLines <= 0) { return false;
int endLine = mySourceLine.getEndLine(); frame.setSourceTab(sourceFile + " in " + mySourceLine.getPackageName(), myBug); otherLine = sourceAnnotation.getEndLine();
static SourceLineAnnotation obfuscate(SourceLineAnnotation m) { SourceLineAnnotation result = new SourceLineAnnotation(hashClass(m.getClassName()), hashFilename(m.getSourceFile()), m.getStartLine(), m.getEndLine(), m.getStartBytecode(), m.getEndBytecode()); result.setDescription(m.getDescription()); return result; }
return result; result = compare(oneSource.getEndLine(), twoSource.getEndLine()); if (result != 0) { return result;
StringUtils.defaultIfEmpty(hashToMessageMapping.get(warning.getInstanceHash()), message), warning.getBugPattern().getCategory(), warning.getType(), sourceLine.getStartLine(), sourceLine.getEndLine()); bug.setInstanceHash(warning.getInstanceHash()); bug.setRank(warning.getBugRank());