I might have found a bug with Cloneable implementation of Style. The issue
seems to be with the cloning of rules. Here is a very simple test case that
fails with the trunk code:

Style clonedStyle = (Style) ((Cloneable) style).clone();

// get the first rule of the original style
Rule rule = style.featureTypeStyles().get(0).rules().get(0);

// get the first rule of the cloned style
Rule clonedRule = clonedStyle.featureTypeStyles().get(0).rules().get(0);

// let's remove all the symbolizers from the cloned rule
clonedRule.symbolizers().clear();

System.out.println(rule.symbolizers().size());

The output of this test case would be 0, which is not the expected behavior.
The issue seems to be in RuleImpl.clone():

clone.symbolizers = new ArrayList<Symbolizer>(symbolizers);

Instead we should be cloning the symbolizer too and add them to the list.



-- 
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/Clone-Bug-tp5113982p5113982.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------

_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to