nus-yam/ex-repair huggingface dataset:
Program: 85921
Project: 85921
Buggy source:
@Before public void setup() throws Exception {
  initMocks(this);
  account=new Account(ProductUtil.USER_2_LOGIN,ProductUtil.USER_2_NAME,ProductUtil.USER_1_MAIL,ProductUtil.USER_1_LANGUAGE,new Date(),null);
  workspace=new Workspace(ProductUtil.WORKSPACE_ID,account,"String_Node_Str",false);
  user=new User(workspace,new Account(ProductUtil.USER_1_LOGIN,ProductUtil.USER_1_LOGIN,ProductUtil.USER_1_MAIL,ProductUtil.USER_1_LANGUAGE,new Date(),null));
  user2=new User(workspace,new Account(ProductUtil.USER_2_LOGIN,ProductUtil.USER_2_LOGIN,ProductUtil.USER_2_MAIL,ProductUtil.USER_2_LANGUAGE,new Date(),null));
  partMaster=new PartMaster(workspace,ProductUtil.PART_ID,user);
  partMasterTemplate=new PartMasterTemplate(workspace,ProductUtil.PART_MASTER_TEMPLATE_ID,user,ProductUtil.PART_TYPE,"String_Node_Str",true);
  partRevision=new PartRevision(partMaster,ProductUtil.VERSION,user);
  partIteration=new PartIteration(partRevision,ProductUtil.ITERATION,user);
  ArrayList<PartIteration> iterations=new ArrayList<PartIteration>();
  iterations.add(partIteration);
  partRevision.setPartIterations(iterations);
  partRevision.setCheckOutUser(user);
  partRevision.setCheckOutDate(new Date());
  partIteration.setPartRevision(partRevision);
}

Fixed version (ground truth):
@Before public void setup() throws Exception {
  initMocks(this);
  Mockito.when(tagEvent.select(any())).thenReturn(tagEvent);
  account=new Account(ProductUtil.USER_2_LOGIN,ProductUtil.USER_2_NAME,ProductUtil.USER_1_MAIL,ProductUtil.USER_1_LANGUAGE,new Date(),null);
  workspace=new Workspace(ProductUtil.WORKSPACE_ID,account,"String_Node_Str",false);
  user=new User(workspace,new Account(ProductUtil.USER_1_LOGIN,ProductUtil.USER_1_LOGIN,ProductUtil.USER_1_MAIL,ProductUtil.USER_1_LANGUAGE,new Date(),null));
  user2=new User(workspace,new Account(ProductUtil.USER_2_LOGIN,ProductUtil.USER_2_LOGIN,ProductUtil.USER_2_MAIL,ProductUtil.USER_2_LANGUAGE,new Date(),null));
  partMaster=new PartMaster(workspace,ProductUtil.PART_ID,user);
  partMasterTemplate=new PartMasterTemplate(workspace,ProductUtil.PART_MASTER_TEMPLATE_ID,user,ProductUtil.PART_TYPE,"String_Node_Str",true);
  partRevision=new PartRevision(partMaster,ProductUtil.VERSION,user);
  partIteration=new PartIteration(partRevision,ProductUtil.ITERATION,user);
  ArrayList<PartIteration> iterations=new ArrayList<PartIteration>();
  iterations.add(partIteration);
  partRevision.setPartIterations(iterations);
  partRevision.setCheckOutUser(user);
  partRevision.setCheckOutDate(new Date());
  partIteration.setPartRevision(partRevision);
}
Program: 85922
Project: 85922
Buggy source:
public PathDataIteration(int iteration,PathDataMaster pathDataMaster,Date date){
  this.iteration=iteration;
  this.pathDataMaster=pathDataMaster;
  this.dateIteration=date;
}

Fixed version (ground truth):
public PathDataIteration(int iteration,PathDataMaster pathDataMaster,Date date){
  setIteration(iteration);
  setPathDataMaster(pathDataMaster);
  setDateIteration(date);
}
Program: 85923
Project: 85923
Buggy source:
@Override public String getLocalizedMessage(){
  String message=getBundleDefaultMessage();
  return MessageFormat.format(message,mPathDataMasterId);
}

Fixed version (ground truth):
@Override public String getLocalizedMessage(){
  String message=getBundleDefaultMessage();
  if (mPathDataMasterPath != null)   return MessageFormat.format(message,mPathDataMasterPath);
 else   return MessageFormat.format(message,mPathDataMasterId);
}
Program: 85924
Project: 85924
Buggy source:
public PathDataMasterNotFoundException(Locale pLocale,Integer pPathDataMasterId,Throwable pCause){
  super(pLocale,pCause);
  mPathDataMasterId=pPathDataMasterId;
}

Fixed version (ground truth):
public PathDataMasterNotFoundException(Locale pLocale,Integer pPathDataMasterId,Throwable pCause){
  super(pLocale,pCause);
  mPathDataMasterId=pPathDataMasterId;
  mPathDataMasterPath=null;
}
Program: 85925
Project: 85925
Buggy source:
public PathDataMaster addNewPathDataIteration(String workspaceId,String configurationItemId,String serialNumber,int pathDataId,String path,List<InstanceAttribute> attributes,String description,DocumentRevisionKey[] links,String[] documentLinkComments) throws UserNotFoundException, AccessRightException, WorkspaceNotFoundException, ProductInstanceMasterNotFoundException, UserNotActiveException, NotAllowedException, PathDataAlreadyExistsException, FileAlreadyExistsException, CreationException ;

Fixed version (ground truth):
public PathDataMaster addNewPathDataIteration(String workspaceId,String configurationItemId,String serialNumber,int pathDataId,List<InstanceAttribute> attributes,String note,DocumentRevisionKey[] links,String[] documentLinkComments) throws UserNotFoundException, AccessRightException, WorkspaceNotFoundException, ProductInstanceMasterNotFoundException, UserNotActiveException, NotAllowedException, PathDataAlreadyExistsException, FileAlreadyExistsException, CreationException, PathDataMasterNotFoundException ;
Program: 85926
Project: 85926
Buggy source:
BinaryResource saveFileInPathDataIteration(String workspaceId,String configurationItemId,String serialNumber,int pathDataId,int iteration,String fileName,int i) throws UserNotFoundException, UserNotActiveException, WorkspaceNotFoundException, NotAllowedException, AccessRightException, ProductInstanceMasterNotFoundException, FileAlreadyExistsException, CreationException ;

