FieldGroup binder help

I am having an issue handing null values for PopupDateField. I am expecting when there is not a value for PopupDateField, the field should be displayed as empty. When attempting to execute the code below, I get a nullpointerexception when the date input is null. Is there a work around for this?

    EntityAccount entityAccount;
    PropertysetItem item;
    try {
        entityAccount = runner.query(query, handler, 6);

        item = new PropertysetItem();

        item.addItemProperty("id",
                new ObjectProperty<Long>(entityAccount.getId()));
        item.addItemProperty("name", new ObjectProperty<String>(
                entityAccount.getName()));
        item.addItemProperty("abbrname", new ObjectProperty<String>(
                entityAccount.getShortName()));
        item.addItemProperty("fein", new ObjectProperty<String>(
                entityAccount.getFein()));
        item.addItemProperty("activatedate", new ObjectProperty<Date>(
                entityAccount.getActivationDate()));
        item.addItemProperty("deactivatedate", new ObjectProperty<Date>(
                entityAccount.getDeactivationDate()));

        FieldGroup binder = new FieldGroup(item);

        binder.bind(_idField, "id");
        binder.bind(_nameField, "name");
        binder.bind(_abbrName, "abbrname");
        binder.bind(_feinField, "fein");
        binder.bind(_activateDate, "activatedate");
        binder.bind(_deactivateDate, "deactivatedate");
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

thanks.

This is not FieldGroup or PopupDateField related, just use this ObjectProperty Constructor: public ObjectProperty(T value, Class type). ObjectProperty needs to know the type of the Object, so if you pass null, you have to pass the class as constructor argument.

And a little tip for the future, edit your sample code so that it will run after copy&paste and maybe generate some getters/setters… So you will get help faster! Most people won’t take the time to make your code run… :wink: