New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad usage of immutable list #90

Closed
sbordes opened this Issue Jan 9, 2014 · 0 comments

Comments

Projects
None yet
1 participant
@sbordes
Member

sbordes commented Jan 9, 2014

The AbstractReady code has a big lack !

    /**
     * @return Returns the list of model Object.
     */
    @SuppressWarnings("unchecked")
    public List<Object> getListModelObject() {
        List<Object> listModelObject = null;
        if (this.key.getValue() instanceof List) {
            listModelObject = (List<Object>) this.key.getValue();
        } else {
            listModelObject = Collections.emptyList();
            listModelObject.add(this.key.getValue());
        }
        return listModelObject;
    }

Collections.emptyList() MUST not be used since it creates an immutable list

Workaround:
as the bug only concerns a call of getListModelObject with a object that has a key taht is not a list, please call the other method: getModelObject

@ghost ghost assigned sbordes Jan 9, 2014

@sbordes sbordes closed this in 234f785 Jan 9, 2014

sbordes added a commit that referenced this issue Jun 11, 2014

Fix #90, bug introduced by 3d6afbe
commit
Don't use Collection.emptyList() for mutable list

sbordes added a commit that referenced this issue Jun 14, 2014

Fix #90, bug introduced by 3d6afbe
commit
Don't use Collection.emptyList() for mutable list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment