Details
-
Bug
-
Status: Resolved
-
Resolution: Fixed
-
1.5
-
None
-
None
-
Operating System: All
Platform: All
Description
The behaviour between loaded document and created document on the fly is
different due to documentURI/CSSBase.
On the loaded document the documentURI/CSSBase is pointing to the correct URL,
where in the created document the documentURI/CSSBase is null. Therefore, on the
created document some operation sometimes throw NullPointerException.
Some possible fix is by checking for null or put under try catch block for null.
Unfortunately, there are many part of CSS related stuff assuming that the
documentURI/CSSBase is exist and do the operation directly without checking
whether it is throw NullPointerException or not, make bug fixes hard to spot
Here is some sample of method that identified throw NullPointerException:
1) On package org.apache.batik.css.engine
Class CSSEngine
method getCSSBaseURI() // instead of return null, it throw NullPointerException
because the element.getCSSBase could be null also
method parseStyleDeclaration(String) // instead of throw DOMException, it throw
NullPointerException if documentURI is null
2) On package org.apache.batik.css.engine.value.svg
Class SVGPaintManager
method createValue(LexicalUnit lu, CSSEngine engine) // instead of throw
DOMException, it throw NullPointerException due to resolveURI throw
NullPointerException instead of return null