Fixed version (ground truth):
BinaryResource saveFileInPathDataIteration(String workspaceId,String configurationItemId,String serialNumber,int pathDataId,int iteration,String fileName,int i) throws UserNotFoundException, UserNotActiveException, WorkspaceNotFoundException, NotAllowedException, AccessRightException, ProductInstanceMasterNotFoundException, FileAlreadyExistsException, CreationException, PathDataMasterNotFoundException ;
Program: 85927
Project: 85927
Buggy source:
public PathDataMaster findByPathAndProductInstanceIteration(String pathAsString,ProductInstanceIteration productInstanceIteration){
  try {
    return em.createNamedQuery("String_Node_Str",PathDataMaster.class).setParameter("String_Node_Str",pathAsString).setParameter("String_Node_Str",productInstanceIteration).getSingleResult();
  }
 catch (  NoResultException e) {
    return null;
  }
}

Fixed version (ground truth):
public PathDataMaster findByPathAndProductInstanceIteration(String pathAsString,ProductInstanceIteration productInstanceIteration) throws PathDataMasterNotFoundException {
  try {
    return em.createNamedQuery("String_Node_Str",PathDataMaster.class).setParameter("String_Node_Str",pathAsString).setParameter("String_Node_Str",productInstanceIteration).getSingleResult();
  }
 catch (  NoResultException e) {
    throw new PathDataMasterNotFoundException(mLocale,pathAsString);
  }
}
Program: 85928
Project: 85928
Buggy source:
public PathDataMaster findByPathIdAndProductInstanceIteration(int pathId,ProductInstanceIteration productInstanceIteration){
  try {
    return em.createNamedQuery("String_Node_Str",PathDataMaster.class).setParameter("String_Node_Str",pathId).setParameter("String_Node_Str",productInstanceIteration).getSingleResult();
  }
 catch (  NoResultException e) {
    return null;
  }
}

Fixed version (ground truth):
public PathDataMaster findByPathIdAndProductInstanceIteration(int pathId,ProductInstanceIteration productInstanceIteration) throws PathDataMasterNotFoundException {
  try {
    return em.createNamedQuery("String_Node_Str",PathDataMaster.class).setParameter("String_Node_Str",pathId).setParameter("String_Node_Str",productInstanceIteration).getSingleResult();
  }
 catch (  NoResultException e) {
    throw new PathDataMasterNotFoundException(mLocale,pathId);
  }
}
Program: 85930
Project: 85930
Buggy source:
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) @RolesAllowed({UserGroupMapping.REGULAR_USER_ROLE_ID}) @Override public boolean canWrite(String workspaceId,String configurationItemId,String serialNumber){
  try {
    User user=userManager.checkWorkspaceReadAccess(workspaceId);
    Locale locale=new Locale(user.getLanguage());
    ProductInstanceMasterDAO productInstanceMasterDAO=new ProductInstanceMasterDAO(locale,em);
    ProductInstanceMaster prodInstM=productInstanceMasterDAO.loadProductInstanceMaster(new ProductInstanceMasterKey(serialNumber,workspaceId,configurationItemId));
    checkProductInstanceWriteAccess(workspaceId,prodInstM,user);
    return true;
  }
 catch (  ProductInstanceMasterNotFoundException|AccessRightException|UserNotActiveException|WorkspaceNotFoundException|UserNotFoundException e) {
    return false;
  }
}

Fixed version (ground truth):
@RolesAllowed({UserGroupMapping.REGULAR_USER_ROLE_ID}) @Override public boolean canWrite(String workspaceId,String configurationItemId,String serialNumber){
  try {
    User user=userManager.checkWorkspaceReadAccess(workspaceId);
    Locale locale=new Locale(user.getLanguage());
    ProductInstanceMasterDAO productInstanceMasterDAO=new ProductInstanceMasterDAO(locale,em);
    ProductInstanceMaster prodInstM=productInstanceMasterDAO.loadProductInstanceMaster(new ProductInstanceMasterKey(serialNumber,workspaceId,configurationItemId));
    checkProductInstanceWriteAccess(workspaceId,prodInstM,user);
    return true;
  }
 catch (  ProductInstanceMasterNotFoundException|AccessRightException|UserNotActiveException|WorkspaceNotFoundException|UserNotFoundException e) {
    return false;
  }
}
Program: 85932
Project: 85932
Buggy source:
@RolesAllowed({UserGroupMapping.REGULAR_USER_ROLE_ID}) @Override public PathDataMaster getPathDataByPath(String workspaceId,String configurationItemId,String serialNumber,String pathAsString) throws UserNotFoundException, UserNotActiveException, WorkspaceNotFoundException, AccessRightException, ProductInstanceMasterNotFoundException {
  User user=userManager.checkWorkspaceReadAccess(workspaceId);
  Locale locale=new Locale(user.getLanguage());
  ProductInstanceMasterDAO productInstanceMasterDAO=new ProductInstanceMasterDAO(locale,em);
  ProductInstanceMaster prodInstM=productInstanceMasterDAO.loadProductInstanceMaster(new ProductInstanceMasterKey(serialNumber,workspaceId,configurationItemId));
  checkProductInstanceReadAccess(workspaceId,prodInstM,user);
  ProductInstanceIteration prodInstI=prodInstM.getLastIteration();
  PathDataMasterDAO pathDataMasterDAO=new PathDataMasterDAO(locale,em);
  return pathDataMasterDAO.findByPathAndProductInstanceIteration(pathAsString,prodInstI);
}

Fixed version (ground truth):
@RolesAllowed({UserGroupMapping.REGULAR_USER_ROLE_ID}) @Override public PathDataMaster getPathDataByPath(String workspaceId,String configurationItemId,String serialNumber,String pathAsString) throws UserNotFoundException, UserNotActiveException, WorkspaceNotFoundException, AccessRightException, ProductInstanceMasterNotFoundException {
  User user=userManager.checkWorkspaceReadAccess(workspaceId);
  Locale locale=new Locale(user.getLanguage());
  ProductInstanceMasterDAO productInstanceMasterDAO=new ProductInstanceMasterDAO(locale,em);
  ProductInstanceMaster prodInstM=productInstanceMasterDAO.loadProductInstanceMaster(new ProductInstanceMasterKey(serialNumber,workspaceId,configurationItemId));
  checkProductInstanceReadAccess(workspaceId,prodInstM,user);
  ProductInstanceIteration prodInstI=prodInstM.getLastIteration();
  PathDataMasterDAO pathDataMasterDAO=new PathDataMasterDAO(locale,em);
  PathDataMaster pathDataMaster=null;
  try {
    pathDataMaster=pathDataMasterDAO.findByPathAndProductInstanceIteration(pathAsString,prodInstI);
  }
 catch (  PathDataMasterNotFoundException pEx) {
  }
  return pathDataMaster;
}
Program: 85933
Project: 85933
Buggy source:
public Task[] findInProgressTasks(String workspaceId,String userLogin){
  Task[] tasks;
  TypedQuery<Task> query=em.createNamedQuery("String_Node_Str",Task.class);
  query.setParameter("String_Node_Str",em.getReference(User.class,new UserKey(workspaceId,userLogin)));
  List<Task> listTasks=query.getResultList();
  tasks=new Task[listTasks.size()];
  for (int i=0; i < listTasks.size(); i++) {
    tasks[i]=listTasks.get(i);
  }
  return tasks;
}

