On 2012-05-18 13:58, Michael Dürig wrote:

Hi Julian,

Thanks for setting this up. I think this is of great value and we should
take these warning very serious.

In case anyone wonders how to integrate this with IntelliJ: just enable
the inspection called "Constants, conditions & exceptions". Took me a
while to figure this out.

Michael
...

Thanks for that.

Here's an example of the problems we need to take care of -- PropertyDelegate has:

    public void remove() {
        getParentTree().removeProperty(getName());
    }

    private Tree getParentTree() {
        resolve();
        return parent;
    }

    private synchronized void resolve() {
        parent = sessionDelegate.getTree(parent.getPath());

        if (parent == null) {
            propertyState = null;
        } else {
String path = PathUtils.concat(parent.getPath(), propertyState.getName());
            propertyState = parent.getProperty(PathUtils.getName(path));
        }
    }

So getParentTree() calls resolve(), which in turn can return with parent == null.

Yet, remove() assumes the return value of getParentTree is never null.

Best regards, Julian

Reply via email to