Program: 60509
Project: 60509
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private FieldPanel getFieldPanel(final SchemaTO schemaTO,final Form form,final AttributeTO attributeTO){
  final boolean required=mode == Mode.TEMPLATE ? false : schemaTO.getMandatoryCondition().equalsIgnoreCase("String_Node_Str");
  final boolean readOnly=mode == Mode.TEMPLATE ? false : schemaTO.isReadonly();
  final AttributeSchemaType type=mode == Mode.TEMPLATE ? AttributeSchemaType.String : schemaTO.getType();
  final FieldPanel panel;
switch (type) {
case Boolean:
    panel=new AjaxCheckBoxPanel("String_Node_Str",schemaTO.getName(),new Model<Boolean>());
  panel.setRequired(required);
break;
case Date:
final String dataPattern=schemaTO.getConversionPattern() == null ? SyncopeConstants.DEFAULT_DATE_PATTERN : schemaTO.getConversionPattern();
if (dataPattern.contains("String_Node_Str")) {
panel=new DateTimeFieldPanel("String_Node_Str",schemaTO.getName(),new Model<Date>(),dataPattern);
if (required) {
panel.addRequiredLabel();
((DateTimeFieldPanel)panel).setFormValidator(form);
}
panel.setStyleSheet("String_Node_Str");
}
 else {
panel=new DateTextFieldPanel("String_Node_Str",schemaTO.getName(),new Model<Date>(),dataPattern);
if (required) {
panel.addRequiredLabel();
}
}
break;
case Enum:
panel=new AjaxDropDownChoicePanel<String>("String_Node_Str",schemaTO.getName(),new Model<String>());
((AjaxDropDownChoicePanel<String>)panel).setChoices(getEnumeratedValues(schemaTO));
if (StringUtils.isNotBlank(schemaTO.getEnumerationKeys())) {
((AjaxDropDownChoicePanel)panel).setChoiceRenderer(new IChoiceRenderer<String>(){
private static final long serialVersionUID=-3724971416312135885L;
private final Map<String,String> valueMap=getEnumeratedKeyValues(schemaTO);
@Override public String getDisplayValue(final String value){
return valueMap.get(value) == null ? value : valueMap.get(value);
}
@Override public String getIdValue(final String value,final int i){
return value;
}
}
);
}
if (required) {
panel.addRequiredLabel();
}
break;
case Long:
panel=new SpinnerFieldPanel<Long>("String_Node_Str",schemaTO.getName(),Long.class,new Model<Long>(),null,null);
if (required) {
panel.addRequiredLabel();
}
break;
case Double:
panel=new SpinnerFieldPanel<Double>("String_Node_Str",schemaTO.getName(),Double.class,new Model<Double>(),null,null);
if (required) {
panel.addRequiredLabel();
}
break;
case Binary:
panel=new BinaryFieldPanel("String_Node_Str",schemaTO.getName(),new Model<String>(),schemas.containsKey(schemaTO.getName()) ? schemas.get(schemaTO.getName()).getMimeType() : null);
if (required) {
panel.addRequiredLabel();
}
break;
default :
panel=new AjaxTextFieldPanel("String_Node_Str",schemaTO.getName(),new Model<String>());
if (required) {
panel.addRequiredLabel();
}
}
panel.setReadOnly(readOnly);
panel.setNewModel(attributeTO.getValues());
return panel;
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private FieldPanel getFieldPanel(final SchemaTO schemaTO,final Form form,final AttributeTO attributeTO){
  final boolean required=mode == Mode.TEMPLATE ? false : schemaTO.getMandatoryCondition().equalsIgnoreCase("String_Node_Str");
  final boolean readOnly=mode == Mode.TEMPLATE ? false : schemaTO.isReadonly();
  final AttributeSchemaType type=mode == Mode.TEMPLATE ? AttributeSchemaType.String : schemaTO.getType();
  final FieldPanel panel;
switch (type) {
case Boolean:
    panel=new AjaxCheckBoxPanel("String_Node_Str",schemaTO.getName(),new Model<Boolean>());
  panel.setRequired(required);
break;
case Date:
final String dataPattern=schemaTO.getConversionPattern() == null ? SyncopeConstants.DEFAULT_DATE_PATTERN : schemaTO.getConversionPattern();
if (dataPattern.contains("String_Node_Str")) {
panel=new DateTimeFieldPanel("String_Node_Str",schemaTO.getName(),new Model<Date>(),dataPattern);
if (required) {
panel.addRequiredLabel();
((DateTimeFieldPanel)panel).setFormValidator(form);
}
panel.setStyleSheet("String_Node_Str");
}
 else {
panel=new DateTextFieldPanel("String_Node_Str",schemaTO.getName(),new Model<Date>(),dataPattern);
if (required) {
panel.addRequiredLabel();
}
}
break;
case Enum:
panel=new AjaxDropDownChoicePanel<String>("String_Node_Str",schemaTO.getName(),new Model<String>());
((AjaxDropDownChoicePanel<String>)panel).setChoices(getEnumeratedValues(schemaTO));
if (StringUtils.isNotBlank(schemaTO.getEnumerationKeys())) {
((AjaxDropDownChoicePanel)panel).setChoiceRenderer(new IChoiceRenderer<String>(){
private static final long serialVersionUID=-3724971416312135885L;
private final Map<String,String> valueMap=getEnumeratedKeyValues(schemaTO);
@Override public String getDisplayValue(final String value){
return valueMap.get(value) == null ? value : valueMap.get(value);
}
@Override public String getIdValue(final String value,final int i){
return value;
}
}
);
}
if (required) {
panel.addRequiredLabel();
}
break;
case Long:
panel=new SpinnerFieldPanel<Long>("String_Node_Str",schemaTO.getName(),Long.class,new Model<Long>(),null,null);
if (required) {
panel.addRequiredLabel();
}
break;
case Double:
panel=new AjaxDoubleFieldPanel("String_Node_Str",schemaTO.getName(),schemaTO.getConversionPattern(),new Model<Double>());
if (required) {
panel.addRequiredLabel();
}
break;
case Binary:
panel=new BinaryFieldPanel("String_Node_Str",schemaTO.getName(),new Model<String>(),schemas.containsKey(schemaTO.getName()) ? schemas.get(schemaTO.getName()).getMimeType() : null);
if (required) {
panel.addRequiredLabel();
}
break;
default :
panel=new AjaxTextFieldPanel("String_Node_Str",schemaTO.getName(),new Model<String>());
if (required) {
panel.addRequiredLabel();
}
}
panel.setReadOnly(readOnly);
panel.setNewModel(attributeTO.getValues());
return panel;
}