Fixed version (ground truth):
public Task[] findInProgressTasks(String workspaceId,String userLogin){
  Task[] tasks;
  TypedQuery<Task> query=em.createNamedQuery("String_Node_Str",Task.class);
  query.setParameter("String_Node_Str",em.getReference(User.class,new UserKey(workspaceId,userLogin)));
  query.setParameter("String_Node_Str",userLogin);
  query.setParameter("String_Node_Str",workspaceId);
  List<Task> listTasks=query.getResultList();
  tasks=new Task[listTasks.size()];
  for (int i=0; i < listTasks.size(); i++) {
    tasks[i]=listTasks.get(i);
  }
  return tasks;
}
Program: 85934
Project: 85934
Buggy source:
public Task[] findAssignedTasks(String workspaceId,String userLogin){
  Task[] tasks;
  TypedQuery<Task> query=em.createNamedQuery("String_Node_Str",Task.class);
  query.setParameter("String_Node_Str",em.getReference(User.class,new UserKey(workspaceId,userLogin)));
  List<Task> listTasks=query.getResultList();
  tasks=new Task[listTasks.size()];
  for (int i=0; i < listTasks.size(); i++) {
    tasks[i]=listTasks.get(i);
  }
  return tasks;
}

Fixed version (ground truth):
public Task[] findAssignedTasks(String workspaceId,String userLogin){
  Task[] tasks;
  TypedQuery<Task> query=em.createNamedQuery("String_Node_Str",Task.class);
  query.setParameter("String_Node_Str",em.getReference(User.class,new UserKey(workspaceId,userLogin)));
  query.setParameter("String_Node_Str",userLogin);
  query.setParameter("String_Node_Str",workspaceId);
  List<Task> listTasks=query.getResultList();
  tasks=new Task[listTasks.size()];
  for (int i=0; i < listTasks.size(); i++) {
    tasks[i]=listTasks.get(i);
  }
  return tasks;
}
Program: 85935
Project: 85935
Buggy source:
@AroundInvoke public Object createImport(InvocationContext ctx) throws Exception {
  Object[] parameters=ctx.getParameters();
  String workspaceId=(String)parameters[0];
  File file=(File)parameters[1];
  String originalFileName=(String)parameters[2];
  Import newImport=productService.createImport(workspaceId,originalFileName);
  String id=newImport.getId();
  ImportResult importResult=null;
  try {
    Object proceed=ctx.proceed();
    Future<ImportResult> result=(Future<ImportResult>)proceed;
    importResult=result.get();
    return proceed;
  }
 catch (  Exception e) {
    LOGGER.log(Level.SEVERE,"String_Node_Str",e);
    List<String> errors=new ArrayList<>();
    List<String> warnings=new ArrayList<>();
    errors.add(e.getMessage());
    importResult=new ImportResult(file,originalFileName,warnings,errors);
    return null;
  }
 finally {
    productService.endImport(workspaceId,id,importResult);
  }
}

Fixed version (ground truth):
@AroundInvoke public Object createImport(InvocationContext ctx) throws Exception {
  Object[] parameters=ctx.getParameters();
  String workspaceId=(String)parameters[0];
  File file=(File)parameters[1];
  String originalFileName=(String)parameters[2];
  Import newImport=productService.createImport(workspaceId,originalFileName);
  String id=newImport.getId();
  ImportResult importResult=null;
  try {
    Object proceed=ctx.proceed();
    Future<ImportResult> result=(Future<ImportResult>)proceed;
    importResult=result.get();
    return proceed;
  }
 catch (  Exception e) {
    LOGGER.log(Level.SEVERE,"String_Node_Str",e);
    List<String> errors=new ArrayList<>();
    List<String> warnings=new ArrayList<>();
    errors.add("String_Node_Str");
    importResult=new ImportResult(file,originalFileName,warnings,errors);
    return null;
  }
 finally {
    productService.endImport(workspaceId,id,importResult);
  }
}
Program: 85936
Project: 85936
Buggy source:
@Override @Asynchronous @FileImport public Future<ImportResult> importIntoParts(String workspaceId,File file,String originalFileName,String revisionNote,boolean autoCheckout,boolean autoCheckin,boolean permissiveUpdate) throws Exception {
  PartImporter selectedImporter=null;
  for (  PartImporter importer : partImporters) {
    if (importer.canImportFile(file.getName())) {
      selectedImporter=importer;
      break;
    }
  }
  ImportResult result;
  if (selectedImporter != null) {
    result=selectedImporter.importFile(workspaceId,file,revisionNote,autoCheckout,autoCheckin,permissiveUpdate);
  }
 else {
    result=getNoImporterAvailableError(file,originalFileName);
  }
  file.delete();
  return new AsyncResult<>(result);
}

Fixed version (ground truth):
@Override @Asynchronous @FileImport public Future<ImportResult> importIntoParts(String workspaceId,File file,String originalFileName,String revisionNote,boolean autoCheckout,boolean autoCheckin,boolean permissiveUpdate) throws Exception {
  PartImporter selectedImporter=null;
  for (  PartImporter importer : partImporters) {
    if (importer.canImportFile(file.getName())) {
      selectedImporter=importer;
      break;
    }
  }
  ImportResult result;
  if (selectedImporter != null) {
    result=selectedImporter.importFile(workspaceId,file,revisionNote,autoCheckout,autoCheckin,permissiveUpdate);
  }
 else {
    result=getNoImporterAvailableError(file,originalFileName);
  }
  return new AsyncResult<>(result);
}
Program: 85937
Project: 85937
Buggy source:
@POST @Path("String_Node_Str") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) public Response importAttributes(@Context HttpServletRequest request,@PathParam("String_Node_Str") String workspaceId,@QueryParam("String_Node_Str") boolean autoCheckout,@QueryParam("String_Node_Str") boolean autoCheckin,@QueryParam("String_Node_Str") boolean permissiveUpdate,@QueryParam("String_Node_Str") String revisionNote) throws Exception {
  Collection<Part> parts=request.getParts();
  if (parts.isEmpty() || parts.size() > 1) {
    return Response.status(Response.Status.BAD_REQUEST).build();
  }
  Part part=parts.iterator().next();
  String name=FileIO.getFileNameWithoutExtension(part.getSubmittedFileName());
  String extension=FileIO.getExtension(part.getSubmittedFileName());
  File importFile=Files.createTempFile("String_Node_Str" + name,"String_Node_Str" + (extension == null ? "String_Node_Str" : "String_Node_Str" + extension)).toFile();
  long length=BinaryResourceUpload.uploadBinary(new BufferedOutputStream(new FileOutputStream(importFile)),part);
  importerService.importIntoParts(workspaceId,importFile,name + "String_Node_Str" + extension,revisionNote,autoCheckout,autoCheckin,permissiveUpdate);
  return Response.noContent().build();
}

Fixed version (ground truth):
@POST @Path("String_Node_Str") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) public Response importAttributes(@Context HttpServletRequest request,@PathParam("String_Node_Str") String workspaceId,@QueryParam("String_Node_Str") boolean autoCheckout,@QueryParam("String_Node_Str") boolean autoCheckin,@QueryParam("String_Node_Str") boolean permissiveUpdate,@QueryParam("String_Node_Str") String revisionNote) throws Exception {
  Collection<Part> parts=request.getParts();
  if (parts.isEmpty() || parts.size() > 1) {
    return Response.status(Response.Status.BAD_REQUEST).build();
  }
  Part part=parts.iterator().next();
  String name=FileIO.getFileNameWithoutExtension(part.getSubmittedFileName());
  String extension=FileIO.getExtension(part.getSubmittedFileName());
  File importFile=Files.createTempFile("String_Node_Str" + name,"String_Node_Str" + (extension == null ? "String_Node_Str" : "String_Node_Str" + extension)).toFile();
  long length=BinaryResourceUpload.uploadBinary(new BufferedOutputStream(new FileOutputStream(importFile)),part);
  importerService.importIntoParts(workspaceId,importFile,name + "String_Node_Str" + extension,revisionNote,autoCheckout,autoCheckin,permissiveUpdate);
  importFile.deleteOnExit();
  return Response.noContent().build();
}
Program: 85938
Project: 85938
Buggy source:
@POST @Path("String_Node_Str") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) public Response importAttributes(@Context HttpServletRequest request,@PathParam("String_Node_Str") String workspaceId,@QueryParam("String_Node_Str") boolean autoFreezeAfterUpdate,@QueryParam("String_Node_Str") boolean permissiveUpdate,@QueryParam("String_Node_Str") String revisionNote) throws Exception {
  Collection<Part> parts=request.getParts();
  if (parts.isEmpty() || parts.size() > 1) {
    return Response.status(Response.Status.BAD_REQUEST).build();
  }
  Part part=parts.iterator().next();
  String name=FileIO.getFileNameWithoutExtension(part.getSubmittedFileName());
  String extension=FileIO.getExtension(part.getSubmittedFileName());
  File importFile=Files.createTempFile("String_Node_Str" + name,"String_Node_Str" + (extension == null ? "String_Node_Str" : "String_Node_Str" + extension)).toFile();
  long length=BinaryResourceUpload.uploadBinary(new BufferedOutputStream(new FileOutputStream(importFile)),part);
  importerService.importIntoPathData(workspaceId,importFile,name + "String_Node_Str" + extension,revisionNote,autoFreezeAfterUpdate,permissiveUpdate);
  importFile.delete();
  return Response.noContent().build();
}

Fixed version (ground truth):
@POST @Path("String_Node_Str") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) public Response importAttributes(@Context HttpServletRequest request,@PathParam("String_Node_Str") String workspaceId,@QueryParam("String_Node_Str") boolean autoFreezeAfterUpdate,@QueryParam("String_Node_Str") boolean permissiveUpdate,@QueryParam("String_Node_Str") String revisionNote) throws Exception {
  Collection<Part> parts=request.getParts();
  if (parts.isEmpty() || parts.size() > 1) {
    return Response.status(Response.Status.BAD_REQUEST).build();
  }
  Part part=parts.iterator().next();
  String name=FileIO.getFileNameWithoutExtension(part.getSubmittedFileName());
  String extension=FileIO.getExtension(part.getSubmittedFileName());
  File importFile=Files.createTempFile("String_Node_Str" + name,"String_Node_Str" + (extension == null ? "String_Node_Str" : "String_Node_Str" + extension)).toFile();
  long length=BinaryResourceUpload.uploadBinary(new BufferedOutputStream(new FileOutputStream(importFile)),part);
  importerService.importIntoPathData(workspaceId,importFile,name + "String_Node_Str" + extension,revisionNote,autoFreezeAfterUpdate,permissiveUpdate);
  importFile.deleteOnExit();
  return Response.noContent().build();
}
Program: 85939
Project: 85939
Buggy source:
@Override public void execImpl() throws Exception {
  if (id == null || revision == null) {
    loadMetadata();
  }
  IDocumentManagerWS documentS=ScriptingTools.createDocumentService(getServerURL(),user,password);
  DocumentRevisionKey docRPK=new DocumentRevisionKey(workspace,id,revision.toString());
  DocumentRevision dr=documentS.getDocumentRevision(docRPK);
  DocumentIteration di=dr.getLastIteration();
  DocumentIterationKey docIPK=new DocumentIterationKey(docRPK,di.getIteration());
  if (!noUpload && !di.getAttachedFiles().isEmpty()) {
    for (    BinaryResource bin : di.getAttachedFiles()) {
      String fileName=bin.getName();
      File localFile=new File(path,fileName);
      if (localFile.exists()) {
        FileHelper fh=new FileHelper(user,password,output,new AccountsManager().getUserLocale(user));
        fh.uploadDocumentFile(getServerURL(),localFile,docIPK);
        localFile.setWritable(false);
      }
    }
  }
  if (message != null && !message.isEmpty()) {
    documentS.updateDocument(docIPK,message,null,null,null);
  }
  dr=documentS.checkInDocument(docRPK);
  output.printInfo(LangHelper.getLocalizedMessage("String_Node_Str",user) + "String_Node_Str" + id+ "String_Node_Str"+ dr.getVersion()+ "String_Node_Str"+ di.getIteration()+ "String_Node_Str"+ workspace+ "String_Node_Str");
}

