Program: 60858
Project: 60858
Buggy source:
@Override public void setSchemaModalPage(final PageReference callerPageRef,final ModalWindow window,AbstractBaseBean schemaTO,final boolean createFlag){
  final SchemaTO schema=schemaTO == null ? new SchemaTO() : (SchemaTO)schemaTO;
  final Form schemaForm=new Form("String_Node_Str");
  schemaForm.setModel(new CompoundPropertyModel(schema));
  schemaForm.setOutputMarkupId(Boolean.TRUE);
  final AjaxTextFieldPanel name=new AjaxTextFieldPanel("String_Node_Str",getString("String_Node_Str"),new PropertyModel<String>(schema,"String_Node_Str"),true);
  name.addRequiredLabel();
  name.setEnabled(createFlag);
  final AjaxTextFieldPanel conversionPattern=new AjaxTextFieldPanel("String_Node_Str",getString("String_Node_Str"),new PropertyModel<String>(schema,"String_Node_Str"),true);
  final IModel<List<String>> validatorsList=new LoadableDetachableModel<List<String>>(){
    private static final long serialVersionUID=5275935387613157437L;
    @Override protected List<String> load(){
      return restClient.getAllValidatorClasses();
    }
  }
;
  final AjaxDropDownChoicePanel<String> validatorClass=new AjaxDropDownChoicePanel<String>("String_Node_Str",getString("String_Node_Str"),new PropertyModel(schema,"String_Node_Str"),true);
  ((DropDownChoice)validatorClass.getField()).setNullValid(true);
  validatorClass.setChoices(validatorsList.getObject());
  final AjaxDropDownChoicePanel<SchemaType> type=new AjaxDropDownChoicePanel<SchemaType>("String_Node_Str",getString("String_Node_Str"),new PropertyModel(schema,"String_Node_Str"),false);
  type.setChoices(Arrays.asList(SchemaType.values()));
  type.addRequiredLabel();
  final AjaxTextFieldPanel enumerationValues=new AjaxTextFieldPanel("String_Node_Str",getString("String_Node_Str"),new PropertyModel<String>(schema,"String_Node_Str"),false);
  if (schema != null && SchemaType.Enum.equals(((SchemaTO)schema).getType())) {
    enumerationValues.addRequiredLabel();
    enumerationValues.setEnabled(Boolean.TRUE);
  }
 else {
    enumerationValues.removeRequiredLabel();
    enumerationValues.setEnabled(Boolean.FALSE);
  }
  type.getField().add(new AjaxFormComponentUpdatingBehavior("String_Node_Str"){
    private static final long serialVersionUID=-1107858522700306810L;
    @Override protected void onUpdate(    final AjaxRequestTarget target){
      if (SchemaType.Enum.ordinal() == Integer.parseInt(type.getField().getValue())) {
        enumerationValues.addRequiredLabel();
        enumerationValues.setEnabled(Boolean.TRUE);
        enumerationValues.setModelObject(((SchemaTO)schema).getEnumerationValues());
      }
 else {
        enumerationValues.removeRequiredLabel();
        enumerationValues.setEnabled(Boolean.FALSE);
        enumerationValues.setModelObject(null);
      }
      target.add(schemaForm);
    }
  }
);
  final AutoCompleteTextField mandatoryCondition=new AutoCompleteTextField("String_Node_Str"){
    private static final long serialVersionUID=-2428903969518079100L;
    @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();
    }
  }
