Hi,
I'm writing a mailer component that uses XML as input and can output several formats using renderer components. One of those renderers is the XHTML renderer.
The unit test for the XHTML renderer works fine, XML input is parsed correctly, XHTML output is as expected. This unit test doesn't start a Merlin container, it just calls configure() and initialize() directly to set up the renderer.
The unit test for the mailer is a bit more complex as the mailer resolves the renderer(s) dynamically. Therefore, its unit test is derived from AbstractMerlinTestCase. If I run this test with maven.junit.fork=true, I now get the following exception using exactly the same input as before:
Caused by: java.lang.NullPointerException
at org.apache.xml.utils.TreeWalker.dispatachChars(TreeWalker.java:292)
at org.apache.xml.utils.TreeWalker.startNode(TreeWalker.java:436)
at org.apache.xml.utils.TreeWalker.traverse(TreeWalker.java:191)
at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:325)
at ch.codeshack.avalon.mailer.renderer.xhtml.XHTMLRendererImplementation.getResult(XHTMLRendererImplementation.java:382)
at ch.codeshack.avalon.mailer.renderer.util.AbstractRenderer.render(AbstractRenderer.java:93)
... 29 more
This is the offending code:
ByteArrayOutputStream output = new ByteArrayOutputStream();
DOMSource source = new DOMSource(document);
StreamResult result = new StreamResult(output);
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty(OutputKeys.ENCODING, encoding);
transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, XHTML_PUBLIC_ID);
transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, XHTML_SYSTEM_ID);
transformer.transform(source, result); // throws NullPointerException
If I set maven.junit.fork=false, I get a different exception: "java.lang.LinkageError: loader constraints violated when linking org/w3c/dom/Document class". This shows that when running the test from within Maven, a different XML implementation is used than when running from within Merlin and that Merlin tries to force its own XML implementation. Unfortunately, the XML implementation Merlin wants to use seems to be buggy (->NullPointerException).
How can I replace the XML implementation of Merlin?
cu, Raffi
-- Neu im Usenet? Fragen? -> http://www.use-net.ch/usenet_intro_de.html
Raffael Herzog - [EMAIL PROTECTED] - www.raffael.ch - ICQ #67961355
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]