public void toElement(BugInstance bugInstance) { String className = bugInstance.getPrimaryClass().getClassName(); Element element = (Element) root.selectSingleNode(FILE_ELEMENT_NAME + "[@classname='" + className + "']"); if (element == null) { element = root.addElement(FILE_ELEMENT_NAME); element.addAttribute("classname", className); } element = element.addElement(ELEMENT_NAME); element.addAttribute("type", bugInstance.getType()); switch (bugInstance.getPriority()) { case Priorities.EXP_PRIORITY: element.addAttribute("priority", "Experimental"); break; case Priorities.LOW_PRIORITY: element.addAttribute("priority", "Low"); break; case Priorities.NORMAL_PRIORITY: element.addAttribute("priority", "Normal"); break; case Priorities.HIGH_PRIORITY: element.addAttribute("priority", "High"); break; default: assert false; } element.addAttribute("message", xmlEscape(bugInstance.getMessage())); SourceLineAnnotation line = bugInstance.getPrimarySourceLineAnnotation(); element.addAttribute("line", Integer.toString(line.getStartLine())); }
public void toElement(BugInstance bugInstance) { String className = bugInstance.getPrimaryClass().getClassName(); Element element = (Element) root.selectSingleNode(FILE_ELEMENT_NAME + "[@classname='" + className + "']"); if (element == null) { element = root.addElement(FILE_ELEMENT_NAME); element.addAttribute("classname", className); } element = element.addElement(ELEMENT_NAME); element.addAttribute("type", bugInstance.getType()); switch (bugInstance.getPriority()) { case Priorities.EXP_PRIORITY: element.addAttribute("priority", "Experimental"); break; case Priorities.LOW_PRIORITY: element.addAttribute("priority", "Low"); break; case Priorities.NORMAL_PRIORITY: element.addAttribute("priority", "Normal"); break; case Priorities.HIGH_PRIORITY: element.addAttribute("priority", "High"); break; default: assert false; } element.addAttribute("message", xmlEscape(bugInstance.getMessage())); SourceLineAnnotation line = bugInstance.getPrimarySourceLineAnnotation(); element.addAttribute("line", Integer.toString(line.getStartLine())); }