Program: 188929
Project: 188929
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override @Put public Representation put(Representation entity){
  Representation representation=null;
  try {
    JaxbObject<Study> jo=new JaxbObject<Study>();
    String text=entity.getText();
    Study p=null;
    try {
      p=(Study)XmlTools.unMarshal(jo,new Study(),text);
    }
 catch (    SAXException ex) {
      throw new ResourceException(Status.CLIENT_ERROR_UNPROCESSABLE_ENTITY,ex);
    }
    if (p.getOwner() == null) {
      p.setOwner(registration);
    }
    StudyService service=BeanFactory.getStudyServiceBean();
    Study study=(Study)testIfNull(service.findByID(p.getStudyId()));
    if (null != p.getStudyAttributes()) {
      study.getStudyAttributes().clear();
      for (      StudyAttribute sa : p.getStudyAttributes()) {
        sa.setStudy(study);
        study.getStudyAttributes().add(sa);
      }
    }
    String title=p.getTitle();
    String description=p.getDescription();
    String alias=p.getAlias();
    String accession=p.getAccession();
    String status=p.getStatus();
    String abstractStr=p.getAbstractStr();
    String newType=p.getNewType();
    String centerName=p.getCenterName();
    String centerProjectName=p.getCenterProjectName();
    Integer projectId=p.getProjectId();
    Boolean isSelected=p.getIsSelected();
    Boolean isHasFile=p.getIsHasFile();
    String html=p.getHtml();
    Integer existingTypeInt=p.getExistingTypeInt();
    if (null != title) {
      study.setTitle(title);
    }
    if (null != description) {
      study.setDescription(description);
    }
    if (null != alias) {
      study.setAlias(alias);
    }
    if (null != accession) {
      study.setAccession(accession);
    }
    if (null != status) {
      study.setStatus(status);
    }
    if (null != abstractStr) {
      study.setAbstractStr(abstractStr);
    }
    if (null != newType) {
      study.setNewType(newType);
    }
    if (null != centerName) {
      study.setCenterName(centerName);
    }
    if (null != centerProjectName) {
      study.setCenterProjectName(centerProjectName);
    }
    if (null != projectId) {
      study.setProjectId(projectId);
    }
    if (null != isSelected) {
      study.setIsSelected(isSelected);
    }
    if (null != isHasFile) {
      study.setIsHasFile(isHasFile);
    }
    if (null != html) {
      study.setHtml(html);
    }
    if (null != existingTypeInt) {
      study.setExistingTypeInt(existingTypeInt);
    }
    service.update(study);
    Hibernate3DtoCopier copier=new Hibernate3DtoCopier();
    Study detachedStudy=copier.hibernate2dto(Study.class,study);
    Document line=XmlTools.marshalToDocument(jo,detachedStudy);
    representation=XmlTools.getRepresentation(line);
    getResponse().setEntity(representation);
    getResponse().setLocationRef(getRequest().getRootRef() + "String_Node_Str" + detachedStudy.getSwAccession());
    getResponse().setStatus(Status.SUCCESS_CREATED);
  }
 catch (  SecurityException e) {
    getResponse().setStatus(Status.CLIENT_ERROR_FORBIDDEN,e);
  }
catch (  Exception e) {
    e.printStackTrace();
    getResponse().setStatus(Status.SERVER_ERROR_INTERNAL,e);
  }
  return representation;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override @Put public Representation put(Representation entity){
  Representation representation=null;
  try {
    JaxbObject<Study> jo=new JaxbObject<Study>();
    String text=entity.getText();
    Study p=null;
    try {
      p=(Study)XmlTools.unMarshal(jo,new Study(),text);
    }
 catch (    SAXException ex) {
      throw new ResourceException(Status.CLIENT_ERROR_UNPROCESSABLE_ENTITY,ex);
    }
    if (p.getOwner() == null) {
      p.setOwner(registration);
    }
    StudyService service=BeanFactory.getStudyServiceBean();
    Study study=(Study)testIfNull(service.findByID(p.getStudyId()));
    if (null != p.getStudyAttributes()) {
      for (      StudyAttribute sa : p.getStudyAttributes()) {
        sa.setStudy(study);
        study.getStudyAttributes().add(sa);
      }
    }
    String title=p.getTitle();
    String description=p.getDescription();
    String alias=p.getAlias();
    String accession=p.getAccession();
    String status=p.getStatus();
    String abstractStr=p.getAbstractStr();
    String newType=p.getNewType();
    String centerName=p.getCenterName();
    String centerProjectName=p.getCenterProjectName();
    Integer projectId=p.getProjectId();
    Boolean isSelected=p.getIsSelected();
    Boolean isHasFile=p.getIsHasFile();
    String html=p.getHtml();
    Integer existingTypeInt=p.getExistingTypeInt();
    if (null != title) {
      study.setTitle(title);
    }
    if (null != description) {
      study.setDescription(description);
    }
    if (null != alias) {
      study.setAlias(alias);
    }
    if (null != accession) {
      study.setAccession(accession);
    }
    if (null != status) {
      study.setStatus(status);
    }
    if (null != abstractStr) {
      study.setAbstractStr(abstractStr);
    }
    if (null != newType) {
      study.setNewType(newType);
    }
    if (null != centerName) {
      study.setCenterName(centerName);
    }
    if (null != centerProjectName) {
      study.setCenterProjectName(centerProjectName);
    }
    if (null != projectId) {
      study.setProjectId(projectId);
    }
    if (null != isSelected) {
      study.setIsSelected(isSelected);
    }
    if (null != isHasFile) {
      study.setIsHasFile(isHasFile);
    }
    if (null != html) {
      study.setHtml(html);
    }
    if (null != existingTypeInt) {
      study.setExistingTypeInt(existingTypeInt);
    }
    service.update(study);
    Hibernate3DtoCopier copier=new Hibernate3DtoCopier();
    Study detachedStudy=copier.hibernate2dto(Study.class,study);
    Document line=XmlTools.marshalToDocument(jo,detachedStudy);
    representation=XmlTools.getRepresentation(line);
    getResponse().setEntity(representation);
    getResponse().setLocationRef(getRequest().getRootRef() + "String_Node_Str" + detachedStudy.getSwAccession());
    getResponse().setStatus(Status.SUCCESS_CREATED);
  }
 catch (  SecurityException e) {
    getResponse().setStatus(Status.CLIENT_ERROR_FORBIDDEN,e);
  }
catch (  Exception e) {
    e.printStackTrace();
    getResponse().setStatus(Status.SERVER_ERROR_INTERNAL,e);
  }
  return representation;
}