Program: 61071
Project: 61071
Buggy source:
public ResourceModalPage(final Resources basePage,final ModalWindow window,final ResourceTO resourceTO,final boolean createFlag){
  super();
  uSchemaAttrNames=schemaRestClient.getSchemaNames("String_Node_Str");
  uDerSchemaAttrNames=schemaRestClient.getDerivedSchemaNames("String_Node_Str");
  rSchemaAttrNames=schemaRestClient.getSchemaNames("String_Node_Str");
  rDerSchemaAttrNames=schemaRestClient.getDerivedSchemaNames("String_Node_Str");
  mSchemaAttrNames=schemaRestClient.getSchemaNames("String_Node_Str");
  mDerSchemaAttrNames=schemaRestClient.getDerivedSchemaNames("String_Node_Str");
  final IModel<List<ConnInstanceTO>> connectors=new LoadableDetachableModel<List<ConnInstanceTO>>(){
    @Override protected List<ConnInstanceTO> load(){
      return connectorRestClient.getAllConnectors();
    }
  }
;
  final IModel<List<SourceMappingType>> sourceMappingTypes=new LoadableDetachableModel<List<SourceMappingType>>(){
    @Override protected List<SourceMappingType> load(){
      return Arrays.asList(SourceMappingType.values());
    }
  }
;
  final ConnInstanceTO connectorTO=new ConnInstanceTO();
  if (!createFlag) {
    connectorTO.setId(resourceTO.getConnectorId());
  }
  Form resourceForm=new Form("String_Node_Str");
  resourceForm.setModel(new CompoundPropertyModel(resourceTO));
  TextField resourceName=new TextField("String_Node_Str");
  resourceName.setEnabled(createFlag);
  resourceName.setRequired(true);
  resourceName.setOutputMarkupId(true);
  resourceForm.add(resourceName);
  TextField accountLink=new TextField("String_Node_Str");
  accountLink.setOutputMarkupId(true);
  resourceForm.add(accountLink);
  CheckBox forceMandatoryConstraint=new CheckBox("String_Node_Str");
  forceMandatoryConstraint.setOutputMarkupId(true);
  resourceForm.add(forceMandatoryConstraint);
  DropDownChoice<PropagationMode> optionalPropagationMode=new DropDownChoice<PropagationMode>("String_Node_Str");
  optionalPropagationMode.setModel(new IModel<PropagationMode>(){
    @Override public PropagationMode getObject(){
      return resourceTO.getOptionalPropagationMode();
    }
    @Override public void setObject(    final PropagationMode object){
      resourceTO.setOptionalPropagationMode(object);
    }
    @Override public void detach(){
    }
  }
);
  optionalPropagationMode.setChoices(Arrays.asList(PropagationMode.values()));
  optionalPropagationMode.setOutputMarkupId(true);
  resourceForm.add(optionalPropagationMode);
  ChoiceRenderer renderer=new ChoiceRenderer("String_Node_Str","String_Node_Str");
  DropDownChoice<ConnInstanceTO> connector=new DropDownChoice<ConnInstanceTO>("String_Node_Str",new Model<ConnInstanceTO>(connectorTO),connectors,renderer);
  connector.setEnabled(createFlag);
  connector.setModel(new IModel<ConnInstanceTO>(){
    @Override public ConnInstanceTO getObject(){
      return connectorTO;
    }
    @Override public void setObject(    final ConnInstanceTO connector){
      resourceTO.setConnectorId(connector.getId());
    }
    @Override public void detach(){
    }
  }
);
  connector.setRequired(true);
  connector.setEnabled(createFlag);
  resourceForm.add(connector);
  mappingContainer=new WebMarkupContainer("String_Node_Str");
  mappingContainer.setOutputMarkupId(true);
  resourceForm.add(mappingContainer);
  ListView<SchemaMappingTO> mappings=new ListView<SchemaMappingTO>("String_Node_Str",resourceTO.getMappings()){
    @Override protected void populateItem(    final ListItem<SchemaMappingTO> item){
      final SchemaMappingTO mappingTO=item.getModelObject();
      item.add(new AjaxDecoratedCheckbox("String_Node_Str",new Model(Boolean.FALSE)){
        @Override protected void onUpdate(        final AjaxRequestTarget target){
          int index=-1;
          for (int i=0; i < resourceTO.getMappings().size() && index == -1; i++) {
            if (mappingTO.equals(resourceTO.getMappings().get(i))) {
              index=i;
            }
          }
          if (index != -1) {
            resourceTO.getMappings().remove(index);
            item.getParent().removeAll();
            target.addComponent(mappingContainer);
          }
        }
        @Override protected IAjaxCallDecorator getAjaxCallDecorator(){
          return new AjaxPreprocessingCallDecorator(super.getAjaxCallDecorator()){
            @Override public CharSequence preDecorateScript(            final CharSequence script){
              return "String_Node_Str" + getString("String_Node_Str") + "String_Node_Str"+ "String_Node_Str"+ script+ "String_Node_Str"+ "String_Node_Str";
            }
          }
;
        }
      }
);
      DropDownChoice<String> schemaAttrChoice=new DropDownChoice<String>("String_Node_Str",new PropertyModel<String>(mappingTO,"String_Node_Str"),(IModel)null);
      schemaAttrChoice.setOutputMarkupId(true);
      if (mappingTO.getSourceMappingType() == null) {
        schemaAttrChoice.setChoices(Collections.EMPTY_LIST);
      }
 else {
switch (mappingTO.getSourceMappingType()) {
case UserSchema:
          schemaAttrChoice.setChoices(uSchemaAttrNames);
        break;
case UserDerivedSchema:
      schemaAttrChoice.setChoices(uDerSchemaAttrNames);
    break;
case RoleSchema:
  schemaAttrChoice.setChoices(rSchemaAttrNames);
break;
case RoleDerivedSchema:
schemaAttrChoice.setChoices(rDerSchemaAttrNames);
break;
case MembershipSchema:
schemaAttrChoice.setChoices(mSchemaAttrNames);
break;
case MembershipDerivedSchema:
schemaAttrChoice.setChoices(mDerSchemaAttrNames);
break;
case SyncopeUserId:
schemaAttrChoice.setEnabled(false);
schemaAttrChoice.setRequired(false);
schemaAttrChoice.setChoices(Collections.EMPTY_LIST);
mappingTO.setSourceAttrName("String_Node_Str");
break;
case Password:
schemaAttrChoice.setEnabled(false);
schemaAttrChoice.setRequired(false);
schemaAttrChoice.setChoices(Collections.EMPTY_LIST);
mappingTO.setSourceAttrName("String_Node_Str");
break;
default :
schemaAttrChoice.setChoices(Collections.EMPTY_LIST);
}
}
item.add(schemaAttrChoice);
item.add(new SourceMappingTypesDropDownChoice("String_Node_Str",new PropertyModel<SourceMappingType>(mappingTO,"String_Node_Str"),sourceMappingTypes,schemaAttrChoice).setRequired(true).setOutputMarkupId(true));
item.add(new TextField("String_Node_Str",new PropertyModel(mappingTO,"String_Node_Str")).setRequired(true).setLabel(new Model(getString("String_Node_Str"))).setOutputMarkupId(true));
item.add(new AutoCompleteTextField("String_Node_Str",new PropertyModel(mappingTO,"String_Node_Str")){
@Override protected Iterator getChoices(final String input){
List<String> choices;
if ("String_Node_Str".startsWith(input.toLowerCase())) {
choices=Collections.singletonList("String_Node_Str");
}
 else if ("String_Node_Str".startsWith(input.toLowerCase())) {
choices=Collections.singletonList("String_Node_Str");
}
 else {
choices=Collections.EMPTY_LIST;
}
return choices.iterator();
}
}
);
item.add(new CheckBox("String_Node_Str",new PropertyModel(mappingTO,"String_Node_Str")));
item.add(new CheckBox("String_Node_Str",new PropertyModel(mappingTO,"String_Node_Str")));
}
}
;
mappings.setReuseItems(true);
mappingContainer.add(mappings);
AjaxButton addSchemaMappingBtn=new IndicatingAjaxButton("String_Node_Str",new Model(getString("String_Node_Str"))){
@Override protected void onSubmit(final AjaxRequestTarget target,final Form form){
resourceTO.getMappings().add(new SchemaMappingTO());
target.addComponent(mappingContainer);
}
}
;
addSchemaMappingBtn.setDefaultFormProcessing(false);
resourceForm.add(addSchemaMappingBtn);
AjaxButton submit=new IndicatingAjaxButton("String_Node_Str",new Model(getString("String_Node_Str"))){
@Override protected void onSubmit(final AjaxRequestTarget target,final Form form){
ResourceTO resourceTO=(ResourceTO)form.getDefaultModelObject();
int accountIdCount=0;
for (SchemaMappingTO mapping : resourceTO.getMappings()) {
if (mapping.isAccountid()) {
accountIdCount++;
}
}
if (accountIdCount == 0 || accountIdCount > 1) {
error(getString("String_Node_Str"));
basePage.setOperationResult(false);
}
 else {
try {
if (createFlag) {
restClient.create(resourceTO);
}
 else {
restClient.update(resourceTO);
}
basePage.setOperationResult(true);
window.close(target);
}
 catch (SyncopeClientCompositeErrorException e) {
error(getString("String_Node_Str") + "String_Node_Str" + e.getMessage());
basePage.setOperationResult(false);
LOG.error("String_Node_Str" + resourceTO);
}
}
}
@Override protected void onError(final AjaxRequestTarget target,final Form form){
target.addComponent(feedbackPanel);
}
}
;
resourceForm.add(submit);
add(resourceForm);
MetaDataRoleAuthorizationStrategy.authorize(submit,ENABLE,xmlRolesReader.getAllAllowedRoles("String_Node_Str",createFlag ? "String_Node_Str" : "String_Node_Str"));
}

