Hi all!
I seems to me that the interface/implementation Graphic/GraphicImpl has a
flaw: the getExternalGraphics returns null to indicate that the getMarks
method should be used instead. I think it might just as well return an empty
array. This would be more consistent with the geotools philosophy of
avoiding null return values, it would be simpler, and more importantly: it
makes the behavior more logical.
The last point can be observed by the following code:
Graphic g = ....
g.setExternalGraphics(new ExternalGraphics[]{});
// somewhere else...
ExternalGraphics[] eg = g.getExternalGraphics();
Following the last line, eg will actually be null, and not an array with
length zero as would be the expected value. I hit this issue today, as a bug
in DuplicatorStyleVisitor (jira issue GEOT-1476) threw a
NullPointerException on my styles due to ExternalGraphics being null in some
Graphic. I tried to work around this by calling
Graphic.setExternalGraphicswith a zero-length array, but this did not
work obviously, since
getExternalGraphics returns null instead of what was set
Thus the proposed change will make Graphic behave more to the clients
expectations, and it would also resolve the bugs in
DuplicatorStyleVisitor/DuplicatingStyleVisitor. By the way, I think it is
very confusing to have two almost identical classes, one should be removed.
Regards,
Erik Loevlie
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel