Program: 61078
Project: 61078
Buggy source:
public ConnectorModalPage(final Connectors basePage,final ModalWindow window,final ConnInstanceTO connectorTO,final boolean createFlag){
  final IModel<List<ConnBundleTO>> bundles=new LoadableDetachableModel<List<ConnBundleTO>>(){
    @Override protected List<ConnBundleTO> load(){
      return restClient.getAllBundles();
    }
  }
;
  selectedCapabilities=new ArrayList(createFlag ? EnumSet.noneOf(ConnectorCapability.class) : connectorTO.getCapabilities());
  IModel<List<ConnConfProperty>> selectedBundleProperties=new LoadableDetachableModel<List<ConnConfProperty>>(){
    @Override protected List<ConnConfProperty> load(){
      List<ConnConfProperty> result;
      if (createFlag) {
        connectorTO.setConnectorName(selectedBundleTO.getConnectorName());
        connectorTO.setVersion(selectedBundleTO.getVersion());
        result=new ArrayList<ConnConfProperty>();
        ConnConfProperty propertyTO;
        for (        ConnConfPropSchema key : selectedBundleTO.getProperties()) {
          propertyTO=new ConnConfProperty();
          propertyTO.setSchema(key);
          result.add(propertyTO);
        }
      }
 else {
        selectedBundleTO.setBundleName(connectorTO.getBundleName());
        result=new ArrayList(connectorTO.getConfiguration());
      }
      return result;
    }
  }
;
  final TextField connectorName=new TextField("String_Node_Str");
  connectorName.setEnabled(false);
  connectorName.setOutputMarkupId(true);
  TextField displayName=new TextField("String_Node_Str");
  displayName.setOutputMarkupId(true);
  displayName.setRequired(true);
  final TextField version=new TextField("String_Node_Str");
  version.setEnabled(false);
  version.setOutputMarkupId(true);
  final DropDownChoice<ConnBundleTO> bundle=new DropDownChoice<ConnBundleTO>("String_Node_Str",bundles,new ChoiceRenderer<ConnBundleTO>("String_Node_Str","String_Node_Str"));
  bundle.setModel(new IModel<ConnBundleTO>(){
    @Override public ConnBundleTO getObject(){
      return selectedBundleTO;
    }
    @Override public void setObject(    final ConnBundleTO object){
      selectedBundleTO=object;
    }
    @Override public void detach(){
    }
  }
);
  bundle.add(new AjaxFormComponentUpdatingBehavior("String_Node_Str"){
    @Override protected void onUpdate(    final AjaxRequestTarget target){
      connectorTO.setConfiguration(new HashSet<ConnConfProperty>());
      target.addComponent(propertiesContainer);
      target.addComponent(connectorName);
      target.addComponent(version);
    }
  }
);
  bundle.setRequired(true);
  bundle.setEnabled(createFlag);
  ListView<ConnConfProperty> propView=new ListView<ConnConfProperty>("String_Node_Str",selectedBundleProperties){
    @Override protected void populateItem(    final ListItem<ConnConfProperty> item){
      ConnConfProperty property=item.getModelObject();
      item.add(new Label("String_Node_Str",property.getSchema().getName()));
      item.add(new AjaxTextFieldPanel("String_Node_Str",property.getSchema().getName(),new PropertyModel<String>(property,"String_Node_Str"),property.getSchema().isRequired()));
      connectorTO.getConfiguration().add(property);
    }
  }
;
  propertiesContainer=new WebMarkupContainer("String_Node_Str");
  propertiesContainer.setOutputMarkupId(true);
  propertiesContainer.add(propView);
  Form connectorForm=new Form("String_Node_Str");
  connectorForm.setModel(new CompoundPropertyModel(connectorTO));
  connectorForm.add(propertiesContainer);
  AjaxButton submit=new IndicatingAjaxButton("String_Node_Str",new Model(getString("String_Node_Str"))){
    @Override protected void onSubmit(    final AjaxRequestTarget target,    final Form form){
      ConnInstanceTO connector=(ConnInstanceTO)form.getDefaultModelObject();
      connector.setBundleName(bundle.getModelValue());
      connector.setCapabilities(new HashSet<ConnectorCapability>(selectedCapabilities));
      try {
        if (createFlag) {
          restClient.create(connector);
        }
 else {
          restClient.update(connector);
        }
        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" + connector);
      }
    }
    @Override protected void onError(    final AjaxRequestTarget target,    final Form form){
      target.addComponent(feedbackPanel);
    }
  }
;
  String allowedRoles=createFlag ? xmlRolesReader.getAllAllowedRoles("String_Node_Str","String_Node_Str") : xmlRolesReader.getAllAllowedRoles("String_Node_Str","String_Node_Str");
  MetaDataRoleAuthorizationStrategy.authorize(submit,ENABLE,allowedRoles);
  connectorForm.add(connectorName);
  connectorForm.add(displayName);
  connectorForm.add(bundle);
  connectorForm.add(version);
  final IModel<List<ConnectorCapability>> capabilities=new LoadableDetachableModel<List<ConnectorCapability>>(){
    @Override protected List<ConnectorCapability> load(){
      return Arrays.asList(ConnectorCapability.values());
    }
  }
;
  capabilitiesPalette=new CheckBoxMultipleChoice("String_Node_Str",new PropertyModel(this,"String_Node_Str"),capabilities);
  connectorForm.add(capabilitiesPalette);
  connectorForm.add(submit);
  add(connectorForm);
}

