asiri (SVN) wrote:
> Author: asiri
> Date: 2008-11-04 11:31:26 +0100 (Tue, 04 Nov 2008)
> New Revision: 13949

> +    private void filter(Node node)
> +    {
> +        if (node.hasAttributes()) {
> +            try {
> +                node.getAttributes().removeNamedItem("style");
> +            } catch (DOMException ex) {
> +                // Not a problem.
> +            }
> +        }

I don't like this... try-catch code is costly, since creating an
exception takes a lot of time and memory. Can't you check if the 'style'
attribute exists instead?

And a catch block in general should indicate an exceptional execution,
not a normal, expected case.
-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
devs mailing list
devs@xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to