X-Git-Url: http://jaekl.net/gitweb/?a=blobdiff_plain;f=prod%2Fnet%2Fjaekl%2Fcfb%2Fxml%2FBugMethod.java;h=f05c510af39ddd412df0744439cb3edcb445b032;hb=f1c4313e9229dd2d5f7fd984169cbdb89fef4cd5;hp=2e001b23abe93116f71c47782bc1f21b428308e6;hpb=a938b67bf3d3bd86f8dd7b1f958e81007bf6f2fe;p=cfb.git diff --git a/prod/net/jaekl/cfb/xml/BugMethod.java b/prod/net/jaekl/cfb/xml/BugMethod.java index 2e001b2..f05c510 100644 --- a/prod/net/jaekl/cfb/xml/BugMethod.java +++ b/prod/net/jaekl/cfb/xml/BugMethod.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; @@ -34,16 +36,36 @@ public class BugMethod extends ParseResult { m_isStatic = false; m_sourceLines = new ArrayList(); } - + + public BugMethod(Long id, String methodName, String methodRole) { + super(TAG, INTERNAL, EXTERNAL); + m_className = null; + m_methodName = methodName; + m_role = methodRole; + m_isStatic = false; + m_sourceLines = new ArrayList(); + } + + public String getClassName() { return m_className; } + public String getMethodName() { return m_methodName; } + public String getRole() { return m_role; } + public SourceLine[] getSourceLines() { return m_sourceLines.toArray(new SourceLine[m_sourceLines.size()]); } + @Override - public void endContents(String uri, String localName, String qName, String chars, Attributes attr) - throws XmlParseException + public void handleMainAttributes(Attributes attr) throws MissingAttributeException { m_className = getRequiredAttr(TAG, attr, CLASS_NAME); m_methodName = getRequiredAttr(TAG, attr, METHOD_NAME); m_signature = getRequiredAttr(TAG, attr, SIGNATURE); m_isStatic = getRequiredAttr(TAG, attr, IS_STATIC).equals(TRUE); - m_role = getOptionalAttr(attr, ROLE, null); + m_role = getOptionalAttr(attr, ROLE, null); + } + + @Override + public void endContents(String uri, String localName, String qName, String chars) + throws XmlParseException + { + // no-op } @Override @@ -58,5 +80,27 @@ public class BugMethod extends ParseResult { } } } + + @Override + public void dump(PrintWriter pw, int indent) + { + super.dump(pw, indent); + String tab = String.format("%" + (indent + 2) + "s", ""); + + pw.println(tab + + (m_isStatic ? "static" : "") + + m_className + + "." + + m_methodName + + m_signature); + if (null != m_role) { + pw.println(tab + ROLE + "=" + m_role); + } + if (null != m_sourceLines) { + for (SourceLine sl : m_sourceLines) { + sl.dump(pw, indent + 2); + } + } + } }