Fixed version (ground truth):
public ConnectorModalPage(final Connectors basePage,final ModalWindow window,final ConnInstanceTO connectorTO,final boolean createFlag){
  final IModel<List<ConnBundleTO>> bundles=new LoadableDetachableModel<List<ConnBundleTO>>(){
    @Override protected List<ConnBundleTO> load(){
      return restClient.getAllBundles();
    }
  }
;
  selectedCapabilities=new ArrayList(createFlag ? EnumSet.noneOf(ConnectorCapability.class) : connectorTO.getCapabilities());
  IModel<List<ConnConfProperty>> selectedBundleProperties=new LoadableDetachableModel<List<ConnConfProperty>>(){
    @Override protected List<ConnConfProperty> load(){
      List<ConnConfProperty> result;
      if (createFlag) {
        connectorTO.setConnectorName(selectedBundleTO.getConnectorName());
        connectorTO.setVersion(selectedBundleTO.getVersion());
        result=new ArrayList<ConnConfProperty>();
        ConnConfProperty propertyTO;
        for (        ConnConfPropSchema key : selectedBundleTO.getProperties()) {
          propertyTO=new ConnConfProperty();
          propertyTO.setSchema(key);
          result.add(propertyTO);
        }
      }
 else {
        selectedBundleTO.setBundleName(connectorTO.getBundleName());
        result=new ArrayList(connectorTO.getConfiguration());
      }
      return result;
    }
  }
;
  final TextField connectorName=new TextField("String_Node_Str");
  connectorName.setEnabled(false);
  connectorName.setOutputMarkupId(true);
  TextField displayName=new TextField("String_Node_Str");
  displayName.setOutputMarkupId(true);
  displayName.setRequired(true);
  final TextField version=new TextField("String_Node_Str");
  version.setEnabled(false);
  version.setOutputMarkupId(true);
  final DropDownChoice<ConnBundleTO> bundle=new DropDownChoice<ConnBundleTO>("String_Node_Str",bundles,new ChoiceRenderer<ConnBundleTO>("String_Node_Str","String_Node_Str"));
  bundle.setModel(new IModel<ConnBundleTO>(){
    @Override public ConnBundleTO getObject(){
      return selectedBundleTO;
    }
    @Override public void setObject(    final ConnBundleTO object){
      selectedBundleTO=object;
    }
    @Override public void detach(){
    }
  }
);
  bundle.add(new AjaxFormComponentUpdatingBehavior("String_Node_Str"){
    @Override protected void onUpdate(    final AjaxRequestTarget target){
      connectorTO.setConfiguration(new HashSet<ConnConfProperty>());
      target.addComponent(propertiesContainer);
      target.addComponent(connectorName);
      target.addComponent(version);
    }
  }
);
  bundle.setRequired(true);
  bundle.setEnabled(createFlag);
  ListView<ConnConfProperty> propView=new ListView<ConnConfProperty>("String_Node_Str",selectedBundleProperties){
    @Override protected void populateItem(    final ListItem<ConnConfProperty> item){
      ConnConfProperty property=item.getModelObject();
      item.add(new Label("String_Node_Str",property.getSchema().getDisplayName() == null || property.getSchema().getDisplayName().isEmpty() ? property.getSchema().getName() : property.getSchema().getDisplayName()));
      item.add(new AjaxTextFieldPanel("String_Node_Str",property.getSchema().getName(),new PropertyModel<String>(property,"String_Node_Str"),property.getSchema().isRequired(),property.getSchema().getHelpMessage()));
      connectorTO.getConfiguration().add(property);
    }
  }
;
  propertiesContainer=new WebMarkupContainer("String_Node_Str");
  propertiesContainer.setOutputMarkupId(true);
  propertiesContainer.add(propView);
  Form connectorForm=new Form("String_Node_Str");
  connectorForm.setModel(new CompoundPropertyModel(connectorTO));
  connectorForm.add(propertiesContainer);
  AjaxButton submit=new IndicatingAjaxButton("String_Node_Str",new Model(getString("String_Node_Str"))){
    @Override protected void onSubmit(    final AjaxRequestTarget target,    final Form form){
      ConnInstanceTO connector=(ConnInstanceTO)form.getDefaultModelObject();
      connector.setBundleName(bundle.getModelValue());
      if (!selectedCapabilities.isEmpty()) {
        connector.setCapabilities(EnumSet.copyOf(selectedCapabilities));
      }
 else {
        connector.setCapabilities(EnumSet.noneOf(ConnectorCapability.class));
      }
      try {
        if (createFlag) {
          restClient.create(connector);
        }
 else {
          restClient.update(connector);
        }
        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" + connector);
      }
    }
    @Override protected void onError(    final AjaxRequestTarget target,    final Form form){
      target.addComponent(feedbackPanel);
    }
  }
;
  String allowedRoles=createFlag ? xmlRolesReader.getAllAllowedRoles("String_Node_Str","String_Node_Str") : xmlRolesReader.getAllAllowedRoles("String_Node_Str","String_Node_Str");
  MetaDataRoleAuthorizationStrategy.authorize(submit,ENABLE,allowedRoles);
  connectorForm.add(connectorName);
  connectorForm.add(displayName);
  connectorForm.add(bundle);
  connectorForm.add(version);
  final IModel<List<ConnectorCapability>> capabilities=new LoadableDetachableModel<List<ConnectorCapability>>(){
    @Override protected List<ConnectorCapability> load(){
      return Arrays.asList(ConnectorCapability.values());
    }
  }
;
  capabilitiesPalette=new CheckBoxMultipleChoice("String_Node_Str",new PropertyModel(this,"String_Node_Str"),capabilities);
  connectorForm.add(capabilitiesPalette);
  connectorForm.add(submit);
  add(connectorForm);
}