I've run into this problem before and I wanted to see if there's a better way 
to address it or if this should be filed as a bug.  Essentially what happens is 
that you can create an SVGMatrix from an SVGLocatable that hasn't been rendered 
and has no useful information.  Assume this happens before CSS and DOM are 
fully booted:
 
SVGLocatable locatable = (SVGLocatable) svgDocument.getDocumentElement();
SVGMatrix matrix = locatable.getScreenCTM();
 
The returned SVGMatrix object won't necessarily be null.  Unfortunately, 
attempting to use it will throw an NPE:
 
// This would be false.
boolean nullMatrix = matrix == null;
 
In order to "test" the SVGMatrix, I've had to resort to the following:
 
try {
   matrix.getA();
} catch (NullPointerException npEx) {
// Document must not be ready!
}
 
Basically the only exposed way to check the matrix is to try an accessor method 
which causes the NPE.  Is there a better way of handling this or should this be 
filed?  In contrast this would be null:
 
SVGRect boundingBox = locatable.getBBox();
 
// This would be true.
boolean nullBox = boundingBox == null;
 
Michael Bishop

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to