@Override public void addError(BugInstance bug) { super.addError(bug); SourceLineAnnotation source = bug.getPrimarySourceLineAnnotation(); // see bug https://sourceforge.net/tracker/index.php?func=detail&aid=3322583&group_id=96405&atid=614693 // always add class stats to see useful details in package stats fancy.xsl output getClassStats(source.getClassName(), source.getSourceFile()).addError(bug); }
@Override public void reportMissingClass(ClassNotFoundException ex) { String missing = AbstractBugReporter.getMissingClassName(ex); if (!isValidMissingClassMessage(missing)) { return; } bugCollection.addMissingClass(missing); super.reportMissingClass(ex); }
@Override public void reportMissingClass(ClassNotFoundException ex) { String missing = AbstractBugReporter.getMissingClassName(ex); if (!isValidMissingClassMessage(missing)) { return; } bugCollection.addMissingClass(missing); super.reportMissingClass(ex); }
@Override public void visit(Code obj) { stage = synchronizedMethod ? 1 : 0; super.visit(obj); if (synchronizedMethod && stage == 4) { bugReporter.reportBug(new BugInstance(this, "NN_NAKED_NOTIFY", NORMAL_PRIORITY).addClassAndMethod(this) .addSourceLine(this, notifyPC)); } }
static FieldAnnotation obfuscate(FieldAnnotation m) { FieldAnnotation result = new FieldAnnotation(hashClass(m.getClassName()), hashData(m.getFieldName()), hashSignature(m.getFieldSignature()), m.isStatic()); result.setDescription(m.getDescription()); return result; }
/** * Get the current AppVersion. */ @Override public AppVersion getCurrentAppVersion() { return new AppVersion(getSequenceNumber()).setReleaseName(getReleaseName()).setTimestamp(getTimestamp()) .setNumClasses(getProjectStats().getNumClasses()).setCodeSize(getProjectStats().getCodeSize()); }
public String getCategoryAbbrev() { String categoryAbbrev = null; BugCategory bcat = DetectorFactoryCollection.instance().getBugCategory(getCategory()); if (bcat != null) { categoryAbbrev = bcat.getAbbrev(); } if (categoryAbbrev == null) { categoryAbbrev = TextUIBugReporter.OTHER_CATEGORY_ABBREV; } return categoryAbbrev; }
static StringAnnotation obfuscate(StringAnnotation m) { StringAnnotation result = new StringAnnotation("obfuscated: " + hashData(m.getValue())); result.setDescription(m.getDescription()); return result; }
static ClassAnnotation obfuscate(ClassAnnotation m) { ClassAnnotation result = new ClassAnnotation(hashClass(m.getClassName())); result.setDescription(m.getDescription()); return result; }
public int getCWEid() { BugPattern pattern = getBugPattern(); int cweid = pattern.getCWEid(); if (cweid != 0) { return cweid; } BugCode bugCode = pattern.getBugCode(); return bugCode.getCWEid(); } public void writeXML(XMLOutput xmlOutput, BugCollection bugCollection, boolean addMessages) throws IOException {
public TestingGround execute() { ProjectPackagePrefixes foo = new ProjectPackagePrefixes(); for (BugInstance b : bugCollection.getCollection()) { foo.countBug(b); } foo.report(); return this; }
public int compareClasses(BugCollection lhsCollection, BugCollection rhsCollection, ClassAnnotation lhsClass, ClassAnnotation rhsClass) { if (lhsClass == null || rhsClass == null) { return compareNullElements(lhsClass, rhsClass); } else { return compareClassesByName(lhsCollection, rhsCollection, lhsClass.getClassName(), rhsClass.getClassName()); } }
public Item cloneAndSetSpecialKind(@SpecialKind int specialKind) { Item that = new Item(this); that.specialKind = specialKind; return that; }
@Override public void finishSettings() { if (analysisOptions.applySuppression) { bugReporter = new FilterBugReporter(bugReporter, getProject().getSuppressionFilter(), false); } }
@Override public void doReportBug(BugInstance bugInstance) { if (VERIFY_INTEGRITY) { checkBugInstance(bugInstance); } if (bugCollection.add(bugInstance)) { notifyObservers(bugInstance); } }
@Override public void visit(Code obj) { alreadySawStart = false; super.visit(obj); bugAccumulator.reportAccumulatedBugs(); }
@Override public void doReportBug(BugInstance bugInstance) { if (bugCollection.add(bugInstance)) { printBug(bugInstance); notifyObservers(bugInstance); } }
public @SpecialKind int getSpecialKindForAbs() { switch (getSpecialKind()) { case Item.HASHCODE_INT: return Item.MATH_ABS_OF_HASHCODE; case Item.RANDOM_INT: return Item.MATH_ABS_OF_RANDOM; default: return Item.MATH_ABS; } }
@Override public void setBugReporter(BugReporter bugReporter) { this.bugReporter = this.errorCountingBugReporter = new ErrorCountingBugReporter(bugReporter); addClassObserver(bugReporter); }