Skip to content
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

NPE in FileBuilder class #17

Open
RemusSino opened this issue Aug 10, 2017 · 0 comments
Open

NPE in FileBuilder class #17

RemusSino opened this issue Aug 10, 2017 · 0 comments

Comments

@RemusSino
Copy link

RemusSino commented Aug 10, 2017

In Exporter there is the constructor with one argument - Container container. This calls the constructor with two arguments - Container container, Object[] visibleColumns , with null value for visibleColumns. In this constructor, the call this.setContainerToBeExported(container) , eventually creates the FileBuilder and ends up in the setContainer(container) method which also set's the visibleColumns. Then in the same constructor you set again the visibleColumns, to null this time, because it is the value passed in as parameter.
This leads to NPE in FileBuilder in methods like buildColumnHeaders, where you check the length on the visibleColumns array which is in fact null - if (this.visibleColumns.length != 0) .

My solution:

    public Exporter(Container container, Object[] visibleColumns) {
        this();
        this.setCaption("Exporter");
//set visible columns first
        this.setVisibleColumns(visibleColumns);
//then, the container
        this.setContainerToBeExported(container);
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant