Program: 188928
Project: 188928
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override @Put public Representation put(Representation entity){
  authenticate();
  Representation representation=null;
  JaxbObject<SequencerRun> jo=new JaxbObject<SequencerRun>();
  SequencerRun newSequencerRun=null;
  try {
    String text=entity.getText();
    newSequencerRun=(SequencerRun)XmlTools.unMarshal(jo,new SequencerRun(),text);
  }
 catch (  SAXException ex) {
    ex.printStackTrace();
    throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST,ex.getMessage());
  }
catch (  IOException e) {
    e.printStackTrace();
    throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST,e.getMessage());
  }
  try {
    SequencerRunService srs=BeanFactory.getSequencerRunServiceBean();
    SequencerRunWizardDTO sequencerRun=(SequencerRunWizardDTO)testIfNull(srs.findByID(newSequencerRun.getSequencerRunId()));
    sequencerRun.givesPermission(registration);
    String name=newSequencerRun.getName();
    String desc=newSequencerRun.getDescription();
    Boolean skip=newSequencerRun.getSkip();
    Registration owner=newSequencerRun.getOwner();
    Platform platform=newSequencerRun.getPlatform();
    Set<SequencerRunAttribute> newAttributes=newSequencerRun.getSequencerRunAttributes();
    sequencerRun.setName(name);
    sequencerRun.setDescription(desc);
    sequencerRun.setSkip(skip);
    if (owner != null) {
      RegistrationService rs=BeanFactory.getRegistrationServiceBean();
      Registration newReg=rs.findByEmailAddress(owner.getEmailAddress());
      if (newReg != null) {
        sequencerRun.setOwner(newReg);
      }
 else       if (newReg == null) {
        Log.info("String_Node_Str" + owner);
      }
    }
 else     if (sequencerRun.getOwner() == null) {
      sequencerRun.setOwner(registration);
    }
    if (platform != null) {
      Platform p=BeanFactory.getPlatformServiceBean().findByID(platform.getPlatformId());
      if (p != null) {
        sequencerRun.setPlatform(p);
      }
 else       if (p == null) {
        Log.info("String_Node_Str" + platform);
      }
    }
    if (newAttributes != null) {
      sequencerRun.getSequencerRunAttributes().clear();
      for (      SequencerRunAttribute sra : newAttributes) {
        sra.setSequencerRunWizardDTO(sequencerRun);
        sequencerRun.getSequencerRunAttributes().add(sra);
      }
    }
    srs.update(registration,sequencerRun);
    Log.debug("String_Node_Str" + sequencerRun.getSkip());
    Hibernate3DtoCopier copier=new Hibernate3DtoCopier();
    SequencerRun detachedSequencerRun=copier.hibernate2dto(SequencerRun.class,sequencerRun);
    Document line=XmlTools.marshalToDocument(jo,detachedSequencerRun);
    representation=XmlTools.getRepresentation(line);
    getResponse().setEntity(representation);
    getResponse().setLocationRef(getRequest().getRootRef() + "String_Node_Str" + detachedSequencerRun.getSwAccession());
    getResponse().setStatus(Status.SUCCESS_CREATED);
  }
 catch (  SecurityException e) {
    getResponse().setStatus(Status.CLIENT_ERROR_FORBIDDEN,e.getMessage());
  }
catch (  Exception e) {
    e.printStackTrace();
    getResponse().setStatus(Status.SERVER_ERROR_INTERNAL,e.getMessage());
  }
  return representation;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override @Put public Representation put(Representation entity){
  authenticate();
  Representation representation=null;
  JaxbObject<SequencerRun> jo=new JaxbObject<SequencerRun>();
  SequencerRun newSequencerRun=null;
  try {
    String text=entity.getText();
    newSequencerRun=(SequencerRun)XmlTools.unMarshal(jo,new SequencerRun(),text);
  }
 catch (  SAXException ex) {
    ex.printStackTrace();
    throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST,ex.getMessage());
  }
catch (  IOException e) {
    e.printStackTrace();
    throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST,e.getMessage());
  }
  try {
    SequencerRunService srs=BeanFactory.getSequencerRunServiceBean();
    SequencerRunWizardDTO sequencerRun=(SequencerRunWizardDTO)testIfNull(srs.findByID(newSequencerRun.getSequencerRunId()));
    sequencerRun.givesPermission(registration);
    String name=newSequencerRun.getName();
    String desc=newSequencerRun.getDescription();
    Boolean skip=newSequencerRun.getSkip();
    Registration owner=newSequencerRun.getOwner();
    Platform platform=newSequencerRun.getPlatform();
    Set<SequencerRunAttribute> newAttributes=newSequencerRun.getSequencerRunAttributes();
    sequencerRun.setName(name);
    sequencerRun.setDescription(desc);
    sequencerRun.setSkip(skip);
    if (owner != null) {
      RegistrationService rs=BeanFactory.getRegistrationServiceBean();
      Registration newReg=rs.findByEmailAddress(owner.getEmailAddress());
      if (newReg != null) {
        sequencerRun.setOwner(newReg);
      }
 else       if (newReg == null) {
        Log.info("String_Node_Str" + owner);
      }
    }
 else     if (sequencerRun.getOwner() == null) {
      sequencerRun.setOwner(registration);
    }
    if (platform != null) {
      Platform p=BeanFactory.getPlatformServiceBean().findByID(platform.getPlatformId());
      if (p != null) {
        sequencerRun.setPlatform(p);
      }
 else       if (p == null) {
        Log.info("String_Node_Str" + platform);
      }
    }
    if (newAttributes != null) {
      for (      SequencerRunAttribute sra : newAttributes) {
        sra.setSequencerRunWizardDTO(sequencerRun);
        sequencerRun.getSequencerRunAttributes().add(sra);
      }
    }
    srs.update(registration,sequencerRun);
    Log.debug("String_Node_Str" + sequencerRun.getSkip());
    Hibernate3DtoCopier copier=new Hibernate3DtoCopier();
    SequencerRun detachedSequencerRun=copier.hibernate2dto(SequencerRun.class,sequencerRun);
    Document line=XmlTools.marshalToDocument(jo,detachedSequencerRun);
    representation=XmlTools.getRepresentation(line);
    getResponse().setEntity(representation);
    getResponse().setLocationRef(getRequest().getRootRef() + "String_Node_Str" + detachedSequencerRun.getSwAccession());
    getResponse().setStatus(Status.SUCCESS_CREATED);
  }
 catch (  SecurityException e) {
    getResponse().setStatus(Status.CLIENT_ERROR_FORBIDDEN,e.getMessage());
  }
catch (  Exception e) {
    e.printStackTrace();
    getResponse().setStatus(Status.SERVER_ERROR_INTERNAL,e.getMessage());
  }
  return representation;
}