Program: 60670
Project: 60670
Buggy source:
public <T extends AbstractAttributableTO>UserDetailsPanel(final String id,final UserTO userTO,final Form form,final boolean resetPassword,final boolean templateMode){
  super(id);
  final FieldPanel username=new AjaxTextFieldPanel("String_Node_Str","String_Node_Str",new PropertyModel<String>(userTO,"String_Node_Str"),true);
  if (!templateMode) {
    username.addRequiredLabel();
  }
  add(username);
  final FieldPanel password;
  final Label confirmPasswordLabel=new Label("String_Node_Str",new ResourceModel("String_Node_Str"));
  final FieldPanel confirmPassword;
  if (templateMode) {
    password=new AjaxTextFieldPanel("String_Node_Str","String_Node_Str",new PropertyModel<String>(userTO,"String_Node_Str"),true);
    confirmPasswordLabel.setVisible(false);
    confirmPassword=new AjaxTextFieldPanel("String_Node_Str","String_Node_Str",new Model<String>(),false);
    confirmPassword.setEnabled(false);
    confirmPassword.setVisible(false);
  }
 else {
    password=new AjaxPasswordFieldPanel("String_Node_Str","String_Node_Str",new PropertyModel<String>(userTO,"String_Node_Str"),true);
    password.setRequired(userTO.getId() == 0);
    ((PasswordTextField)password.getField()).setResetPassword(resetPassword);
    confirmPassword=new AjaxPasswordFieldPanel("String_Node_Str","String_Node_Str",new Model<String>(),true);
    if (!resetPassword) {
      confirmPassword.getField().setModelObject(userTO.getPassword());
    }
    confirmPassword.setRequired(userTO.getId() == 0);
    ((PasswordTextField)confirmPassword.getField()).setResetPassword(resetPassword);
    form.add(new EqualPasswordInputValidator(password.getField(),confirmPassword.getField()));
  }
  add(password);
  add(confirmPasswordLabel);
  add(confirmPassword);
  final WebMarkupContainer mandatoryPassword=new WebMarkupContainer("String_Node_Str");
  mandatoryPassword.add(new Behavior(){
    private static final long serialVersionUID=1469628524240283489L;
    @Override public void onComponentTag(    final Component component,    final ComponentTag tag){
      if (userTO.getId() > 0) {
        tag.put("String_Node_Str","String_Node_Str");
      }
    }
  }
);
  add(mandatoryPassword);
  final AjaxTextFieldPanel status=new AjaxTextFieldPanel("String_Node_Str","String_Node_Str",new Model<String>(userTO.getStatus()),false);
  status.setReadOnly(true);
  add(status);
  final DateTimeFieldPanel creationDate=new DateTimeFieldPanel("String_Node_Str","String_Node_Str",new Model<Date>(userTO.getCreationDate()),false,SyncopeSession.get().getDateFormat().toLocalizedPattern());
  creationDate.setReadOnly(true);
  add(creationDate);
  final DateTimeFieldPanel changePwdDate=new DateTimeFieldPanel("String_Node_Str","String_Node_Str",new Model<Date>(userTO.getChangePwdDate()),false,SyncopeSession.get().getDateFormat().toLocalizedPattern());
  changePwdDate.setReadOnly(true);
  add(changePwdDate);
  final DateTimeFieldPanel lastLoginDate=new DateTimeFieldPanel("String_Node_Str","String_Node_Str",new Model<Date>(userTO.getLastLoginDate()),false,SyncopeSession.get().getDateFormat().toLocalizedPattern());
  lastLoginDate.setReadOnly(true);
  add(lastLoginDate);
  final AjaxNumberFieldPanel failedLogins=new AjaxNumberFieldPanel("String_Node_Str","String_Node_Str",new Model<Number>(userTO.getFailedLogins()),false);
  failedLogins.setReadOnly(true);
  add(failedLogins);
  final AjaxTextFieldPanel token=new AjaxTextFieldPanel("String_Node_Str","String_Node_Str",new Model<String>(userTO.getToken()),false);
  token.setReadOnly(true);
  add(token);
  final DateTimeFieldPanel tokenExpireTime=new DateTimeFieldPanel("String_Node_Str","String_Node_Str",new Model<Date>(userTO.getTokenExpireTime()),false,SyncopeSession.get().getDateFormat().toLocalizedPattern());
  tokenExpireTime.setReadOnly(true);
  add(tokenExpireTime);
}

