X-Git-Url: http://jaekl.net/gitweb/?p=cfb.git;a=blobdiff_plain;f=prod%2Fnet%2Fjaekl%2Fcfb%2Fxml%2FBugClass.java;h=40cc84b8a3874dd550be2e201ffec705f928d040;hp=eb2c5929347c5c108331286f6362e76d3097a3c1;hb=5bc9bbe3fd54b9fc7aa3b92d2d37e95c41b9645a;hpb=a938b67bf3d3bd86f8dd7b1f958e81007bf6f2fe diff --git a/prod/net/jaekl/cfb/xml/BugClass.java b/prod/net/jaekl/cfb/xml/BugClass.java index eb2c592..40cc84b 100644 --- a/prod/net/jaekl/cfb/xml/BugClass.java +++ b/prod/net/jaekl/cfb/xml/BugClass.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; @@ -16,18 +18,24 @@ public class BugClass extends ParseResult { static final String CLASS_NAME = "classname"; String m_className; - ArrayList m_sourceLines; + ArrayList m_lines; public BugClass() { super(TAG, INTERNAL, EXTERNAL); m_className = ""; + m_lines = new ArrayList(); + } + + @Override + public void handleMainAttributes(Attributes attr) throws MissingAttributeException + { + m_className = getRequiredAttr(TAG, attr, CLASS_NAME); } @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 { - m_className = getRequiredAttr(TAG, attr, CLASS_NAME); } @Override @@ -38,8 +46,22 @@ public class BugClass extends ParseResult { ParseResult[] collected = collectParsedChildren(SourceLine.class); for (ParseResult pr : collected) { assert(pr instanceof SourceLine); - m_sourceLines.add((SourceLine)pr); + m_lines.add((SourceLine)pr); } } } + + @Override + public void dump(PrintWriter pw, int indent) + { + super.dump(pw, indent); + String tab = String.format("%" + (indent + 2) + "s", ""); + + pw.println(tab + CLASS_NAME + "=" + m_className); + if (null != m_lines) { + for (SourceLine sl : m_lines) { + sl.dump(pw, indent + 2); + } + } + } }