/** * @param b * @return */ private String getBugLocation(BugInstance b) { String point; MethodAnnotation m = b.getPrimaryMethod(); FieldAnnotation f = b.getPrimaryField(); if (m != null) { point = m.toString(); } else if (f != null) { point = f.toString(); } else { point = null; } return point; }
@Override public void writeXML(XMLOutput xmlOutput, boolean addMessages, boolean isPrimary) throws IOException { XMLAttributeList attributeList = new XMLAttributeList().addAttribute("classname", getClassName()) .addAttribute("name", getFieldName()).addAttribute("signature", getFieldSignature()); if (fieldSourceSig != null) { attributeList.addAttribute("sourceSignature", fieldSourceSig); } attributeList.addAttribute("isStatic", String.valueOf(isStatic())); if (isPrimary) { attributeList.addAttribute("primary", "true"); } String role = getDescription(); if (!DEFAULT_ROLE.equals(role)) { attributeList.addAttribute("role", role); } xmlOutput.openTag(ELEMENT_NAME, attributeList); getSourceLines().writeXML(xmlOutput, addMessages, false); if (addMessages) { xmlOutput.openTag(BugAnnotation.MESSAGE_TAG); xmlOutput.writeText(this.toString()); xmlOutput.closeTag(BugAnnotation.MESSAGE_TAG); } xmlOutput.closeTag(ELEMENT_NAME); } }
/** * @param b * @return */ private String getBugLocation(BugInstance b) { String point; MethodAnnotation m = b.getPrimaryMethod(); FieldAnnotation f = b.getPrimaryField(); if (m != null) { point = m.toString(); } else if (f != null) { point = f.toString(); } else { point = null; } return point; }
@Override public void writeXML(XMLOutput xmlOutput, boolean addMessages, boolean isPrimary) throws IOException { XMLAttributeList attributeList = new XMLAttributeList().addAttribute("classname", getClassName()) .addAttribute("name", getFieldName()).addAttribute("signature", getFieldSignature()); if (fieldSourceSig != null) { attributeList.addAttribute("sourceSignature", fieldSourceSig); } attributeList.addAttribute("isStatic", String.valueOf(isStatic())); if (isPrimary) { attributeList.addAttribute("primary", "true"); } String role = getDescription(); if (!DEFAULT_ROLE.equals(role)) { attributeList.addAttribute("role", role); } xmlOutput.openTag(ELEMENT_NAME, attributeList); getSourceLines().writeXML(xmlOutput, addMessages, false); if (addMessages) { xmlOutput.openTag(BugAnnotation.MESSAGE_TAG); xmlOutput.writeText(this.toString()); xmlOutput.closeTag(BugAnnotation.MESSAGE_TAG); } xmlOutput.closeTag(ELEMENT_NAME); } }