Fixed version (ground truth):
public ResourceModalPage(final Resources basePage,final ModalWindow window,final ResourceTO resourceTO,final boolean createFlag){
  super();
  uSchemaAttrNames=schemaRestClient.getSchemaNames("String_Node_Str");
  uDerSchemaAttrNames=schemaRestClient.getDerivedSchemaNames("String_Node_Str");
  uVirSchemaAttrNames=schemaRestClient.getVirtualSchemaNames("String_Node_Str");
  rSchemaAttrNames=schemaRestClient.getSchemaNames("String_Node_Str");
  rDerSchemaAttrNames=schemaRestClient.getDerivedSchemaNames("String_Node_Str");
  rVirSchemaAttrNames=schemaRestClient.getVirtualSchemaNames("String_Node_Str");
  mSchemaAttrNames=schemaRestClient.getSchemaNames("String_Node_Str");
  mDerSchemaAttrNames=schemaRestClient.getDerivedSchemaNames("String_Node_Str");
  mVirSchemaAttrNames=schemaRestClient.getVirtualSchemaNames("String_Node_Str");
  final IModel<List<ConnInstanceTO>> connectors=new LoadableDetachableModel<List<ConnInstanceTO>>(){
    @Override protected List<ConnInstanceTO> load(){
      return connectorRestClient.getAllConnectors();
    }
  }
;
  final IModel<List<SourceMappingType>> sourceMappingTypes=new LoadableDetachableModel<List<SourceMappingType>>(){
    @Override protected List<SourceMappingType> load(){
      return Arrays.asList(SourceMappingType.values());
    }
  }
;
  final ConnInstanceTO connectorTO=new ConnInstanceTO();
  if (!createFlag) {
    connectorTO.setId(resourceTO.getConnectorId());
  }
  Form resourceForm=new Form("String_Node_Str");
  resourceForm.setModel(new CompoundPropertyModel(resourceTO));
  TextField resourceName=new TextField("String_Node_Str");
  resourceName.setEnabled(createFlag);
  resourceName.setRequired(true);
  resourceName.setOutputMarkupId(true);
  resourceForm.add(resourceName);
  TextField accountLink=new TextField("String_Node_Str");
  accountLink.setOutputMarkupId(true);
  resourceForm.add(accountLink);
  CheckBox forceMandatoryConstraint=new CheckBox("String_Node_Str");
  forceMandatoryConstraint.setOutputMarkupId(true);
  resourceForm.add(forceMandatoryConstraint);
  DropDownChoice<PropagationMode> optionalPropagationMode=new DropDownChoice<PropagationMode>("String_Node_Str");
  optionalPropagationMode.setModel(new IModel<PropagationMode>(){
    @Override public PropagationMode getObject(){
      return resourceTO.getOptionalPropagationMode();
    }
    @Override public void setObject(    final PropagationMode object){
      resourceTO.setOptionalPropagationMode(object);
    }
    @Override public void detach(){
    }
  }
);
  optionalPropagationMode.setChoices(Arrays.asList(PropagationMode.values()));
  optionalPropagationMode.setOutputMarkupId(true);
  resourceForm.add(optionalPropagationMode);
  ChoiceRenderer renderer=new ChoiceRenderer("String_Node_Str","String_Node_Str");
  DropDownChoice<ConnInstanceTO> connector=new DropDownChoice<ConnInstanceTO>("String_Node_Str",new Model<ConnInstanceTO>(connectorTO),connectors,renderer);
  connector.setEnabled(createFlag);
  connector.setModel(new IModel<ConnInstanceTO>(){
    @Override public ConnInstanceTO getObject(){
      return connectorTO;
    }
    @Override public void setObject(    final ConnInstanceTO connector){
      resourceTO.setConnectorId(connector.getId());
    }
    @Override public void detach(){
    }
  }
);
  connector.setRequired(true);
  connector.setEnabled(createFlag);
  resourceForm.add(connector);
  mappingContainer=new WebMarkupContainer("String_Node_Str");
  mappingContainer.setOutputMarkupId(true);
  resourceForm.add(mappingContainer);
  ListView<SchemaMappingTO> mappings=new ListView<SchemaMappingTO>("String_Node_Str",resourceTO.getMappings()){
    @Override protected void populateItem(    final ListItem<SchemaMappingTO> item){
      final SchemaMappingTO mappingTO=item.getModelObject();
      item.add(new AjaxDecoratedCheckbox("String_Node_Str",new Model(Boolean.FALSE)){
        @Override protected void onUpdate(        final AjaxRequestTarget target){
          int index=-1;
          for (int i=0; i < resourceTO.getMappings().size() && index == -1; i++) {
            if (mappingTO.equals(resourceTO.getMappings().get(i))) {
              index=i;
            }
          }
          if (index != -1) {
            resourceTO.getMappings().remove(index);
            item.getParent().removeAll();
            target.addComponent(mappingContainer);
          }
        }
        @Override protected IAjaxCallDecorator getAjaxCallDecorator(){
          return new AjaxPreprocessingCallDecorator(super.getAjaxCallDecorator()){
            @Override public CharSequence preDecorateScript(            final CharSequence script){
              return "String_Node_Str" + getString("String_Node_Str") + "String_Node_Str"+ "String_Node_Str"+ script+ "String_Node_Str"+ "String_Node_Str";
            }
          }
;
        }
      }
);
      DropDownChoice<String> schemaAttrChoice=new DropDownChoice<String>("String_Node_Str",new PropertyModel<String>(mappingTO,"String_Node_Str"),(IModel)null);
      schemaAttrChoice.setOutputMarkupId(true);
      if (mappingTO.getSourceMappingType() == null) {
        schemaAttrChoice.setChoices(Collections.EMPTY_LIST);
      }
 else {
switch (mappingTO.getSourceMappingType()) {
case UserSchema:
          schemaAttrChoice.setChoices(uSchemaAttrNames);
        break;
case UserDerivedSchema:
      schemaAttrChoice.setChoices(uDerSchemaAttrNames);
    break;
case UserVirtualSchema:
  schemaAttrChoice.setChoices(uVirSchemaAttrNames);
break;
case RoleSchema:
schemaAttrChoice.setChoices(rSchemaAttrNames);
break;
case RoleDerivedSchema:
schemaAttrChoice.setChoices(rDerSchemaAttrNames);
break;
case RoleVirtualSchema:
schemaAttrChoice.setChoices(rVirSchemaAttrNames);
break;
case MembershipSchema:
schemaAttrChoice.setChoices(mSchemaAttrNames);
break;
case MembershipDerivedSchema:
schemaAttrChoice.setChoices(mDerSchemaAttrNames);
break;
case MembershipVirtualSchema:
schemaAttrChoice.setChoices(mVirSchemaAttrNames);
break;
case SyncopeUserId:
schemaAttrChoice.setEnabled(false);
schemaAttrChoice.setRequired(false);
schemaAttrChoice.setChoices(Collections.EMPTY_LIST);
mappingTO.setSourceAttrName("String_Node_Str");
break;
case Password:
schemaAttrChoice.setEnabled(false);
schemaAttrChoice.setRequired(false);
schemaAttrChoice.setChoices(Collections.EMPTY_LIST);
mappingTO.setSourceAttrName("String_Node_Str");
break;
default :
schemaAttrChoice.setChoices(Collections.EMPTY_LIST);
}
}
item.add(schemaAttrChoice);
item.add(new SourceMappingTypesDropDownChoice("String_Node_Str",new PropertyModel<SourceMappingType>(mappingTO,"String_Node_Str"),sourceMappingTypes,schemaAttrChoice).setRequired(true).setOutputMarkupId(true));
item.add(new TextField("String_Node_Str",new PropertyModel(mappingTO,"String_Node_Str")).setRequired(true).setLabel(new Model(getString("String_Node_Str"))).setOutputMarkupId(true));
item.add(new AutoCompleteTextField("String_Node_Str",new PropertyModel(mappingTO,"String_Node_Str")){
@Override protected Iterator getChoices(final String input){
List<String> choices;
if ("String_Node_Str".startsWith(input.toLowerCase())) {
choices=Collections.singletonList("String_Node_Str");
}
 else if ("String_Node_Str".startsWith(input.toLowerCase())) {
choices=Collections.singletonList("String_Node_Str");
}
 else {
choices=Collections.EMPTY_LIST;
}
return choices.iterator();
}
}
);
item.add(new CheckBox("String_Node_Str",new PropertyModel(mappingTO,"String_Node_Str")));
item.add(new CheckBox("String_Node_Str",new PropertyModel(mappingTO,"String_Node_Str")));
}
}
;
mappings.setReuseItems(true);
mappingContainer.add(mappings);
AjaxButton addSchemaMappingBtn=new IndicatingAjaxButton("String_Node_Str",new Model(getString("String_Node_Str"))){
@Override protected void onSubmit(final AjaxRequestTarget target,final Form form){
resourceTO.getMappings().add(new SchemaMappingTO());
target.addComponent(mappingContainer);
}
}
;
addSchemaMappingBtn.setDefaultFormProcessing(false);
resourceForm.add(addSchemaMappingBtn);
AjaxButton submit=new IndicatingAjaxButton("String_Node_Str",new Model(getString("String_Node_Str"))){
@Override protected void onSubmit(final AjaxRequestTarget target,final Form form){
ResourceTO resourceTO=(ResourceTO)form.getDefaultModelObject();
int accountIdCount=0;
for (SchemaMappingTO mapping : resourceTO.getMappings()) {
if (mapping.isAccountid()) {
accountIdCount++;
}
}
if (accountIdCount == 0 || accountIdCount > 1) {
error(getString("String_Node_Str"));
basePage.setOperationResult(false);
}
 else {
try {
if (createFlag) {
restClient.create(resourceTO);
}
 else {
restClient.update(resourceTO);
}
basePage.setOperationResult(true);
window.close(target);
}
 catch (SyncopeClientCompositeErrorException e) {
error(getString("String_Node_Str") + "String_Node_Str" + e.getMessage());
basePage.setOperationResult(false);
LOG.error("String_Node_Str" + resourceTO);
}
}
}
@Override protected void onError(final AjaxRequestTarget target,final Form form){
target.addComponent(feedbackPanel);
}
}
;
resourceForm.add(submit);
add(resourceForm);
MetaDataRoleAuthorizationStrategy.authorize(submit,ENABLE,xmlRolesReader.getAllAllowedRoles("String_Node_Str",createFlag ? "String_Node_Str" : "String_Node_Str"));
}