Program: 61149
Project: 61149
Buggy source:
/** 
 * @param basePage base
 * @param modalWindow modal window
 * @param connectorTO
 * @param create : set to true only if a CREATE operation is required
 */
public ConnectorsModalPage(final BasePage basePage,final ModalWindow window,final ConnectorInstanceTO connectorTO,final boolean createFlag){
  Form connectorForm=new Form("String_Node_Str");
  connectorForm.setModel(new CompoundPropertyModel(connectorTO));
  if (!createFlag)   setupSelections(connectorTO);
  IModel bundles=new LoadableDetachableModel(){
    protected Object load(){
      return restClient.getAllBundles();
    }
  }
;
  IModel selectedBundleProperties=new LoadableDetachableModel(){
    protected Object load(){
      List<PropertyTO> list;
      if (createFlag) {
        connectorTO.setConnectorName(selectedBundleTO.getConnectorName());
        connectorTO.setVersion(selectedBundleTO.getVersion());
        list=new ArrayList<PropertyTO>();
        PropertyTO propertyTO;
        for (        String key : selectedBundleTO.getProperties()) {
          propertyTO=new PropertyTO();
          propertyTO.setKey(key);
          list.add(propertyTO);
        }
      }
 else {
        selectedBundleTO.setBundleName(connectorTO.getBundleName());
        list=hashSetToList(connectorTO.getConfiguration());
      }
      return list;
    }
  }
;
  connectorName=new TextField("String_Node_Str");
  connectorName.setEnabled(false);
  connectorName.setOutputMarkupId(true);
  version=new TextField("String_Node_Str");
  version.setEnabled(false);
  version.setOutputMarkupId(true);
  ChoiceRenderer renderer=new ChoiceRenderer("String_Node_Str","String_Node_Str");
  bundle=new DropDownChoice("String_Node_Str",bundles,renderer);
  bundle.setModel(new IModel(){
    public Object getObject(){
      return selectedBundleTO;
    }
    public void setObject(    Object object){
      selectedBundleTO=(ConnectorBundleTO)object;
    }
    public void detach(){
    }
  }
);
  bundle.add(new AjaxFormComponentUpdatingBehavior("String_Node_Str"){
    protected void onUpdate(    AjaxRequestTarget target){
      connectorTO.setConfiguration(new HashSet<PropertyTO>());
      target.addComponent(propertiesContainer);
      target.addComponent(connectorName);
      target.addComponent(version);
    }
  }
);
  bundle.setRequired(true);
  bundle.setEnabled(createFlag);
  ListView propertiesView=(new ListView("String_Node_Str",selectedBundleProperties){
    PropertyTO propertyTO;
    @Override protected void populateItem(    ListItem item){
      propertyTO=(PropertyTO)item.getDefaultModelObject();
      item.add(new Label("String_Node_Str",propertyTO.getKey()));
      item.add(new TextField("String_Node_Str",new PropertyModel(propertyTO,"String_Node_Str")));
      connectorTO.getConfiguration().add(propertyTO);
    }
  }
);
  propertiesContainer=new WebMarkupContainer("String_Node_Str");
  propertiesContainer.setOutputMarkupId(true);
  propertiesContainer.add(propertiesView);
  connectorForm.add(propertiesContainer);
  submit=new IndicatingAjaxButton("String_Node_Str",new Model(getString("String_Node_Str"))){
    @Override protected void onSubmit(    AjaxRequestTarget target,    Form form){
      ConnectorInstanceTO connector=(ConnectorInstanceTO)form.getDefaultModelObject();
      connector.setBundleName(bundle.getModelValue());
      connector.setCapabilities(getResourcesSet(selections));
      try {
        if (createFlag)         restClient.createConnector(connector);
 else         restClient.updateConnector(connector);
        Connectors callerPage=(Connectors)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"));
    }
  }
;
  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);
  connectorForm.add(new FeedbackPanel("String_Node_Str").setOutputMarkupId(true));
  connectorForm.add(connectorName);
  connectorForm.add(bundle);
  connectorForm.add(version);
  final IModel capabilities=new LoadableDetachableModel(){
    @Override protected Object 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):
/** 
 * @param basePage base
 * @param modalWindow modal window
 * @param connectorTO
 * @param create : set to true only if a CREATE operation is required
 */
public ConnectorsModalPage(final BasePage basePage,final ModalWindow window,final ConnectorInstanceTO connectorTO,final boolean createFlag){
  Form connectorForm=new Form("String_Node_Str");
  connectorForm.setModel(new CompoundPropertyModel(connectorTO));
  if (!createFlag)   setupSelections(connectorTO);
  IModel bundles=new LoadableDetachableModel(){
    protected Object load(){
      return restClient.getAllBundles();
    }
  }
;
  IModel selectedBundleProperties=new LoadableDetachableModel(){
    protected Object load(){
      List<PropertyTO> list;
      if (createFlag) {
        connectorTO.setConnectorName(selectedBundleTO.getConnectorName());
        connectorTO.setVersion(selectedBundleTO.getVersion());
        list=new ArrayList<PropertyTO>();
        PropertyTO propertyTO;
        for (        String key : selectedBundleTO.getProperties()) {
          propertyTO=new PropertyTO();
          propertyTO.setKey(key);
          list.add(propertyTO);
        }
      }
 else {
        selectedBundleTO.setBundleName(connectorTO.getBundleName());
        list=hashSetToList(connectorTO.getConfiguration());
      }
      return list;
    }
  }
;
  connectorName=new TextField("String_Node_Str");
  connectorName.setEnabled(false);
  connectorName.setOutputMarkupId(true);
  displayName=new TextField("String_Node_Str");
  displayName.setOutputMarkupId(true);
  version=new TextField("String_Node_Str");
  version.setEnabled(false);
  version.setOutputMarkupId(true);
  ChoiceRenderer renderer=new ChoiceRenderer("String_Node_Str","String_Node_Str");
  bundle=new DropDownChoice("String_Node_Str",bundles,renderer);
  bundle.setModel(new IModel(){
    public Object getObject(){
      return selectedBundleTO;
    }
    public void setObject(    Object object){
      selectedBundleTO=(ConnectorBundleTO)object;
    }
    public void detach(){
    }
  }
);
  bundle.add(new AjaxFormComponentUpdatingBehavior("String_Node_Str"){
    protected void onUpdate(    AjaxRequestTarget target){
      connectorTO.setConfiguration(new HashSet<PropertyTO>());
      target.addComponent(propertiesContainer);
      target.addComponent(connectorName);
      target.addComponent(version);
    }
  }
);
  bundle.setRequired(true);
  bundle.setEnabled(createFlag);
  ListView propertiesView=(new ListView("String_Node_Str",selectedBundleProperties){
    PropertyTO propertyTO;
    @Override protected void populateItem(    ListItem item){
      propertyTO=(PropertyTO)item.getDefaultModelObject();
      item.add(new Label("String_Node_Str",propertyTO.getKey()));
      item.add(new TextField("String_Node_Str",new PropertyModel(propertyTO,"String_Node_Str")));
      connectorTO.getConfiguration().add(propertyTO);
    }
  }
);
  propertiesContainer=new WebMarkupContainer("String_Node_Str");
  propertiesContainer.setOutputMarkupId(true);
  propertiesContainer.add(propertiesView);
  connectorForm.add(propertiesContainer);
  submit=new IndicatingAjaxButton("String_Node_Str",new Model(getString("String_Node_Str"))){
    @Override protected void onSubmit(    AjaxRequestTarget target,    Form form){
      ConnectorInstanceTO connector=(ConnectorInstanceTO)form.getDefaultModelObject();
      connector.setBundleName(bundle.getModelValue());
      connector.setCapabilities(getResourcesSet(selections));
      try {
        if (createFlag)         restClient.createConnector(connector);
 else         restClient.updateConnector(connector);
        Connectors callerPage=(Connectors)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"));
    }
  }
;
  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);
  connectorForm.add(new FeedbackPanel("String_Node_Str").setOutputMarkupId(true));
  connectorForm.add(connectorName);
  connectorForm.add(displayName);
  connectorForm.add(bundle);
  connectorForm.add(version);
  final IModel capabilities=new LoadableDetachableModel(){
    @Override protected Object 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);
}