Program: 61117
Project: 61117
Buggy source:
/** 
 * @param basePage base
 * @param modalWindow modal window
 * @param connectorTO
 * @param create : set to true only if a CREATE operation is required
 */
public ResourceModalPage(final BasePage basePage,final ModalWindow window,final ResourceTO resourceTO,final boolean createFlag){
  this.resource=resourceTO;
  setupChoiceListsPopulators();
  Form resourceForm=new Form("String_Node_Str");
  resourceForm.setModel(new CompoundPropertyModel(resourceTO));
  if (!createFlag) {
    connectorTO.setId(resourceTO.getConnectorId());
  }
  IModel connectors=new LoadableDetachableModel(){
    @Override protected Object load(){
      return connectorRestClient.getAllConnectors();
    }
  }
;
  final IModel sourceMappingTypes=new LoadableDetachableModel(){
    @Override protected Object load(){
      return Arrays.asList(SourceMappingType.values());
    }
  }
;
  resourceName=new TextField("String_Node_Str");
  resourceName.setEnabled(createFlag);
  resourceName.setRequired(true);
  resourceName.setOutputMarkupId(true);
  resourceForm.add(resourceName);
  forceMandatoryConstraint=new CheckBox("String_Node_Str");
  forceMandatoryConstraint.setOutputMarkupId(true);
  resourceForm.add(forceMandatoryConstraint);
  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");
  connector=new DropDownChoice("String_Node_Str",new Model(connectorTO),connectors,renderer);
  connector.setEnabled(createFlag);
  connector.setModel(new IModel(){
    @Override public Object getObject(){
      return connectorTO;
    }
    @Override public void setObject(    Object object){
      ConnInstanceTO connector=(ConnInstanceTO)object;
      resourceTO.setConnectorId(connector.getId());
    }
    @Override public void detach(){
    }
  }
);
  connector.setRequired(true);
  connector.setEnabled(createFlag);
  resourceForm.add(connector);
  mappingUserSchemaView=new ListView("String_Node_Str",resourceTO.getMappings()){
    SchemaMappingTO mappingTO=null;
    DropDownChoice schemaAttributeChoice=null;
    @Override protected void populateItem(    final ListItem item){
      mappingTO=(SchemaMappingTO)item.getDefaultModelObject();
      item.add(new AjaxDecoratedCheckbox("String_Node_Str",new Model(new Boolean("String_Node_Str"))){
        @Override protected void onUpdate(        final AjaxRequestTarget target){
          int id=new Integer(getParent().getId());
          resourceTO.getMappings().remove(id);
          target.addComponent(mappingUserSchemaContainer);
        }
        @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";
            }
          }
;
        }
      }
);
      item.add(new TextField("String_Node_Str",new PropertyModel(mappingTO,"String_Node_Str")).setRequired(true).setLabel(new Model(getString("String_Node_Str"))));
      schemaAttributeChoice=new DropDownChoice("String_Node_Str",new PropertyModel(mappingTO,"String_Node_Str"),(IModel)null);
      if (mappingTO.getSourceMappingType() == null) {
        schemaAttributeChoice.setChoices(Collections.emptyList());
      }
 else       if (mappingTO.getSourceMappingType().equals(SourceMappingType.UserSchema)) {
        schemaAttributeChoice.setChoices(userSchemaAttributesNames);
        schemaAttributeChoice.setRequired(true);
      }
 else       if (mappingTO.getSourceMappingType().equals(SourceMappingType.RoleSchema)) {
        schemaAttributeChoice.setChoices(roleSchemaAttributesNames);
        schemaAttributeChoice.setRequired(true);
      }
 else       if (mappingTO.getSourceMappingType().equals(SourceMappingType.MembershipSchema)) {
        schemaAttributeChoice.setChoices(membershipSchemaAttributesNames);
        schemaAttributeChoice.setRequired(true);
      }
 else       if (mappingTO.getSourceMappingType().equals(SourceMappingType.SyncopeUserId)) {
        schemaAttributeChoice.setEnabled(false);
        schemaAttributeChoice.setRequired(false);
        schemaAttributeChoice.setChoices(Collections.emptyList());
        mappingTO.setSourceAttrName("String_Node_Str");
      }
 else       if (mappingTO.getSourceMappingType().equals(SourceMappingType.Password)) {
        schemaAttributeChoice.setEnabled(false);
        schemaAttributeChoice.setRequired(false);
        schemaAttributeChoice.setChoices(Collections.emptyList());
        mappingTO.setSourceAttrName("String_Node_Str");
      }
      schemaAttributeChoice.setOutputMarkupId(true);
      item.add(schemaAttributeChoice);
      item.add(new SourceMappingTypesDropDownChoice("String_Node_Str",new PropertyModel(mappingTO,"String_Node_Str"),sourceMappingTypes,schemaAttributeChoice).setRequired(true).setOutputMarkupId(true));
      item.add(new AutoCompleteTextField("String_Node_Str",new PropertyModel(mappingTO,"String_Node_Str")){
        @Override protected Iterator getChoices(        String input){
          List<String> choices=new ArrayList<String>();
          if (Strings.isEmpty(input)) {
            choices=Collections.emptyList();
            return choices.iterator();
          }
          if ("String_Node_Str".startsWith(input.toLowerCase())) {
            choices.add("String_Node_Str");
          }
 else           if ("String_Node_Str".startsWith(input.toLowerCase())) {
            choices.add("String_Node_Str");
          }
          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")));
    }
  }
;
  mappingUserSchemaContainer=new WebMarkupContainer("String_Node_Str");
  mappingUserSchemaContainer.add(mappingUserSchemaView);
  mappingUserSchemaContainer.setOutputMarkupId(true);
  resourceForm.add(mappingUserSchemaContainer);
  addSchemaMappingBtn=new IndicatingAjaxButton("String_Node_Str",new Model(getString("String_Node_Str"))){
    @Override protected void onSubmit(    AjaxRequestTarget target,    Form form){
      resourceTO.getMappings().add(new SchemaMappingTO());
      target.addComponent(mappingUserSchemaContainer);
    }
  }
;
  addSchemaMappingBtn.setDefaultFormProcessing(false);
  resourceForm.add(addSchemaMappingBtn);
  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();
      try {
        resourceFormCustomValidation();
      }
 catch (      IllegalArgumentException e) {
        for (        String error : errors.values()) {
          error(error);
        }
        errors.clear();
        return;
      }
      Resources callerPage=(Resources)basePage;
      try {
        if (createFlag) {
          restClient.createResource(resourceTO);
        }
 else {
          restClient.updateResource(resourceTO);
        }
        callerPage.setOperationResult(true);
        window.close(target);
      }
 catch (      SyncopeClientCompositeErrorException e) {
        error(getString("String_Node_Str") + "String_Node_Str" + e.getMessage());
        callerPage.setOperationResult(false);
        LOG.error("String_Node_Str" + resourceTO);
      }
    }
    @Override protected void onError(    final AjaxRequestTarget target,    final Form form){
      target.addComponent(feedbackPanel);
    }
  }
