Program: 61069
Project: 61069
Buggy source:
public MembershipModalPage(final Page basePage,final ModalWindow window,final MembershipTO membershipTO,final boolean createFlag){
  final Form form=new Form("String_Node_Str");
  form.setModel(new CompoundPropertyModel(membershipTO));
  setupSchemaWrappers(createFlag,membershipTO);
  final IModel<List<String>> derivedSchemaNames=new LoadableDetachableModel<List<String>>(){
    @Override protected List<String> load(){
      return schemaRestClient.getDerivedSchemaNames("String_Node_Str");
    }
  }
;
  final ListView userAttributesView=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() == SchemaType.String) {
            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);
          }
 else           if (schemaTO.getType() == SchemaType.Boolean) {
            panel=new AjaxCheckBoxPanel("String_Node_Str",schemaTO.getName(),new Model(){
              @Override public Serializable getObject(){
                return "String_Node_Str";
              }
              @Override public void setObject(              Serializable object){
                Boolean val=(Boolean)object;
                item.setModelObject(val.toString());
              }
            }
,required);
          }
 else           if (schemaTO.getType() == SchemaType.Date) {
            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(dateValue);
                  }
 else {
                    date=null;
                  }
                }
 catch (                ParseException e) {
                  LOG.error("String_Node_Str",e);
                }
                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,schemaTO.isReadonly(),form);
          }
          item.add(panel);
        }
      }
);
      AjaxButton addButton=new IndicatingAjaxButton("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() == SchemaType.Boolean) {
        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);
    }
  }
;
  submit=new AjaxButton("String_Node_Str",new Model(getString("String_Node_Str"))){
    @Override protected void onSubmit(    AjaxRequestTarget target,    Form form){
      MembershipTO membershipTO=(MembershipTO)form.getDefaultModelObject();
      membershipTO.setAttributes(getMembershipAttributes());
      if (createFlag) {
        ((UserModalPage)basePage).getMembershipTOs().add(membershipTO);
      }
 else {
        ((UserModalPage)basePage).getMembershipTOs().remove(membershipTO);
        ((UserModalPage)basePage).getMembershipTOs().add(membershipTO);
      }
      window.close(target);
    }
    @Override protected void onError(    AjaxRequestTarget target,    Form form){
      target.addComponent(feedbackPanel);
    }
  }
;
  String allowedRoles=null;
  if (createFlag) {
    allowedRoles=xmlRolesReader.getAllAllowedRoles("String_Node_Str","String_Node_Str");
  }
 else {
    allowedRoles=xmlRolesReader.getAllAllowedRoles("String_Node_Str","String_Node_Str");
  }
  MetaDataRoleAuthorizationStrategy.authorize(submit,RENDER,allowedRoles);
  form.add(submit);
  container=new WebMarkupContainer("String_Node_Str");
  container.add(userAttributesView);
  container.setOutputMarkupId(true);
  form.add(container);
  add(form);
}

Fixed version (ground truth):
public MembershipModalPage(final Page basePage,final ModalWindow window,final MembershipTO membershipTO,final boolean createFlag){
  final Form form=new Form("String_Node_Str");
  form.setModel(new CompoundPropertyModel(membershipTO));
  setupSchemaWrappers(createFlag,membershipTO);
  final IModel<List<String>> derivedSchemaNames=new LoadableDetachableModel<List<String>>(){
    @Override protected List<String> load(){
      return schemaRestClient.getDerivedSchemaNames("String_Node_Str");
    }
  }
;
  final IModel<List<String>> virtualSchemaNames=new LoadableDetachableModel<List<String>>(){
    @Override protected List<String> load(){
      return schemaRestClient.getVirtualSchemaNames("String_Node_Str");
    }
  }
;
  final ListView userAttributesView=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() == SchemaType.String) {
            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);
          }
 else           if (schemaTO.getType() == SchemaType.Boolean) {
            panel=new AjaxCheckBoxPanel("String_Node_Str",schemaTO.getName(),new Model(){
              @Override public Serializable getObject(){
                return "String_Node_Str";
              }
              @Override public void setObject(              Serializable object){
                Boolean val=(Boolean)object;
                item.setModelObject(val.toString());
              }
            }
,required);
          }
 else           if (schemaTO.getType() == SchemaType.Date) {
            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(dateValue);
                  }
 else {
                    date=null;
                  }
                }
 catch (                ParseException e) {
                  LOG.error("String_Node_Str",e);
                }
                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,schemaTO.isReadonly(),form);
          }
          item.add(panel);
        }
      }
);
      AjaxButton addButton=new IndicatingAjaxButton("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() == SchemaType.Boolean) {
        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);
    }
  }
;
  submit=new AjaxButton("String_Node_Str",new Model(getString("String_Node_Str"))){
    @Override protected void onSubmit(    AjaxRequestTarget target,    Form form){
      MembershipTO membershipTO=(MembershipTO)form.getDefaultModelObject();
      membershipTO.setAttributes(getMembershipAttributes());
      if (createFlag) {
        ((UserModalPage)basePage).getMembershipTOs().add(membershipTO);
      }
 else {
        ((UserModalPage)basePage).getMembershipTOs().remove(membershipTO);
        ((UserModalPage)basePage).getMembershipTOs().add(membershipTO);
      }
      window.close(target);
    }
    @Override protected void onError(    AjaxRequestTarget target,    Form form){
      target.addComponent(feedbackPanel);
    }
  }
;
  String allowedRoles=null;
  if (createFlag) {
    allowedRoles=xmlRolesReader.getAllAllowedRoles("String_Node_Str","String_Node_Str");
  }
 else {
    allowedRoles=xmlRolesReader.getAllAllowedRoles("String_Node_Str","String_Node_Str");
  }
  MetaDataRoleAuthorizationStrategy.authorize(submit,RENDER,allowedRoles);
  form.add(submit);
  container=new WebMarkupContainer("String_Node_Str");
  container.add(userAttributesView);
  container.setOutputMarkupId(true);
  form.add(container);
  form.add((new DerivedAttributesForm("String_Node_Str")).build(this,membershipTO,derivedSchemaNames));
  form.add((new VirtualAttributesForm("String_Node_Str")).build(this,membershipTO,virtualSchemaNames));
  add(form);
}