Fixed version (ground truth):
public <T extends AbstractAttributableTO>UserDetailsPanel(final String id,final UserTO userTO,final Form form,final boolean resetPassword,final boolean templateMode){
  super(id);
  final FieldPanel username=new AjaxTextFieldPanel("String_Node_Str","String_Node_Str",new PropertyModel<String>(userTO,"String_Node_Str"),true);
  if (!templateMode) {
    username.addRequiredLabel();
  }
  add(username);
  final FieldPanel password;
  final Label confirmPasswordLabel=new Label("String_Node_Str",new ResourceModel("String_Node_Str"));
  final FieldPanel confirmPassword;
  if (templateMode) {
    password=new AjaxTextFieldPanel("String_Node_Str","String_Node_Str",new PropertyModel<String>(userTO,"String_Node_Str"),true);
    confirmPasswordLabel.setVisible(false);
    confirmPassword=new AjaxTextFieldPanel("String_Node_Str","String_Node_Str",new Model<String>(),false);
    confirmPassword.setEnabled(false);
    confirmPassword.setVisible(false);
  }
 else {
    password=new AjaxPasswordFieldPanel("String_Node_Str","String_Node_Str",new PropertyModel<String>(userTO,"String_Node_Str"),true);
    password.setRequired(userTO.getId() == 0);
    ((PasswordTextField)password.getField()).setResetPassword(resetPassword);
    confirmPassword=new AjaxPasswordFieldPanel("String_Node_Str","String_Node_Str",new Model<String>(),true);
    if (!resetPassword) {
      confirmPassword.getField().setModelObject(userTO.getPassword());
    }
    confirmPassword.setRequired(userTO.getId() == 0);
    ((PasswordTextField)confirmPassword.getField()).setResetPassword(resetPassword);
    form.add(new EqualPasswordInputValidator(password.getField(),confirmPassword.getField()));
  }
  add(password);
  add(confirmPasswordLabel);
  add(confirmPassword);
  final WebMarkupContainer mandatoryPassword=new WebMarkupContainer("String_Node_Str");
  mandatoryPassword.add(new Behavior(){
    private static final long serialVersionUID=1469628524240283489L;
    @Override public void onComponentTag(    final Component component,    final ComponentTag tag){
      if (userTO.getId() > 0) {
        tag.put("String_Node_Str","String_Node_Str");
      }
    }
  }
);
  add(mandatoryPassword);
  final AjaxTextFieldPanel status=new AjaxTextFieldPanel("String_Node_Str","String_Node_Str",new Model<String>(userTO.getStatus()),false);
  status.setReadOnly(true);
  add(status);
  final DateTimeFieldPanel creationDate=new DateTimeFieldPanel("String_Node_Str","String_Node_Str",new Model<Date>(userTO.getCreationDate()),false,SyncopeSession.get().getDateFormat().toLocalizedPattern());
  creationDate.setReadOnly(true);
  add(creationDate);
  final DateTimeFieldPanel changePwdDate=new DateTimeFieldPanel("String_Node_Str","String_Node_Str",new Model<Date>(userTO.getChangePwdDate()),false,SyncopeSession.get().getDateFormat().toLocalizedPattern());
  changePwdDate.setReadOnly(true);
  add(changePwdDate);
  final DateTimeFieldPanel lastLoginDate=new DateTimeFieldPanel("String_Node_Str","String_Node_Str",new Model<Date>(userTO.getLastLoginDate()),false,SyncopeSession.get().getDateFormat().toLocalizedPattern());
  lastLoginDate.setReadOnly(true);
  add(lastLoginDate);
  final AjaxNumberFieldPanel failedLogins=new AjaxNumberFieldPanel("String_Node_Str","String_Node_Str",new Model<Number>(userTO.getFailedLogins()),Integer.class,false);
  failedLogins.setReadOnly(true);
  add(failedLogins);
  final AjaxTextFieldPanel token=new AjaxTextFieldPanel("String_Node_Str","String_Node_Str",new Model<String>(userTO.getToken()),false);
  token.setReadOnly(true);
  add(token);
  final DateTimeFieldPanel tokenExpireTime=new DateTimeFieldPanel("String_Node_Str","String_Node_Str",new Model<Date>(userTO.getTokenExpireTime()),false,SyncopeSession.get().getDateFormat().toLocalizedPattern());
  tokenExpireTime.setReadOnly(true);
  add(tokenExpireTime);
}