;
  String allowedRoles;
  if (createFlag) {
    allowedRoles=xmlRolesReader.getAllAllowedRoles("String_Node_Str","String_Node_Str");
  }
 else {
    allowedRoles=xmlRolesReader.getAllAllowedRoles("String_Node_Str","String_Node_Str");
  }
  MetaDataRoleAuthorizationStrategy.authorize(submit,ENABLE,allowedRoles);
  resourceForm.add(submit);
  add(resourceForm);
}

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 ResourceModalPage(final BasePage basePage,final ModalWindow window,final ResourceTO resourceTO,final boolean createFlag){
  this.resource=resourceTO;
  setupChoiceListsPopulators();
  Form resourceForm=new Form("String_Node_Str");
  resourceForm.setModel(new CompoundPropertyModel(resourceTO));
  if (!createFlag) {
    connectorTO.setId(resourceTO.getConnectorId());
  }
  IModel connectors=new LoadableDetachableModel(){
    @Override protected Object load(){
      return connectorRestClient.getAllConnectors();
    }
  }
;
  final IModel sourceMappingTypes=new LoadableDetachableModel(){
    @Override protected Object load(){
      return Arrays.asList(SourceMappingType.values());
    }
  }
;
  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);
  forceMandatoryConstraint=new CheckBox("String_Node_Str");
  forceMandatoryConstraint.setOutputMarkupId(true);
  resourceForm.add(forceMandatoryConstraint);
  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");
  connector=new DropDownChoice("String_Node_Str",new Model(connectorTO),connectors,renderer);
  connector.setEnabled(createFlag);
  connector.setModel(new IModel(){
    @Override public Object getObject(){
      return connectorTO;
    }
    @Override public void setObject(    Object object){
      ConnInstanceTO connector=(ConnInstanceTO)object;
      resourceTO.setConnectorId(connector.getId());
    }
    @Override public void detach(){
    }
  }
);
  connector.setRequired(true);
  connector.setEnabled(createFlag);
  resourceForm.add(connector);
  mappingUserSchemaView=new ListView("String_Node_Str",resourceTO.getMappings()){
    SchemaMappingTO mappingTO=null;
    DropDownChoice schemaAttributeChoice=null;
    @Override protected void populateItem(    final ListItem item){
      mappingTO=(SchemaMappingTO)item.getDefaultModelObject();
      item.add(new AjaxDecoratedCheckbox("String_Node_Str",new Model(new Boolean("String_Node_Str"))){
        @Override protected void onUpdate(        final AjaxRequestTarget target){
          int id=new Integer(getParent().getId());
          resourceTO.getMappings().remove(id);
          target.addComponent(mappingUserSchemaContainer);
        }
        @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";
            }
          }
;
        }
      }
);
      item.add(new TextField("String_Node_Str",new PropertyModel(mappingTO,"String_Node_Str")).setRequired(true).setLabel(new Model(getString("String_Node_Str"))));
      schemaAttributeChoice=new DropDownChoice("String_Node_Str",new PropertyModel(mappingTO,"String_Node_Str"),(IModel)null);
      if (mappingTO.getSourceMappingType() == null) {
        schemaAttributeChoice.setChoices(Collections.emptyList());
      }
 else       if (mappingTO.getSourceMappingType().equals(SourceMappingType.UserSchema)) {
        schemaAttributeChoice.setChoices(userSchemaAttributesNames);
        schemaAttributeChoice.setRequired(true);
      }
 else       if (mappingTO.getSourceMappingType().equals(SourceMappingType.RoleSchema)) {
        schemaAttributeChoice.setChoices(roleSchemaAttributesNames);
        schemaAttributeChoice.setRequired(true);
      }
 else       if (mappingTO.getSourceMappingType().equals(SourceMappingType.MembershipSchema)) {
        schemaAttributeChoice.setChoices(membershipSchemaAttributesNames);
        schemaAttributeChoice.setRequired(true);
      }
 else       if (mappingTO.getSourceMappingType().equals(SourceMappingType.SyncopeUserId)) {
        schemaAttributeChoice.setEnabled(false);
        schemaAttributeChoice.setRequired(false);
        schemaAttributeChoice.setChoices(Collections.emptyList());
        mappingTO.setSourceAttrName("String_Node_Str");
      }
 else       if (mappingTO.getSourceMappingType().equals(SourceMappingType.Password)) {
        schemaAttributeChoice.setEnabled(false);
        schemaAttributeChoice.setRequired(false);
        schemaAttributeChoice.setChoices(Collections.emptyList());
        mappingTO.setSourceAttrName("String_Node_Str");
      }
      schemaAttributeChoice.setOutputMarkupId(true);
      item.add(schemaAttributeChoice);
      item.add(new SourceMappingTypesDropDownChoice("String_Node_Str",new PropertyModel(mappingTO,"String_Node_Str"),sourceMappingTypes,schemaAttributeChoice).setRequired(true).setOutputMarkupId(true));
      item.add(new AutoCompleteTextField("String_Node_Str",new PropertyModel(mappingTO,"String_Node_Str")){
        @Override protected Iterator getChoices(        String input){
          List<String> choices=new ArrayList<String>();
          if (Strings.isEmpty(input)) {
            choices=Collections.emptyList();
            return choices.iterator();
          }
          if ("String_Node_Str".startsWith(input.toLowerCase())) {
            choices.add("String_Node_Str");
          }
 else           if ("String_Node_Str".startsWith(input.toLowerCase())) {
            choices.add("String_Node_Str");
          }
          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")));
    }
  }
;
  mappingUserSchemaContainer=new WebMarkupContainer("String_Node_Str");
  mappingUserSchemaContainer.add(mappingUserSchemaView);
  mappingUserSchemaContainer.setOutputMarkupId(true);
  resourceForm.add(mappingUserSchemaContainer);
  addSchemaMappingBtn=new IndicatingAjaxButton("String_Node_Str",new Model(getString("String_Node_Str"))){
    @Override protected void onSubmit(    AjaxRequestTarget target,    Form form){
      resourceTO.getMappings().add(new SchemaMappingTO());
      target.addComponent(mappingUserSchemaContainer);
    }
  }
;
  addSchemaMappingBtn.setDefaultFormProcessing(false);
  resourceForm.add(addSchemaMappingBtn);
  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();
      try {
        resourceFormCustomValidation();
      }
 catch (      IllegalArgumentException e) {
        for (        String error : errors.values()) {
          error(error);
        }
        errors.clear();
        return;
      }
      Resources callerPage=(Resources)basePage;
      try {
        if (createFlag) {
          restClient.createResource(resourceTO);
        }
 else {
          restClient.updateResource(resourceTO);
        }
        callerPage.setOperationResult(true);
        window.close(target);
      }
 catch (      SyncopeClientCompositeErrorException e) {
        error(getString("String_Node_Str") + "String_Node_Str" + e.getMessage());
        callerPage.setOperationResult(false);
        LOG.error("String_Node_Str" + resourceTO);
      }
    }
    @Override protected void onError(    final AjaxRequestTarget target,    final Form form){
      target.addComponent(feedbackPanel);
    }
  }
;
  String allowedRoles;
  if (createFlag) {
    allowedRoles=xmlRolesReader.getAllAllowedRoles("String_Node_Str","String_Node_Str");
  }
 else {
    allowedRoles=xmlRolesReader.getAllAllowedRoles("String_Node_Str","String_Node_Str");
  }
  MetaDataRoleAuthorizationStrategy.authorize(submit,ENABLE,allowedRoles);
  resourceForm.add(submit);
  add(resourceForm);
}