Fixed version (ground truth):
@Override public void execImpl() throws Exception {
  if (id == null || revision == null) {
    loadMetadata();
  }
  IDocumentManagerWS documentS=ScriptingTools.createDocumentService(getServerURL(),user,password);
  DocumentRevisionKey docRPK=new DocumentRevisionKey(workspace,id,revision.toString());
  DocumentRevision dr=documentS.getDocumentRevision(docRPK);
  DocumentIteration di=dr.getLastIteration();
  DocumentIterationKey docIPK=new DocumentIterationKey(docRPK,di.getIteration());
  if (!noUpload && !di.getAttachedFiles().isEmpty()) {
    for (    BinaryResource bin : di.getAttachedFiles()) {
      String fileName=bin.getName();
      File localFile=new File(path,fileName);
      if (localFile.exists()) {
        FileHelper fh=new FileHelper(user,password,output,new AccountsManager().getUserLocale(user));
        fh.uploadDocumentFile(getServerURL(),localFile,docIPK);
        localFile.setWritable(false);
      }
    }
  }
  if (message != null && !message.isEmpty()) {
    documentS.updateDocument(docIPK,message,null,null,null);
  }
  output.printInfo(LangHelper.getLocalizedMessage("String_Node_Str",user) + "String_Node_Str" + id+ "String_Node_Str"+ dr.getVersion()+ "String_Node_Str"+ di.getIteration()+ "String_Node_Str"+ workspace+ "String_Node_Str");
  documentS.checkInDocument(docRPK);
}
Program: 85940
Project: 85940
Buggy source:
private void checkoutDocument(String id,String pRevision) throws IOException, UserNotFoundException, WorkspaceNotFoundException, UserNotActiveException, LoginException, NoSuchAlgorithmException, NotAllowedException, FileAlreadyExistsException, AccessRightException, CreationException, DocumentRevisionNotFoundException {
  DocumentRevisionKey documentRevisionKey=new DocumentRevisionKey(workspace,id,pRevision);
  DocumentRevision dr=documentS.getDocumentRevision(documentRevisionKey);
  DocumentIteration di=dr.getLastIteration();
  if (!dr.isCheckedOut()) {
    try {
      dr=documentS.checkOutDocument(documentRevisionKey);
      di=dr.getLastIteration();
    }
 catch (    Exception e) {
      output.printException(e);
    }
  }
  if (!noDownload && !di.getAttachedFiles().isEmpty()) {
    FileHelper fh=new FileHelper(user,password,output,new AccountsManager().getUserLocale(user));
    fh.downloadDocumentFiles(getServerURL(),path,workspace,id,dr,di,force);
  }
}

Fixed version (ground truth):
private void checkoutDocument(String id,String pRevision) throws IOException, UserNotFoundException, WorkspaceNotFoundException, UserNotActiveException, LoginException, NoSuchAlgorithmException, NotAllowedException, FileAlreadyExistsException, AccessRightException, CreationException, DocumentRevisionNotFoundException {
  Locale locale=new AccountsManager().getUserLocale(user);
  DocumentRevisionKey documentRevisionKey=new DocumentRevisionKey(workspace,id,pRevision);
  DocumentRevision dr=documentS.getDocumentRevision(documentRevisionKey);
  DocumentIteration di=dr.getLastIteration();
  output.printInfo(LangHelper.getLocalizedMessage("String_Node_Str",locale) + "String_Node_Str" + id+ "String_Node_Str"+ dr.getVersion()+ "String_Node_Str"+ di.getIteration()+ "String_Node_Str"+ workspace+ "String_Node_Str");
  if (!dr.isCheckedOut()) {
    try {
      dr=documentS.checkOutDocument(documentRevisionKey);
      di=dr.getLastIteration();
    }
 catch (    Exception e) {
      output.printException(e);
    }
  }
  if (!noDownload && !di.getAttachedFiles().isEmpty()) {
    FileHelper fh=new FileHelper(user,password,output,locale);
    fh.downloadDocumentFiles(getServerURL(),path,workspace,id,dr,di,force);
  }
}
Program: 85943
Project: 85943
Buggy source:
private void removeObsoletePathToPathLinks(User user,String workspaceId) throws UserNotFoundException, WorkspaceNotFoundException, UserNotActiveException, PartRevisionNotFoundException, AccessRightException {
  Locale locale=new Locale(user.getLanguage());
  ConfigurationItemDAO configurationItemDAO=new ConfigurationItemDAO(locale,em);
  List<ConfigurationItem> configurationItems=configurationItemDAO.findAllConfigurationItems(workspaceId);
  PathToPathLinkDAO pathToPathLinkDAO=new PathToPathLinkDAO(locale,em);
  for (  ConfigurationItem configurationItem : configurationItems) {
    List<PathToPathLink> pathToPathLinks=configurationItem.getPathToPathLinks();
    for (    PathToPathLink pathToPathLink : pathToPathLinks) {
      try {
        decodePath(configurationItem.getKey(),pathToPathLink.getSourcePath());
        decodePath(configurationItem.getKey(),pathToPathLink.getTargetPath());
      }
 catch (      PartUsageLinkNotFoundException e) {
        pathToPathLinkDAO.removePathToPathLink(pathToPathLink);
      }
catch (      ConfigurationItemNotFoundException e) {
        LOGGER.log(Level.SEVERE,null,e);
      }
    }
  }
}

Fixed version (ground truth):
private void removeObsoletePathToPathLinks(User user,String workspaceId) throws UserNotFoundException, WorkspaceNotFoundException, UserNotActiveException, PartRevisionNotFoundException, AccessRightException {
  Locale locale=new Locale(user.getLanguage());
  ConfigurationItemDAO configurationItemDAO=new ConfigurationItemDAO(locale,em);
  List<ConfigurationItem> configurationItems=configurationItemDAO.findAllConfigurationItems(workspaceId);
  for (  ConfigurationItem configurationItem : configurationItems) {
    List<PathToPathLink> pathToPathLinks=new ArrayList<>(configurationItem.getPathToPathLinks());
    for (    PathToPathLink pathToPathLink : pathToPathLinks) {
      try {
        decodePath(configurationItem.getKey(),pathToPathLink.getSourcePath());
        decodePath(configurationItem.getKey(),pathToPathLink.getTargetPath());
      }
 catch (      PartUsageLinkNotFoundException e) {
        configurationItem.removePathToPathLink(pathToPathLink);
      }
catch (      ConfigurationItemNotFoundException e) {
        LOGGER.log(Level.SEVERE,null,e);
      }
    }
  }
}
Program: 85945
Project: 85945
Buggy source:
@RolesAllowed(UserGroupMapping.REGULAR_USER_ROLE_ID) @Override public PartRevision checkInPart(PartRevisionKey pPartRPK) throws PartRevisionNotFoundException, UserNotFoundException, WorkspaceNotFoundException, AccessRightException, NotAllowedException, ESServerException, EntityConstraintException, UserNotActiveException, PartMasterNotFoundException {
  User user=userManager.checkWorkspaceWriteAccess(pPartRPK.getPartMaster().getWorkspace());
  Locale locale=new Locale(user.getLanguage());
  PartRevisionDAO partRDAO=new PartRevisionDAO(locale,em);
  PartRevision partR=partRDAO.loadPartR(pPartRPK);
  if (!hasPartRevisionWriteAccess(user,partR)) {
    throw new AccessRightException(locale,user);
  }
  if (isCheckoutByUser(user,partR)) {
    PartIteration lastCheckedInIteration=partR.getLastCheckedInIteration();
    checkCyclicAssemblyForPartIteration(partR.getLastIteration());
    partR.setCheckOutDate(null);
    partR.setCheckOutUser(null);
    PartIteration lastIteration=partR.getLastIteration();
    lastIteration.setCheckInDate(new Date());
    esIndexer.index(lastIteration);
    if (lastCheckedInIteration != null) {
      removeObsoletePathToPathLinks(user,pPartRPK.getWorkspaceId());
    }
    partIterationEvent.select(new AnnotationLiteral<CheckedIn>(){
    }
).fire(new PartIterationChangeEvent(lastIteration));
    return partR;
  }
 else {
    throw new NotAllowedException(locale,"String_Node_Str");
  }
}

