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;
{ BugMethod.TAG, BugMethod.class},
{ LocalVariable.TAG, LocalVariable.class},
{ SourceLine.TAG, SourceLine.class} };
+ static final String TYPE = "type";
+ String m_type;
ArrayList<BugClass> m_classes;
ArrayList<BugMethod> m_methods;
ArrayList<LocalVariable> m_locals;
public BugInstance() {
super(TAG, INTERNAL, EXTERNAL);
+ m_type = null;
m_classes = new ArrayList<BugClass>();
m_methods = new ArrayList<BugMethod>();
m_locals = new ArrayList<LocalVariable>();
}
@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
}
}
}
+
+ @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);
+ }
+ }
}