(Newbie) SQLContainer - Like Filter - Nullpointer

Hi all!

First of all i want apreciate the great work with this add-on (SQLcontainer), it’s very helpfull.

Well, after a lot of test…I have found a problem which report a NullpointerException and show a Internal Error to the user.

The code is placed in my “init()” method of the Controller


    		TableQuery tq2= new TableQuery(TABLE_NAME,getConnectionPool(),primaryKeyList);
		container= new SQLContainer(tq2);
			
		Filter defaultFilter= new Not(new Like(ATRIBUTE,"** DISCARD **"));
		container.addContainerFilter(defaultFilter);

The first time the controller is loaded this work fine. After this I show a window to create a new element…and then occurs the crash. Any action I did, exit without saving data for example, throw a NullpointerException in the

  • com.vaadin.addon.sqlcontainer.filters Like Class

    public boolean passesFilter(Object itemId, Item item)
            throws UnsupportedOperationException {
        if (!item.getItemProperty(getPropertyId()).getType()
                .isAssignableFrom(String.class)) {
            // We can only handle strings
            return false;
        }
        String colValue = (String) item.getItemProperty(getPropertyId()).getValue();

        String pattern = getValue().replace("%", ".*");
        
        if (isCaseSensitive()) {
            return colValue.matches(pattern);
        }
        return colValue.toUpperCase().matches(pattern.toUpperCase());
    }

The colValue is NULL and crash the code…the curious is that any value of tablequery has a NULL value in ATRIBUTE…

Can anyone help me?

My fast solution is apply a patch in this method and add a if/else sentence validating colValue is not null…but may be I am doing wrong due to my no experience in vaadin :slight_smile:

I use Vaadin 6.6.2 and SQLContainer 1.1.0.

More info…and I get crazy at this point…this error only appears with Internet Explorer…if I try in Firefox works fine o_O

Thanks in advance,
Regards.