Fixed version (ground truth):
@RolesAllowed(UserGroupMapping.REGULAR_USER_ROLE_ID) @Override public PartRevision checkInPart(PartRevisionKey pPartRPK) throws PartRevisionNotFoundException, UserNotFoundException, WorkspaceNotFoundException, AccessRightException, NotAllowedException, ESServerException, EntityConstraintException, UserNotActiveException, PartMasterNotFoundException {
  User user=userManager.checkWorkspaceWriteAccess(pPartRPK.getPartMaster().getWorkspace());
  Locale locale=new Locale(user.getLanguage());
  PartRevisionDAO partRDAO=new PartRevisionDAO(locale,em);
  PartRevision partR=partRDAO.loadPartR(pPartRPK);
  if (!hasPartRevisionWriteAccess(user,partR)) {
    throw new AccessRightException(locale,user);
  }
  if (isCheckoutByUser(user,partR)) {
    checkCyclicAssemblyForPartIteration(partR.getLastIteration());
    partR.setCheckOutDate(null);
    partR.setCheckOutUser(null);
    PartIteration lastIteration=partR.getLastIteration();
    lastIteration.setCheckInDate(new Date());
    esIndexer.index(lastIteration);
    partIterationEvent.select(new AnnotationLiteral<CheckedIn>(){
    }
).fire(new PartIterationChangeEvent(lastIteration));
    return partR;
  }
 else {
    throw new NotAllowedException(locale,"String_Node_Str");
  }
}
Program: 85947
Project: 85947
Buggy source:
public ParallelActivityModel(WorkflowModel pWorkflowModel,String pLifeCycleState,int pTasksToComplete){
  this(pWorkflowModel,0,new ArrayList<TaskModel>(),pLifeCycleState,pTasksToComplete);
}

Fixed version (ground truth):
public ParallelActivityModel(WorkflowModel pWorkflowModel,String pLifeCycleState,int pTasksToComplete){
  this(pWorkflowModel,0,new LinkedList<>(),pLifeCycleState,pTasksToComplete);
}
Program: 85948
Project: 85948
Buggy source:
public SerialActivityModel(WorkflowModel pWorkflowModel,String pLifeCycleState){
  this(pWorkflowModel,0,new ArrayList<TaskModel>(),pLifeCycleState);
}

Fixed version (ground truth):
public SerialActivityModel(WorkflowModel pWorkflowModel,String pLifeCycleState){
  this(pWorkflowModel,0,new LinkedList<>(),pLifeCycleState);
}
Program: 85949
Project: 85949
Buggy source:
public void setActivityModel(ActivityModel activityModel){
  this.activityModel=activityModel;
  activityModelId=activityModel.getId();
}

Fixed version (ground truth):
public void setActivityModel(ActivityModel activityModel){
  this.activityModel=activityModel;
}
Program: 85950
Project: 85950
Buggy source:
@Override public int hashCode(){
  int hash=1;
  hash=31 * hash + activityModelId;
  hash=31 * hash + num;
  return hash;
}

Fixed version (ground truth):
@Override public int hashCode(){
  int hash=1;
  hash=31 * hash + getActivityModelId();
  hash=31 * hash + num;
  return hash;
}
Program: 85951
Project: 85951
Buggy source:
@Override public boolean equals(Object pObj){
  if (this == pObj) {
    return true;
  }
  if (!(pObj instanceof TaskModel)) {
    return false;
  }
  TaskModel model=(TaskModel)pObj;
  return model.activityModelId == activityModelId && model.num == num;
}

Fixed version (ground truth):
@Override public boolean equals(Object pObj){
  if (this == pObj) {
    return true;
  }
  if (!(pObj instanceof TaskModel)) {
    return false;
  }
  TaskModel model=(TaskModel)pObj;
  return model.getActivityModelId() == getActivityModelId() && model.num == num;
}
Program: 85952
Project: 85952
Buggy source:
@Override public String toString(){
  return activityModelId + "String_Node_Str" + num;
}

Fixed version (ground truth):
@Override public String toString(){
  return getActivityModelId() + "String_Node_Str" + num;
}
Program: 85953
Project: 85953
Buggy source:
public TaskModelKey(int pActivityModelId,int pNum){
  activityModelId=pActivityModelId;
  num=pNum;
}

Fixed version (ground truth):
public TaskModelKey(int pActivityModelId,int pNum){
  activityModel=pActivityModelId;
  num=pNum;
}
Program: 85954
Project: 85954
Buggy source:
@Override public int hashCode(){
  int hash=1;
  hash=31 * hash + activityModelId;
  hash=31 * hash + num;
  return hash;
}

Fixed version (ground truth):
@Override public int hashCode(){
  int hash=1;
  hash=31 * hash + activityModel;
  hash=31 * hash + num;
  return hash;
}
Program: 85955
Project: 85955
Buggy source:
@Override public boolean equals(Object pObj){
  if (this == pObj) {
    return true;
  }
  if (!(pObj instanceof TaskModelKey)) {
    return false;
  }
  TaskModelKey key=(TaskModelKey)pObj;
  return key.activityModelId == activityModelId && key.num == num;
}

Fixed version (ground truth):
@Override public boolean equals(Object pObj){
  if (this == pObj) {
    return true;
  }
  if (!(pObj instanceof TaskModelKey)) {
    return false;
  }
  TaskModelKey key=(TaskModelKey)pObj;
  return key.activityModel == activityModel && key.num == num;
}
Program: 85956
Project: 85956
Buggy source:
@Override public String toString(){
  return activityModelId + "String_Node_Str" + num;
}

