X-Git-Url: http://jaekl.net/gitweb/?p=cfb.git;a=blobdiff_plain;f=prod%2Fnet%2Fjaekl%2Fcfb%2Fxml%2FBugInstance.java;h=900cd1cfd37c1f9fa6fa5643b624dbf635d5fb38;hp=f1f8537177befd7c51ad867a89a03ee993e938b4;hb=5bc9bbe3fd54b9fc7aa3b92d2d37e95c41b9645a;hpb=a938b67bf3d3bd86f8dd7b1f958e81007bf6f2fe diff --git a/prod/net/jaekl/cfb/xml/BugInstance.java b/prod/net/jaekl/cfb/xml/BugInstance.java index f1f8537..900cd1c 100644 --- a/prod/net/jaekl/cfb/xml/BugInstance.java +++ b/prod/net/jaekl/cfb/xml/BugInstance.java @@ -1,9 +1,11 @@ package net.jaekl.cfb.xml; +import java.io.PrintWriter; import java.util.ArrayList; import org.xml.sax.Attributes; +import net.jaekl.qd.xml.MissingAttributeException; import net.jaekl.qd.xml.ParseResult; import net.jaekl.qd.xml.XmlParseException; @@ -15,7 +17,9 @@ public class BugInstance extends ParseResult { { BugMethod.TAG, BugMethod.class}, { LocalVariable.TAG, LocalVariable.class}, { SourceLine.TAG, SourceLine.class} }; + static final String TYPE = "type"; + String m_type; ArrayList m_classes; ArrayList m_methods; ArrayList m_locals; @@ -24,6 +28,7 @@ public class BugInstance extends ParseResult { public BugInstance() { super(TAG, INTERNAL, EXTERNAL); + m_type = null; m_classes = new ArrayList(); m_methods = new ArrayList(); m_locals = new ArrayList(); @@ -31,9 +36,10 @@ public class BugInstance extends ParseResult { } @Override - public void endContents(String uri, String localName, String qName, String chars, Attributes attr) + public void endContents(String uri, String localName, String qName, String chars) throws XmlParseException { + // no-op } @Override @@ -69,5 +75,31 @@ public class BugInstance extends ParseResult { } } } + + @Override + public void handleMainAttributes(Attributes attr) throws MissingAttributeException + { + m_type = this.getRequiredAttr(TAG, attr, TYPE); + } + @Override + public void dump(PrintWriter pw, int indent) + { + int childIndent = indent + 2; + String margin = String.format("%" + indent + "s", ""); + + pw.println(margin + TAG + " (" + m_type + ")"); + for (BugClass bc : m_classes) { + bc.dump(pw, childIndent); + } + for (BugMethod bm : m_methods) { + bm.dump(pw, childIndent); + } + for (LocalVariable lv : m_locals) { + lv.dump(pw, childIndent); + } + for (SourceLine sl : m_lines) { + sl.dump(pw, childIndent); + } + } }