/** * Get the abbreviation of this bug instance's BugPattern. This is the same * abbreviation used by the BugCode which the BugPattern is a particular * species of. */ public String getAbbrev() { BugPattern pattern = getBugPattern(); return pattern.getAbbrev(); }
@Override public boolean match(BugInstance bugInstance) { if (DEBUG) { System.out.println("Checking " + bugInstance); System.out.println(" type:" + bugInstance.getType()); System.out.println(" against: " + bugPattern); } if (!(bugPattern == null || bugInstance.getType().startsWith(bugPattern) || bugInstance.getBugPattern().getCategory().equalsIgnoreCase(bugPattern) || bugInstance.getBugPattern() .getAbbrev().equalsIgnoreCase(bugPattern))) { return false; } if (DEBUG) { System.out.println(" pattern matches"); } return true; }
/** * Get a message string. This is a format pattern for describing an entire * bug instance in a single line. * * @param key * which message to retrieve * * */ @Deprecated public @Nonnull String getMessage(String key) { BugPattern bugPattern = DetectorFactoryCollection.instance().lookupBugPattern(key); if (bugPattern == null) { return L10N.getLocalString("err.missing_pattern", "Error: missing bug pattern for key") + " " + key; } return bugPattern.getAbbrev() + ": " + bugPattern.getLongDescription(); }
/** * Get a short message string. This is a concrete string (not a format * pattern) which briefly describes the type of bug, without mentioning * particular a particular class/method/field. * * @param key * which short message to retrieve */ public @Nonnull String getShortMessage(String key) { BugPattern bugPattern = DetectorFactoryCollection.instance().lookupBugPattern(key); if (bugPattern == null) { return L10N.getLocalString("err.missing_pattern", "Error: missing bug pattern for key") + " " + key; } return bugPattern.getAbbrev() + ": " + bugPattern.getShortDescription(); }
/** * Format a string describing this bug instance. * * @return the description */ public String getMessage() { BugPattern bugPattern = getBugPattern(); String pattern = bugPattern.getAbbrev() + ": " + getLongDescription(); FindBugsMessageFormat format = new FindBugsMessageFormat(pattern); try { return format.format(annotationList.toArray(new BugAnnotation[annotationList.size()]), getPrimaryClass()); } catch (RuntimeException e) { AnalysisContext.logError("Error generating bug msg ", e); return bugPattern.getShortDescription() + " [Error generating customized description]"; } }
bugCodeSet.add(bugPattern.getAbbrev());
match = pattern.getType(); } else { match = pattern.getAbbrev();
private void addBugPatterns(Set<String> bugTypeSet) { Element root = document.getRootElement(); for (String bugType : bugTypeSet) { BugPattern bugPattern = DetectorFactoryCollection.instance().lookupBugPattern(bugType); if (bugPattern == null) { continue; } Element details = root.addElement("BugPattern"); details.addAttribute("type", bugType).addAttribute("abbrev", bugPattern.getAbbrev()) .addAttribute("category", bugPattern.getCategory()); details.addElement("ShortDescription").addText(bugPattern.getShortDescription()); details.addElement("Details").addCDATA(bugPattern.getDetailText()); } }
attributeList.addAttribute("abbrev", bugPattern.getAbbrev()); attributeList.addAttribute("category", bugPattern.getCategory()); if (bugPattern.getCWEid() != 0) {
attributeList.addAttribute("abbrev", pattern.getAbbrev()); attributeList.addAttribute("category", pattern.getCategory());
String kind = bugPattern.getAbbrev(); for (BugRanker b : rankers) { if (b != null) {
@Override public String getFrom(BugInstance bug) { BugPattern bugPattern = bug.getBugPattern(); return bugPattern.getAbbrev(); }
/** * Get the abbreviation of this bug instance's BugPattern. This is the same * abbreviation used by the BugCode which the BugPattern is a particular * species of. */ public String getAbbrev() { BugPattern pattern = getBugPattern(); return pattern.getAbbrev(); }
@Override protected void emit(BugPattern bugPattern) throws IOException { out.println("<h2>" + bugPattern.getAbbrev() + ": " + bugPattern.getShortDescription() + "</h2>"); out.println(bugPattern.getDetailText()); }
private void emitBugDescriptions() { PrintStream out = getPrintStream(); out.println("<h2>Descriptions</h2>"); for (BugPattern bugPattern : bugPatternSet) { out.println("<h3><a name=\"" + bugPattern.getType() + "\">" + bugPattern.getAbbrev() + ": " + bugPattern.getShortDescription() + " (" + bugPattern.getType() + ")" + "</a></h3>"); out.println(bugPattern.getDetailText()); } }
private void addBugPatterns(Set<String> bugTypeSet) { Element root = document.getRootElement(); for (String bugType : bugTypeSet) { BugPattern bugPattern = DetectorFactoryCollection.instance().lookupBugPattern(bugType); if (bugPattern == null) { continue; } Element details = root.addElement("BugPattern"); details.addAttribute("type", bugType).addAttribute("abbrev", bugPattern.getAbbrev()) .addAttribute("category", bugPattern.getCategory()); details.addElement("ShortDescription").addText(bugPattern.getShortDescription()); details.addElement("Details").addCDATA(bugPattern.getDetailText()); } }