deferred parsing fallback?
Jacob Kjome <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.xmlc |
|---|---|
| Message-ID | <[email protected]> |
I have deferred parsing running successfully on a Barracuda app. In order
to do it, I compile the template files with the -for-deferred-parsing
option and then set Barracuda's DOMLoader to use a custom DOMFactory. In
this case, I give it one that uses the XMLCDeferredParsingFactory to create
documents. If I forget to set this custom factory, Barracuda uses a
default DOMFactory that creates documents using the standard
XMLCStdFactory. The problem is, when this happens for documents that have
been compiled for deferred parsing, things blow up with the following
exception...
java.lang.NullPointerException
at
org.enhydra.xml.xmlc.deferredparsing.DocumentLoaderImpl.getLogger(DocumentLoaderImpl.java:488)
at
org.enhydra.xml.xmlc.deferredparsing.DocumentLoaderImpl.getDocument(DocumentLoaderImpl.java:213)
at
org.enhydra.barracuda.contrib.dbroggisch.examples.view.xmlc.RepopulationHTMLImpl.buildDocument(RepopulationHTMLImpl.java:118)
at
org.enhydra.barracuda.contrib.dbroggisch.examples.view.xmlc.RepopulationHTMLImpl.(RepopulationHTMLImpl.java:98)
at
org.enhydra.barracuda.contrib.dbroggisch.examples.view.xmlc.RepopulationHTMLImpl.(RepopulationHTMLImpl.java:110)
at
org.enhydra.barracuda.contrib.dbroggisch.examples.view.xmlc.RepopulationHTMLImpl.(RepopulationHTMLImpl.java:61)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:306)
at java.lang.Class.newInstance(Class.java:259)
at
org.enhydra.xml.xmlc.XMLCStdFactory.doCreate(XMLCStdFactory.java:97)
at
org.enhydra.xml.xmlc.XMLCStdFactory.doCreate(XMLCStdFactory.java:108)
at org.enhydra.xml.xmlc.XMLCStdFactory.create(XMLCStdFactory.java:136)
at
org.enhydra.barracuda.core.util.dom.DefaultDOMFactory.getInstance(DefaultDOMFactory.java:50)
at
org.enhydra.barracuda.core.util.dom.DefaultDOMLoader.getDOM_private(DefaultDOMLoader.java:152)
at
org.enhydra.barracuda.core.util.dom.DefaultDOMLoader.getDOM(DefaultDOMLoader.java:80)
at
org.enhydra.barracuda.contrib.dbroggisch.examples.view.pages.RepopulationPage.getDocument(RepopulationPage.java:75)
I guess I had assumed that deferred parsing was just an added capability
and that the standard XMLCStdFactory would still be able to load the
classes, albeit without deferred parsing. This would make it so you could
compile with the possibility of deferred parsing, but then when you didn't
need deferred parsing turned on, the classes would be loaded like normal
which, I assume, is a bit less overhead.
Shouldn't there be a fallback; backward compatibility, if you will? Was
this just not considered and so it wasn't implemented, or is it not
implementable? Just wondering if I'm going to have to worry about
recompiling each time I want to change XMLC factories? If so, this means I
have to both remove the option in my options.xmlc file and make sure to
change the DOMFactory to the appropriate one that won't blow up when
loading XMLC classes. Hmmmm...... Any solutions, or am I just going to
have to live with a bit of extra maintenance?
Jake