Program: 61215
Project: 61215
Buggy source:
/** 
 * @param basePage base
 * @param modalWindow modal window
 * @param connectorTO
 * @param create : set to true only if a CREATE operation is required
 */
public RoleModalPage(final BasePage basePage,final ModalWindow window,final RoleTO roleTO,final boolean createFlag){
  Form form=new Form("String_Node_Str");
  form.setModel(new CompoundPropertyModel(roleTO));
  setupSchemaWrappers(createFlag,roleTO);
  if (!createFlag)   cloneOldRoleTO(roleTO);
  final ListView roleAttributesView=new ListView("String_Node_Str",schemaWrappers){
    @Override protected void populateItem(    ListItem item){
      final SchemaWrapper schemaWrapper=(SchemaWrapper)item.getDefaultModelObject();
      final SchemaTO schemaTO=schemaWrapper.getSchemaTO();
      item.add(new Label("String_Node_Str",schemaWrapper.getSchemaTO().getName()));
      item.add(new ListView("String_Node_Str",schemaWrapper.getValues()){
        Panel panel;
        @Override protected void populateItem(        final ListItem item){
          String mandatoryCondition=schemaTO.getMandatoryCondition();
          boolean required=false;
          if (mandatoryCondition.equalsIgnoreCase("String_Node_Str")) {
            required=true;
          }
          if (schemaTO.getType().getClassName().equals("String_Node_Str")) {
            panel=new AjaxCheckBoxPanel("String_Node_Str",schemaTO.getName(),new Model(){
              @Override public Serializable getObject(){
                return (String)item.getModelObject();
              }
              @Override public void setObject(              Serializable object){
                Boolean val=(Boolean)object;
                item.setModelObject(val.toString());
              }
            }
,required);
          }
 else           if (schemaTO.getType().getClassName().equals("String_Node_Str")) {
            panel=new DateFieldPanel("String_Node_Str",schemaTO.getName(),new Model(){
              @Override public Serializable getObject(){
                DateFormat formatter=new SimpleDateFormat(schemaTO.getConversionPattern());
                Date date=new Date();
                try {
                  String dateValue=(String)item.getModelObject();
                  formatter=new SimpleDateFormat(schemaTO.getConversionPattern());
                  if (!dateValue.equals("String_Node_Str"))                   date=formatter.parse((String)item.getModelObject());
                }
 catch (                ParseException ex) {
                  Logger.getLogger(RoleModalPage.class.getName()).log(Level.SEVERE,null,ex);
                }
                return date;
              }
              @Override public void setObject(              Serializable object){
                Date date=(Date)object;
                Format formatter=new SimpleDateFormat(schemaTO.getConversionPattern());
                String val=formatter.format(date);
                item.setModelObject(val);
              }
            }
,required);
          }
 else {
            panel=new AjaxTextFieldPanel("String_Node_Str",schemaTO.getName(),new Model(){
              @Override public Serializable getObject(){
                return (String)item.getModelObject();
              }
              @Override public void setObject(              Serializable object){
                item.setModelObject((String)object);
              }
            }
,required);
          }
          item.add(panel);
        }
      }
);
      AjaxButton addButton=new AjaxButton("String_Node_Str",new Model(getString("String_Node_Str"))){
        @Override protected void onSubmit(        AjaxRequestTarget target,        Form form){
          schemaWrapper.getValues().add("String_Node_Str");
          target.addComponent(container);
        }
      }
;
      AjaxButton dropButton=new AjaxButton("String_Node_Str",new Model(getString("String_Node_Str"))){
        @Override protected void onSubmit(        AjaxRequestTarget target,        Form form){
          schemaWrapper.getValues().remove(schemaWrapper.getValues().size() - 1);
          target.addComponent(container);
        }
      }
;
      if (schemaTO.getType().getClassName().equals("String_Node_Str")) {
        addButton.setVisible(false);
        dropButton.setVisible(false);
      }
      addButton.setDefaultFormProcessing(false);
      addButton.setVisible(schemaTO.isMultivalue());
      dropButton.setDefaultFormProcessing(false);
      dropButton.setVisible(schemaTO.isMultivalue());
      if (schemaWrapper.getValues().size() == 1) {
        dropButton.setVisible(false);
      }
      item.add(addButton);
      item.add(dropButton);
    }
  }
;
  form.add(roleAttributesView);
  ListModel<ResourceTO> selectedResources=new ListModel<ResourceTO>();
  selectedResources.setObject(getSelectedResources(roleTO));
  ListModel<ResourceTO> availableResources=new ListModel<ResourceTO>();
  availableResources.setObject(getAvailableResources(roleTO));
  ChoiceRenderer paletteRenderer=new ChoiceRenderer("String_Node_Str","String_Node_Str");
  final Palette<ResourceTO> resourcesPalette=new Palette("String_Node_Str",selectedResources,availableResources,paletteRenderer,8,false);
  form.add(resourcesPalette);
  container=new WebMarkupContainer("String_Node_Str");
  container.add(roleAttributesView);
  container.setOutputMarkupId(true);
  form.add(container);
  TextField name=new TextField("String_Node_Str");
  name.setRequired(true);
  container.add(name);
  submit=new AjaxButton("String_Node_Str",new Model(getString("String_Node_Str"))){
    @Override protected void onSubmit(    AjaxRequestTarget target,    Form form){
      RoleTO roleTO=(RoleTO)form.getDefaultModelObject();
      boolean res=false;
      try {
        roleTO.setResources(getResourcesSet(resourcesPalette.getModelCollection()));
        roleTO.setAttributes(getRoleAttributes());
        if (createFlag) {
          restClient.createRole(roleTO);
          Roles callerPage=(Roles)basePage;
          callerPage.setOperationResult(true);
          window.close(target);
        }
 else {
          setupRoleMod(roleTO);
          res=restClient.updateRole(roleMod);
          if (!res) {
            error(getString("String_Node_Str"));
          }
 else {
            Roles callerPage=(Roles)basePage;
            callerPage.setOperationResult(true);
            window.close(target);
          }
        }
      }
 catch (      Exception e) {
        error(getString("String_Node_Str") + "String_Node_Str" + e.getMessage());
      }
    }
    @Override protected void onError(    AjaxRequestTarget target,    Form form){
      target.addComponent(form.get("String_Node_Str"));
    }
  }
;
  form.add(submit);
  form.add(new FeedbackPanel("String_Node_Str").setOutputMarkupId(true));
  add(form);
}