Fixed version (ground truth):
@Override public String toString(){
  return activityModel + "String_Node_Str" + num;
}
Program: 85957
Project: 85957
Buggy source:
@RolesAllowed(UserGroupMapping.REGULAR_USER_ROLE_ID) @Override public WorkflowModel updateWorkflowModel(WorkflowModelKey workflowModelKey,String pFinalLifeCycleState,ActivityModel[] pActivityModels) throws UserNotFoundException, WorkspaceNotFoundException, UserNotActiveException, AccessRightException, WorkflowModelNotFoundException, NotAllowedException, WorkflowModelAlreadyExistsException, CreationException {
  User user=userManager.checkWorkspaceReadAccess(workflowModelKey.getWorkspaceId());
  Locale userLocale=new Locale(user.getLanguage());
  WorkflowModelDAO workflowModelDAO=new WorkflowModelDAO(userLocale,em);
  workflowModelDAO.removeAllActivityModels(workflowModelKey);
  WorkflowModel workflowModel=workflowModelDAO.loadWorkflowModel(workflowModelKey);
  checkWorkflowWriteAccess(workflowModel,user);
  checkWorkflowValidity(workflowModelKey.getWorkspaceId(),workflowModelKey.getId(),userLocale,pActivityModels);
  workflowModel.setFinalLifeCycleState(pFinalLifeCycleState);
  List<ActivityModel> activityModels=new ArrayList<>();
  Collections.addAll(activityModels,pActivityModels);
  workflowModel.setActivityModels(activityModels);
  Tools.resetParentReferences(workflowModel);
  for (  ActivityModel activityModel : activityModels) {
    em.persist(activityModel);
  }
  return workflowModel;
}

Fixed version (ground truth):
@RolesAllowed(UserGroupMapping.REGULAR_USER_ROLE_ID) @Override public WorkflowModel updateWorkflowModel(WorkflowModelKey workflowModelKey,String pFinalLifeCycleState,ActivityModel[] pActivityModels) throws UserNotFoundException, WorkspaceNotFoundException, UserNotActiveException, AccessRightException, WorkflowModelNotFoundException, NotAllowedException, WorkflowModelAlreadyExistsException, CreationException {
  User user=userManager.checkWorkspaceReadAccess(workflowModelKey.getWorkspaceId());
  Locale userLocale=new Locale(user.getLanguage());
  WorkflowModelDAO workflowModelDAO=new WorkflowModelDAO(userLocale,em);
  workflowModelDAO.removeAllActivityModels(workflowModelKey);
  WorkflowModel workflowModel=workflowModelDAO.loadWorkflowModel(workflowModelKey);
  checkWorkflowWriteAccess(workflowModel,user);
  checkWorkflowValidity(workflowModelKey.getWorkspaceId(),workflowModelKey.getId(),userLocale,pActivityModels);
  workflowModel.setFinalLifeCycleState(pFinalLifeCycleState);
  List<ActivityModel> activityModels=new LinkedList<>();
  Collections.addAll(activityModels,pActivityModels);
  workflowModel.setActivityModels(activityModels);
  Tools.resetParentReferences(workflowModel);
  return workflowModel;
}
Program: 85958
Project: 85958
Buggy source:
public void removeWorkflowModel(WorkflowModelKey pKey) throws WorkflowModelNotFoundException {
  WorkflowModel model=loadWorkflowModel(pKey);
  removeAllActivityModels(pKey);
  em.remove(model);
}

Fixed version (ground truth):
public void removeWorkflowModel(WorkflowModelKey pKey) throws WorkflowModelNotFoundException {
  WorkflowModel model=loadWorkflowModel(pKey);
  for (  ActivityModel activity : model.getActivityModels()) {
    activity.setRelaunchActivity(null);
  }
  em.flush();
  em.remove(model);
}
Program: 85959
Project: 85959
Buggy source:
public List<WorkflowModel> findAllWorkflowModels(String pWorkspaceId){
  Query query=em.createQuery("String_Node_Str");
  return query.setParameter("String_Node_Str",pWorkspaceId).getResultList();
}

Fixed version (ground truth):
public List<WorkflowModel> findAllWorkflowModels(String pWorkspaceId){
  TypedQuery<WorkflowModel> query=em.createQuery("String_Node_Str",WorkflowModel.class);
  return query.setParameter("String_Node_Str",pWorkspaceId).getResultList();
}
Program: 85960
Project: 85960
Buggy source:
public void createWorkflowModel(WorkflowModel pModel) throws WorkflowModelAlreadyExistsException, CreationException {
  try {
    em.persist(pModel);
    em.flush();
  }
 catch (  EntityExistsException pEEEx) {
    LOGGER.log(Level.FINEST,null,pEEEx);
    throw new WorkflowModelAlreadyExistsException(mLocale,pModel);
  }
catch (  PersistenceException pPEx) {
    LOGGER.log(Level.FINEST,null,pPEx);
    throw new CreationException(mLocale);
  }
}

