xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marshall Flax" <marshall.f...@gmail.com>
Subject Re: org.apache.batik.dom.util.SAXDocumentFactory -- svgplugin calling startElement() before createDocument()
Date Thu, 03 Apr 2008 11:17:30 GMT
Your patch is of course better. Thank you!

I'll take a look at svgplugin over the weekend and see if I can
propose a patch on that side, which I'm sure the original author will
(if the project is still active) also improve upon :-)

Thanks for Batik!

Marshall

On Thu, Apr 3, 2008 at 6:18 AM,  <thomas.deweese@kodak.com> wrote:
>
>
> Hi Marshall,
>
>  "Marshall Flax" <marshall.flax@gmail.com> wrote on 03/30/2008 03:05:50 PM:
>
>
>  > org.apache.batik.dom.util.SAXDocumentFactory.startElement() --
>  > apparently because createDocument() is never called. This results in a
>  > stack trace (Europa Eclipse, 1.5 OSX 10.4) like
>
>     It looks like 'EclipseSAXSVGDocumentFactory' is subclassing
>  our 'SAXDocumentFactory' and overriding our createDocument and not
>  setting the parser to the baseclass.  I would consider this
>  bad on their part.
>
>     That said, I think it would be good to add defensive code.
>  In this case I think the fact that isStandalone and xmlVersion
>  aren't set should cause no major issues (it looks like those
>  values are used to set features on the SVG Document object so
>  I'm guessing that this will cause a small non-conformance).
>
>     In short I think both code bases should be updated.
>
>
>  > However, a simple patch like
>
>     I don't like your patch. I would wrap just the two
>  'try' blocks with an 'if':
>
>
>  Index: sources/org/apache/batik/dom/util/SAXDocumentFactory.java
>  ===================================================================
>  --- sources/org/apache/batik/dom/util/SAXDocumentFactory.java   (revision
> 636165)
>
>  +++ sources/org/apache/batik/dom/util/SAXDocumentFactory.java   (working
> copy)
>  @@ -559,16 +559,18 @@
>
>           if (inProlog) {
>
>               inProlog = false;
>  -            try {
>  -                isStandalone = parser.getFeature
>  -                    ("http://xml.org/sax/features/is-standalone");
>  -            } catch (SAXNotRecognizedException ex) {
>  +            if (parser != null) {
>  +                try {
>  +                    isStandalone = parser.getFeature
>  +                        ("http://xml.org/sax/features/is-standalone");
>  +                } catch (SAXNotRecognizedException ex) {
>  +                }
>  +                try {
>  +                    xmlVersion = (String) parser.getProperty
>  +
> ("http://xml.org/sax/properties/document-xml-version");
>  +                } catch (SAXNotRecognizedException ex) {
>  +                }
>               }
>  -            try {
>  -                xmlVersion = (String) parser.getProperty
>  -
> ("http://xml.org/sax/properties/document-xml-version");
>  -            } catch (SAXNotRecognizedException ex) {
>  -            }
>           }
>
>           // Namespaces resolution

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message