Fixed version (ground truth):
/** 
 * @param basePage base
 * @param modalWindow modal window
 * @param connectorTO
 * @param create : set to true only if a CREATE operation is required
 */
public RoleModalPage(final BasePage basePage,final ModalWindow window,final RoleTO roleTO,final boolean createFlag){
  Form form=new Form("String_Node_Str");
  form.setModel(new CompoundPropertyModel(roleTO));
  setupSchemaWrappers(createFlag,roleTO);
  if (!createFlag)   cloneOldRoleTO(roleTO);
  final ListView roleAttributesView=new ListView("String_Node_Str",schemaWrappers){
    @Override protected void populateItem(    ListItem item){
      final SchemaWrapper schemaWrapper=(SchemaWrapper)item.getDefaultModelObject();
      final SchemaTO schemaTO=schemaWrapper.getSchemaTO();
      item.add(new Label("String_Node_Str",schemaWrapper.getSchemaTO().getName()));
      item.add(new ListView("String_Node_Str",schemaWrapper.getValues()){
        Panel panel;
        @Override protected void populateItem(        final ListItem item){
          String mandatoryCondition=schemaTO.getMandatoryCondition();
          boolean required=false;
          if (mandatoryCondition.equalsIgnoreCase("String_Node_Str")) {
            required=true;
          }
          if (schemaTO.getType().getClassName().equals("String_Node_Str")) {
            panel=new AjaxCheckBoxPanel("String_Node_Str",schemaTO.getName(),new Model(){
              @Override public Serializable getObject(){
                return (String)item.getModelObject();
              }
              @Override public void setObject(              Serializable object){
                Boolean val=(Boolean)object;
                item.setModelObject(val.toString());
              }
            }
,required);
          }
 else           if (schemaTO.getType().getClassName().equals("String_Node_Str")) {
            panel=new DateFieldPanel("String_Node_Str",schemaTO.getName(),new Model(){
              @Override public Serializable getObject(){
                DateFormat formatter=new SimpleDateFormat(schemaTO.getConversionPattern());
                Date date=new Date();
                try {
                  String dateValue=(String)item.getModelObject();
                  if (!dateValue.equals("String_Node_Str"))                   date=formatter.parse(dateValue);
                }
 catch (                ParseException ex) {
                  Logger.getLogger(RoleModalPage.class.getName()).log(Level.SEVERE,null,ex);
                }
                return date;
              }
              @Override public void setObject(              Serializable object){
                Date date=(Date)object;
                Format formatter=new SimpleDateFormat(schemaTO.getConversionPattern());
                String val=formatter.format(date);
                item.setModelObject(val);
              }
            }
,schemaTO.getConversionPattern(),required);
          }
 else {
            panel=new AjaxTextFieldPanel("String_Node_Str",schemaTO.getName(),new Model(){
              @Override public Serializable getObject(){
                return (String)item.getModelObject();
              }
              @Override public void setObject(              Serializable object){
                item.setModelObject((String)object);
              }
            }
,required);
          }
          item.add(panel);
        }
      }
);
      AjaxButton addButton=new AjaxButton("String_Node_Str",new Model(getString("String_Node_Str"))){
        @Override protected void onSubmit(        AjaxRequestTarget target,        Form form){
          schemaWrapper.getValues().add("String_Node_Str");
          target.addComponent(container);
        }
      }
;
      AjaxButton dropButton=new AjaxButton("String_Node_Str",new Model(getString("String_Node_Str"))){
        @Override protected void onSubmit(        AjaxRequestTarget target,        Form form){
          schemaWrapper.getValues().remove(schemaWrapper.getValues().size() - 1);
          target.addComponent(container);
        }
      }
;
      if (schemaTO.getType().getClassName().equals("String_Node_Str")) {
        addButton.setVisible(false);
        dropButton.setVisible(false);
      }
      addButton.setDefaultFormProcessing(false);
      addButton.setVisible(schemaTO.isMultivalue());
      dropButton.setDefaultFormProcessing(false);
      dropButton.setVisible(schemaTO.isMultivalue());
      if (schemaWrapper.getValues().size() == 1) {
        dropButton.setVisible(false);
      }
      item.add(addButton);
      item.add(dropButton);
    }
  }
;
  form.add(roleAttributesView);
  ListModel<ResourceTO> selectedResources=new ListModel<ResourceTO>();
  selectedResources.setObject(getSelectedResources(roleTO));
  ListModel<ResourceTO> availableResources=new ListModel<ResourceTO>();
  availableResources.setObject(getAvailableResources(roleTO));
  ChoiceRenderer paletteRenderer=new ChoiceRenderer("String_Node_Str","String_Node_Str");
  final Palette<ResourceTO> resourcesPalette=new Palette("String_Node_Str",selectedResources,availableResources,paletteRenderer,8,false);
  form.add(resourcesPalette);
  container=new WebMarkupContainer("String_Node_Str");
  container.add(roleAttributesView);
  container.setOutputMarkupId(true);
  form.add(container);
  TextField name=new TextField("String_Node_Str");
  name.setRequired(true);
  container.add(name);
  submit=new AjaxButton("String_Node_Str",new Model(getString("String_Node_Str"))){
    @Override protected void onSubmit(    AjaxRequestTarget target,    Form form){
      RoleTO roleTO=(RoleTO)form.getDefaultModelObject();
      boolean res=false;
      try {
        roleTO.setResources(getResourcesSet(resourcesPalette.getModelCollection()));
        roleTO.setAttributes(getRoleAttributes());
        if (createFlag) {
          restClient.createRole(roleTO);
          Roles callerPage=(Roles)basePage;
          callerPage.setOperationResult(true);
          window.close(target);
        }
 else {
          setupRoleMod(roleTO);
          res=restClient.updateRole(roleMod);
          if (!res) {
            error(getString("String_Node_Str"));
          }
 else {
            Roles callerPage=(Roles)basePage;
            callerPage.setOperationResult(true);
            window.close(target);
          }
        }
      }
 catch (      Exception e) {
        error(getString("String_Node_Str") + "String_Node_Str" + e.getMessage());
      }
    }
    @Override protected void onError(    AjaxRequestTarget target,    Form form){
      target.addComponent(form.get("String_Node_Str"));
    }
  }
;
  form.add(submit);
  form.add(new FeedbackPanel("String_Node_Str").setOutputMarkupId(true));
  add(form);
}