[Laszlo-dev] findbugs reported this bug in NodeModel.java

Henry Minsky henry.minsky at gmail.com
Tue Apr 6 14:58:13 PDT 2010


On line 2058 in NodeModel.java:

in  addAttributeElement()

                if (ALLOCATION_INSTANCE.equals(allocation)) {
                    attrs = this.attrs;
                } else if (ALLOCATION_CLASS.equals(allocation)) {
                    attrs = this.classAttrs;
                }

The tool reported to  assignment to "attrs = this.attrs" as redundant, but
the bug is that if we're bashing
'attrs', we should have
a local 'attrs' var declared, like we do previously in the code for
addProperty, right?

    LinkedHashMap attrs;
    if (ALLOCATION_INSTANCE.equals(allocation)) {
      attrs = this.attrs;
    } else if (ALLOCATION_CLASS.equals(allocation)) {
      attrs = this.classAttrs;
    } else {

Because it looks like the code in is supposed to just side-effect the attrs
instance var, not actually bash it.
We should really use a different local variable name, to avoid this
confusion.




-- 
Henry Minsky
Software Architect
hminsky at laszlosystems.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20100406/9cb7a5ef/attachment.html


More information about the Laszlo-dev mailing list