Program: 35465
Project: 35465
Buggy source:
private void refreshCard(){
  final ContactModelDTO contactModelDTO=contactDTO.getContactModel();
  view.prepareContainers();
  TreeSet<LayoutConstraintDTO> constraints=new TreeSet<LayoutConstraintDTO>(new Comparator<LayoutConstraintDTO>(){
    @Override public int compare(    LayoutConstraintDTO constraint1,    LayoutConstraintDTO constraint2){
      if (constraint1.getSortOrder() == constraint2.getSortOrder()) {
        return constraint1.getFlexibleElementDTO().getId().compareTo(constraint2.getFlexibleElementDTO().getId());
      }
      return constraint1.getSortOrder() - constraint2.getSortOrder();
    }
  }
);
  for (  LayoutGroupDTO layoutGroup : contactModelDTO.getCard().getLayout().getGroups()) {
    for (    LayoutConstraintDTO constraint : layoutGroup.getConstraints()) {
      constraints.add(constraint);
    }
  }
  boolean hasPhoto=false;
  for (  LayoutConstraintDTO constraint : constraints) {
    DefaultContactFlexibleElementDTO flexibleElementDTO=(DefaultContactFlexibleElementDTO)constraint.getFlexibleElementDTO();
    if (!flexibleElementDTO.getType().isVisibleForType(contactModelDTO.getType())) {
      continue;
    }
switch (flexibleElementDTO.getType()) {
case PHOTO:
      if (contactDTO.getPhoto() == null) {
        break;
      }
    hasPhoto=true;
  imageProvider.provideDataUrl(contactDTO.getPhoto(),new AsyncCallback<String>(){
    @Override public void onFailure(    Throwable caught){
      view.setDefaultAvatar(contactModelDTO.getType());
    }
    @Override public void onSuccess(    String dataUrl){
      view.setAvatarUrl(dataUrl);
    }
  }
);
break;
case COUNTRY:
if (contactDTO.getCountry() == null) {
break;
}
view.addLabel(contactDTO.getCountry().getName());
break;
case CREATION_DATE:
if (contactDTO.getDateCreated() == null) {
break;
}
String date=DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM).format(contactDTO.getDateCreated());
view.addLabel(date);
break;
case DIRECT_MEMBERSHIP:
if (contactDTO.getParent() == null) {
break;
}
view.addLabel(contactDTO.getParent().getName());
break;
case EMAIL_ADDRESS:
view.addLabel(contactDTO.getEmail());
break;
case FAMILY_NAME:
view.addLabel(contactDTO.getName());
break;
case FIRST_NAME:
view.addLabel(contactDTO.getFirstname());
break;
case LOGIN:
view.addLabel(contactDTO.getLogin());
break;
case MAIN_ORG_UNIT:
if (contactDTO.getMainOrgUnit() == null) {
break;
}
view.addLabel(contactDTO.getMainOrgUnit().getName());
break;
case ORGANIZATION_NAME:
view.addLabel(contactDTO.getName());
break;
case PHONE_NUMBER:
view.addLabel(contactDTO.getPhoneNumber());
break;
case POSTAL_ADDRESS:
view.addLabel(contactDTO.getPostalAddress());
break;
case SECONDARY_ORG_UNITS:
for (OrgUnitDTO secondaryOrgUnit : contactDTO.getSecondaryOrgUnits()) {
view.addLabel(secondaryOrgUnit.getName());
}
break;
case TOP_MEMBERSHIP:
if (contactDTO.getRoot() == null) {
break;
}
view.addLabel(contactDTO.getRoot().getName());
break;
default :
throw new IllegalStateException("String_Node_Str" + flexibleElementDTO.getType());
}
}
if (!hasPhoto) {
view.setDefaultAvatar(contactModelDTO.getType());
}
}

Fixed version (ground truth):
private void refreshCard(){
  final ContactModelDTO contactModelDTO=contactDTO.getContactModel();
  view.prepareContainers();
  TreeSet<LayoutConstraintDTO> constraints=new TreeSet<LayoutConstraintDTO>(new Comparator<LayoutConstraintDTO>(){
    @Override public int compare(    LayoutConstraintDTO constraint1,    LayoutConstraintDTO constraint2){
      if (constraint1.getSortOrder() == constraint2.getSortOrder()) {
        return constraint1.getFlexibleElementDTO().getId().compareTo(constraint2.getFlexibleElementDTO().getId());
      }
      return constraint1.getSortOrder() - constraint2.getSortOrder();
    }
  }
);
  for (  LayoutGroupDTO layoutGroup : contactModelDTO.getCard().getLayout().getGroups()) {
    for (    LayoutConstraintDTO constraint : layoutGroup.getConstraints()) {
      constraints.add(constraint);
    }
  }
  boolean hasPhoto=false;
  for (  LayoutConstraintDTO constraint : constraints) {
    DefaultContactFlexibleElementDTO flexibleElementDTO=(DefaultContactFlexibleElementDTO)constraint.getFlexibleElementDTO();
    if (!flexibleElementDTO.getType().isVisibleForType(contactModelDTO.getType())) {
      continue;
    }
switch (flexibleElementDTO.getType()) {
case PHOTO:
      if (contactDTO.getPhoto() == null) {
        break;
      }
    hasPhoto=true;
  imageProvider.provideDataUrl(contactDTO.getPhoto(),new AsyncCallback<String>(){
    @Override public void onFailure(    Throwable caught){
      view.setDefaultAvatar(contactModelDTO.getType());
    }
    @Override public void onSuccess(    String dataUrl){
      view.setAvatarUrl(dataUrl);
    }
  }
);
break;
case COUNTRY:
if (contactDTO.getCountry() == null) {
break;
}
view.addLabel(contactDTO.getCountry().getName());
break;
case CREATION_DATE:
if (contactDTO.getDateCreated() == null) {
break;
}
String date=DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM).format(contactDTO.getDateCreated());
view.addLabel(date);
break;
case DIRECT_MEMBERSHIP:
if (contactDTO.getParent() == null) {
break;
}
view.addLabel(contactDTO.getParent().getName());
break;
case EMAIL_ADDRESS:
view.addLabel(contactDTO.getEmail());
break;
case FAMILY_NAME:
view.addNameLabel(contactDTO.getName());
break;
case FIRST_NAME:
view.addNameLabel(contactDTO.getFirstname());
break;
case LOGIN:
view.addLabel(contactDTO.getLogin());
break;
case MAIN_ORG_UNIT:
if (contactDTO.getMainOrgUnit() == null) {
break;
}
view.addLabel(contactDTO.getMainOrgUnit().getName());
break;
case ORGANIZATION_NAME:
view.addNameLabel(contactDTO.getName());
break;
case PHONE_NUMBER:
view.addLabel(contactDTO.getPhoneNumber());
break;
case POSTAL_ADDRESS:
view.addLabel(contactDTO.getPostalAddress());
break;
case SECONDARY_ORG_UNITS:
for (OrgUnitDTO secondaryOrgUnit : contactDTO.getSecondaryOrgUnits()) {
view.addLabel(secondaryOrgUnit.getName());
}
break;
case TOP_MEMBERSHIP:
if (contactDTO.getRoot() == null) {
break;
}
view.addOrganizationLabel(contactDTO.getRoot().getName());
break;
default :
throw new IllegalStateException("String_Node_Str" + flexibleElementDTO.getType());
}
}
if (!hasPhoto) {
view.setDefaultAvatar(contactModelDTO.getType());
}
}