diff options
author | Jeremias Maerki <jeremias@apache.org> | 2005-01-17 12:56:07 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2005-01-17 12:56:07 +0000 |
commit | 37f5bc0a3d527f54520e19bbf8cc3f42c3926341 (patch) | |
tree | 38ab33c9632a1c58fd161d29398de119ba3fee71 /test/java/org/apache/fop/layoutengine | |
parent | 6c1ed8c83a39f14e7733929a017b85ed3bc04520 (diff) | |
download | xmlgraphics-fop-37f5bc0a3d527f54520e19bbf8cc3f42c3926341.tar.gz xmlgraphics-fop-37f5bc0a3d527f54520e19bbf8cc3f42c3926341.zip |
Using only DOM elements to create checks. This should help avoid errors due to comment nodes being passed to the factory method.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198275 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/java/org/apache/fop/layoutengine')
-rw-r--r-- | test/java/org/apache/fop/layoutengine/LayoutEngineTester.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java b/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java index a6e5aaa43..5fcc407a5 100644 --- a/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java +++ b/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java @@ -44,6 +44,7 @@ import org.apache.fop.apps.Fop; import org.apache.fop.fo.Constants; import org.apache.fop.render.xml.XMLRenderer; import org.w3c.dom.Document; +import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -130,17 +131,17 @@ public class LayoutEngineTester { } /** - * Factory method to create checks from DOM nodes. - * @param node DOM node to create the check from + * Factory method to create checks from DOM elements. + * @param el DOM element to create the check from * @return The newly create check */ - protected LayoutEngineCheck createCheck(Node node) { - String name = node.getLocalName(); + protected LayoutEngineCheck createCheck(Element el) { + String name = el.getLocalName(); Class clazz = (Class)CHECK_CLASSES.get(name); if (clazz != null) { try { Constructor c = clazz.getDeclaredConstructor(new Class[] {Node.class}); - LayoutEngineCheck instance = (LayoutEngineCheck)c.newInstance(new Object[] {node}); + LayoutEngineCheck instance = (LayoutEngineCheck)c.newInstance(new Object[] {el}); return instance; } catch (Exception e) { throw new RuntimeException("Error while instantiating check '" @@ -168,7 +169,9 @@ public class LayoutEngineTester { NodeList nodes = doc.getDocumentElement().getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); - checks.add(createCheck(node)); + if (node instanceof Element) { + checks.add(createCheck((Element)node)); + } } Iterator i = checks.iterator(); |