Fixed version (ground truth):
public void createWorkflowModel(WorkflowModel pModel) throws WorkflowModelAlreadyExistsException, CreationException {
  try {
    List<ActivityModel> activityModels=pModel.getActivityModels();
    List<List<TaskModel>> taskModels=new LinkedList<>();
    for (    ActivityModel activityModel : activityModels) {
      taskModels.add(activityModel.getTaskModels());
      activityModel.setTaskModels(new ArrayList<>());
    }
    em.persist(pModel);
    em.flush();
    int i=0;
    for (    ActivityModel activityModel : activityModels) {
      activityModel.setTaskModels(taskModels.get(i++));
    }
  }
 catch (  EntityExistsException pEEEx) {
    LOGGER.log(Level.FINEST,null,pEEEx);
    throw new WorkflowModelAlreadyExistsException(mLocale,pModel);
  }
catch (  PersistenceException pPEx) {
    LOGGER.log(Level.FINEST,null,pPEx);
    throw new CreationException(mLocale);
  }
}
Program: 85961
Project: 85961
Buggy source:
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public List<PathDTO> searchPaths(@PathParam("String_Node_Str") String workspaceId,@PathParam("String_Node_Str") String ciId,@QueryParam("String_Node_Str") String partNumber,@QueryParam("String_Node_Str") String configSpecType,@QueryParam("String_Node_Str") boolean diverge) throws EntityNotFoundException, UserNotActiveException, EntityConstraintException, NotAllowedException {
  ConfigurationItemKey ciKey=new ConfigurationItemKey(workspaceId,ciId);
  PSFilter filter=productService.getPSFilter(ciKey,configSpecType,diverge);
  List<PartLink[]> usagePaths=productService.findPartUsages(ciKey,filter,partNumber);
  List<PathDTO> pathsDTO=new ArrayList<>();
  for (  PartLink[] usagePath : usagePaths) {
    String pathAsString=com.docdoku.core.util.Tools.getPathAsString(Arrays.asList(usagePath));
    pathsDTO.add(new PathDTO(pathAsString));
  }
  return pathsDTO;
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public List<PathDTO> searchPaths(@PathParam("String_Node_Str") String workspaceId,@PathParam("String_Node_Str") String ciId,@QueryParam("String_Node_Str") String search,@QueryParam("String_Node_Str") String configSpecType,@QueryParam("String_Node_Str") boolean diverge) throws EntityNotFoundException, UserNotActiveException, EntityConstraintException, NotAllowedException {
  ConfigurationItemKey ciKey=new ConfigurationItemKey(workspaceId,ciId);
  PSFilter filter=productService.getPSFilter(ciKey,configSpecType,diverge);
  List<PartLink[]> usagePaths=productService.findPartUsages(ciKey,filter,search);
  List<PathDTO> pathsDTO=new ArrayList<>();
  for (  PartLink[] usagePath : usagePaths) {
    String pathAsString=com.docdoku.core.util.Tools.getPathAsString(Arrays.asList(usagePath));
    pathsDTO.add(new PathDTO(pathAsString));
  }
  return pathsDTO;
}
Program: 85962
Project: 85962
Buggy source:
public void removeWorkflowModel(WorkflowModelKey pKey) throws WorkflowModelNotFoundException {
  WorkflowModel model=loadWorkflowModel(pKey);
  for (  ActivityModel activity : model.getActivityModels()) {
    activity.setRelaunchActivity(null);
  }
  em.flush();
  em.remove(model);
}

Fixed version (ground truth):
public void removeWorkflowModel(WorkflowModelKey pKey) throws WorkflowModelNotFoundException {
  WorkflowModel model=loadWorkflowModel(pKey);
  removeAllActivityModels(pKey);
  em.remove(model);
}
Program: 85963
Project: 85963
Buggy source:
public static void updateAttributes(List<InstanceAttribute> pAttributes,List<InstanceAttribute> currentAttrs){
  for (int i=0; i < currentAttrs.size(); i++) {
    InstanceAttribute currentAttr=currentAttrs.get(i);
    if (i < pAttributes.size()) {
      InstanceAttribute newAttr=pAttributes.get(i);
      if (currentAttr.getClass() != newAttr.getClass() || newAttr.getClass() == InstanceListOfValuesAttribute.class) {
        currentAttrs.set(i,newAttr);
      }
 else {
        currentAttrs.get(i).setName(newAttr.getName());
        currentAttrs.get(i).setValue(newAttr.getValue());
        currentAttrs.get(i).setMandatory(newAttr.isMandatory());
        currentAttrs.get(i).setLocked(newAttr.isLocked());
      }
    }
 else {
      currentAttrs.remove(currentAttrs.size() - 1);
    }
  }
  for (int i=currentAttrs.size(); i < pAttributes.size(); i++) {
    InstanceAttribute newAttr=pAttributes.get(i);
    currentAttrs.add(newAttr);
  }
}

Fixed version (ground truth):
public static void updateAttributes(List<InstanceAttribute> pAttributes,List<InstanceAttribute> currentAttrs){
  for (int i=0; i < currentAttrs.size(); i++) {
    InstanceAttribute currentAttr=currentAttrs.get(i);
    if (i < pAttributes.size()) {
      InstanceAttribute newAttr=pAttributes.get(i);
      if (currentAttr.getClass() != newAttr.getClass() || newAttr.getClass() == InstanceListOfValuesAttribute.class) {
        currentAttrs.set(i,newAttr);
      }
 else {
        currentAttrs.get(i).setName(newAttr.getName());
        currentAttrs.get(i).setValue(newAttr.getValue());
        currentAttrs.get(i).setMandatory(newAttr.isMandatory());
        currentAttrs.get(i).setLocked(newAttr.isLocked());
      }
    }
 else {
      currentAttrs.remove(pAttributes.size() - 1);
    }
  }
  for (int i=currentAttrs.size(); i < pAttributes.size(); i++) {
    InstanceAttribute newAttr=pAttributes.get(i);
    currentAttrs.add(newAttr);
  }
}
Program: 85964
Project: 85964
Buggy source:
/** 
 * Get the part revision key matching a hit line.
 * @param source The source of a SearchHit
 * @return The part revision key
 */
protected static PartRevisionKey getPartRevisionKey(Map<String,Object> source){
  return new PartRevisionKey(extractValue(source,WORKSPACEID_KEY),extractValue(source,"String_Node_Str"),extractValue(source,VERSION_KEY));
}

Fixed version (ground truth):
/** 
 * Get the part revision key matching a hit line.
 * @param source The source of a SearchHit
 * @return The part revision key
 */
protected static PartRevisionKey getPartRevisionKey(Map<String,Object> source){
  return new PartRevisionKey(extractValue(source,WORKSPACE_ID_KEY),extractValue(source,PART_NUMBER_KEY),extractValue(source,VERSION_KEY));
}
Program: 85967
Project: 85967
Buggy source:
private static void setParam(Map<String,Object> params,String name,Object value,float coef){
  if (value != null) {
    Object array[]=new Object[2];
    array[0]=value;
    array[1]=coef;
    params.put(name,array);
  }
}

Fixed version (ground truth):
private static void setParam(Map<String,Object> params,String name,Workflow value,float coef){
  if (value != null) {
    Object array[]=new Object[2];
    String finalLifeCycleState=value.getFinalLifeCycleState();
    finalLifeCycleState=(finalLifeCycleState != null && !finalLifeCycleState.isEmpty()) ? finalLifeCycleState : "String_Node_Str";
    array[0]=finalLifeCycleState;
    array[1]=coef;
    params.put(name,array);
  }
}
Program: 85969
Project: 85969
Buggy source:
/** 
 * Get the document revision key matching a hit line.
 * @param source The source of a SearchHit
 * @return The document revision key
 */
protected static DocumentRevisionKey getDocumentRevisionKey(Map<String,Object> source){
  return new DocumentRevisionKey(extractValue(source,WORKSPACEID_KEY),extractValue(source,"String_Node_Str"),extractValue(source,VERSION_KEY));
}

Fixed version (ground truth):
/** 
 * Get the document revision key matching a hit line.
 * @param source The source of a SearchHit
 * @return The document revision key
 */
protected static DocumentRevisionKey getDocumentRevisionKey(Map<String,Object> source){
  return new DocumentRevisionKey(extractValue(source,WORKSPACE_ID_KEY),extractValue(source,DOCUMENT_ID_KEY),extractValue(source,VERSION_KEY));
}
Program: 85971
Project: 85971
Buggy source:
public String marshal(Date date) throws Exception {
  if (date == null) {
    return "String_Node_Str";
  }
  SimpleDateFormat df=new SimpleDateFormat(pattern);
  df.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  return df.format(date);
}

Fixed version (ground truth):
public String marshal(Date date) throws Exception {
  if (date == null) {
    return null;
  }
  SimpleDateFormat df=new SimpleDateFormat(pattern);
  df.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  return df.format(date);
}