;
  mandatoryCondition.add(new AjaxFormComponentUpdatingBehavior("String_Node_Str"){
    private static final long serialVersionUID=-1107858522700306810L;
    @Override protected void onUpdate(    AjaxRequestTarget art){
    }
  }
);
  final AjaxCheckBoxPanel multivalue=new AjaxCheckBoxPanel("String_Node_Str",getString("String_Node_Str"),new PropertyModel<Boolean>(schema,"String_Node_Str"),true);
  final AjaxCheckBoxPanel readonly=new AjaxCheckBoxPanel("String_Node_Str",getString("String_Node_Str"),new PropertyModel<Boolean>(schema,"String_Node_Str"),true);
  final AjaxCheckBoxPanel uniqueConstraint=new AjaxCheckBoxPanel("String_Node_Str",getString("String_Node_Str"),new PropertyModel<Boolean>(schema,"String_Node_Str"),true);
  final AjaxButton submit=new IndicatingAjaxButton("String_Node_Str",new ResourceModel("String_Node_Str")){
    private static final long serialVersionUID=-958724007591692537L;
    @Override protected void onSubmit(    final AjaxRequestTarget target,    final Form form){
      SchemaTO schemaTO=(SchemaTO)form.getDefaultModelObject();
      if (schemaTO.isMultivalue() && schemaTO.isUniqueConstraint()) {
        error(getString("String_Node_Str"));
        return;
      }
      if (createFlag) {
        restClient.createSchema(kind,schemaTO);
      }
 else {
        restClient.updateSchema(kind,schemaTO);
      }
      Schema callerPage=(Schema)callerPageRef.getPage();
      callerPage.setModalResult(true);
      window.close(target);
    }
    @Override protected void onError(    final AjaxRequestTarget target,    final Form form){
      target.add(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);
  schemaForm.add(name);
  schemaForm.add(conversionPattern);
  schemaForm.add(validatorClass);
  schemaForm.add(type);
  schemaForm.add(enumerationValues);
  schemaForm.add(mandatoryCondition);
  schemaForm.add(multivalue);
  schemaForm.add(readonly);
  schemaForm.add(uniqueConstraint);
  schemaForm.add(submit);
  add(schemaForm);
}

Fixed version (ground truth):
@Override public void setSchemaModalPage(final PageReference callerPageRef,final ModalWindow window,AbstractBaseBean schemaTO,final boolean createFlag){
  final SchemaTO schema=schemaTO == null ? new SchemaTO() : (SchemaTO)schemaTO;
  final Form schemaForm=new Form("String_Node_Str");
  schemaForm.setModel(new CompoundPropertyModel(schema));
  schemaForm.setOutputMarkupId(Boolean.TRUE);
  final AjaxTextFieldPanel name=new AjaxTextFieldPanel("String_Node_Str",getString("String_Node_Str"),new PropertyModel<String>(schema,"String_Node_Str"),true);
  name.addRequiredLabel();
  name.setEnabled(createFlag);
  final AjaxTextFieldPanel conversionPattern=new AjaxTextFieldPanel("String_Node_Str",getString("String_Node_Str"),new PropertyModel<String>(schema,"String_Node_Str"),true);
  final IModel<List<String>> validatorsList=new LoadableDetachableModel<List<String>>(){
    private static final long serialVersionUID=5275935387613157437L;
    @Override protected List<String> load(){
      return restClient.getAllValidatorClasses();
    }
  }
;
  final AjaxDropDownChoicePanel<String> validatorClass=new AjaxDropDownChoicePanel<String>("String_Node_Str",getString("String_Node_Str"),new PropertyModel(schema,"String_Node_Str"),true);
  ((DropDownChoice)validatorClass.getField()).setNullValid(true);
  validatorClass.setChoices(validatorsList.getObject());
  final AjaxDropDownChoicePanel<SchemaType> type=new AjaxDropDownChoicePanel<SchemaType>("String_Node_Str",getString("String_Node_Str"),new PropertyModel(schema,"String_Node_Str"),false);
  type.setChoices(Arrays.asList(SchemaType.values()));
  type.addRequiredLabel();
  final AjaxTextFieldPanel enumerationValues=new AjaxTextFieldPanel("String_Node_Str",getString("String_Node_Str"),new PropertyModel<String>(schema,"String_Node_Str"),false);
  if (schema != null && SchemaType.Enum.equals(((SchemaTO)schema).getType())) {
    enumerationValues.addRequiredLabel();
    enumerationValues.setEnabled(Boolean.TRUE);
  }
 else {
    enumerationValues.removeRequiredLabel();
    enumerationValues.setEnabled(Boolean.FALSE);
  }
  type.getField().add(new AjaxFormComponentUpdatingBehavior("String_Node_Str"){
    private static final long serialVersionUID=-1107858522700306810L;
    @Override protected void onUpdate(    final AjaxRequestTarget target){
      if (SchemaType.Enum.ordinal() == Integer.parseInt(type.getField().getValue())) {
        enumerationValues.addRequiredLabel();
        enumerationValues.setEnabled(Boolean.TRUE);
        enumerationValues.setModelObject(((SchemaTO)schema).getEnumerationValues());
      }
 else {
        enumerationValues.removeRequiredLabel();
        enumerationValues.setEnabled(Boolean.FALSE);
        enumerationValues.setModelObject(null);
      }
      target.add(schemaForm);
    }
  }
);
  final AutoCompleteTextField mandatoryCondition=new AutoCompleteTextField("String_Node_Str"){
    private static final long serialVersionUID=-2428903969518079100L;
    @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();
    }
  }
;
  mandatoryCondition.add(new AjaxFormComponentUpdatingBehavior("String_Node_Str"){
    private static final long serialVersionUID=-1107858522700306810L;
    @Override protected void onUpdate(    AjaxRequestTarget art){
    }
  }
);
  final AjaxCheckBoxPanel multivalue=new AjaxCheckBoxPanel("String_Node_Str",getString("String_Node_Str"),new PropertyModel<Boolean>(schema,"String_Node_Str"),true);
  final AjaxCheckBoxPanel readonly=new AjaxCheckBoxPanel("String_Node_Str",getString("String_Node_Str"),new PropertyModel<Boolean>(schema,"String_Node_Str"),true);
  final AjaxCheckBoxPanel uniqueConstraint=new AjaxCheckBoxPanel("String_Node_Str",getString("String_Node_Str"),new PropertyModel<Boolean>(schema,"String_Node_Str"),true);
  final AjaxButton submit=new IndicatingAjaxButton("String_Node_Str",new ResourceModel("String_Node_Str")){
    private static final long serialVersionUID=-958724007591692537L;
    @Override protected void onSubmit(    final AjaxRequestTarget target,    final Form form){
      SchemaTO schemaTO=(SchemaTO)form.getDefaultModelObject();
      if (schemaTO.isMultivalue() && schemaTO.isUniqueConstraint()) {
        error(getString("String_Node_Str"));
        return;
      }
      try {
        if (createFlag) {
          restClient.createSchema(kind,schemaTO);
        }
 else {
          restClient.updateSchema(kind,schemaTO);
        }
        if (callerPageRef.getPage() instanceof BasePage) {
          ((BasePage)callerPageRef.getPage()).setModalResult(true);
        }
        window.close(target);
      }
 catch (      SyncopeClientCompositeErrorException e) {
        error(getString("String_Node_Str") + "String_Node_Str" + e.getMessage());
        target.add(feedbackPanel);
      }
    }
    @Override protected void onError(    final AjaxRequestTarget target,    final Form form){
      target.add(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);
  schemaForm.add(name);
  schemaForm.add(conversionPattern);
  schemaForm.add(validatorClass);
  schemaForm.add(type);
  schemaForm.add(enumerationValues);
  schemaForm.add(mandatoryCondition);
  schemaForm.add(multivalue);
  schemaForm.add(readonly);
  schemaForm.add(uniqueConstraint);
  schemaForm.add(submit);
  add(schemaForm);
}