nus-yam/ex-repair huggingface dataset:
Program: 86020
Project: 86020
Buggy source:
@RolesAllowed("String_Node_Str") @Override public Layer createLayer(ConfigurationItemKey pKey,String pName) throws UserNotFoundException, WorkspaceNotFoundException, AccessRightException, ConfigurationItemNotFoundException {
  User user=userManager.checkWorkspaceWriteAccess(pKey.getWorkspace());
  ConfigurationItem ci=new ConfigurationItemDAO(new Locale(user.getLanguage()),em).loadConfigurationItem(pKey);
  Layer layer=new Layer(pName,user,ci);
  Date now=new Date();
  layer.setCreationDate(now);
  new LayerDAO(new Locale(user.getLanguage()),em).createLayer(layer);
  return layer;
}

Fixed version (ground truth):
@RolesAllowed("String_Node_Str") @Override public Layer createLayer(ConfigurationItemKey pKey,String pName,String color) throws UserNotFoundException, WorkspaceNotFoundException, AccessRightException, ConfigurationItemNotFoundException {
  User user=userManager.checkWorkspaceWriteAccess(pKey.getWorkspace());
  ConfigurationItem ci=new ConfigurationItemDAO(new Locale(user.getLanguage()),em).loadConfigurationItem(pKey);
  Layer layer=new Layer(pName,user,ci,color);
  Date now=new Date();
  layer.setCreationDate(now);
  new LayerDAO(new Locale(user.getLanguage()),em).createLayer(layer);
  return layer;
}
Program: 86021
Project: 86021
Buggy source:
@RolesAllowed("String_Node_Str") @Override public Layer updateLayer(ConfigurationItemKey pKey,int pId,String pName) throws UserNotFoundException, WorkspaceNotFoundException, AccessRightException, ConfigurationItemNotFoundException, LayerNotFoundException, UserNotActiveException {
  Layer layer=getLayer(pId);
  userManager.checkWorkspaceWriteAccess(layer.getConfigurationItem().getWorkspaceId());
  layer.setName(pName);
  return layer;
}

Fixed version (ground truth):
@RolesAllowed("String_Node_Str") @Override public Layer updateLayer(ConfigurationItemKey pKey,int pId,String pName,String color) throws UserNotFoundException, WorkspaceNotFoundException, AccessRightException, ConfigurationItemNotFoundException, LayerNotFoundException, UserNotActiveException {
  Layer layer=getLayer(pId);
  userManager.checkWorkspaceWriteAccess(layer.getConfigurationItem().getWorkspaceId());
  layer.setName(pName);
  layer.setColor(color);
  return layer;
}
Program: 86022
Project: 86022
Buggy source:
@GET @Produces(MediaType.APPLICATION_JSON) public LayerDTO[] getLayersInProduct(@PathParam("String_Node_Str") String workspaceId,@PathParam("String_Node_Str") String ciId){
  try {
    ConfigurationItemKey ciKey=new ConfigurationItemKey(workspaceId,ciId);
    List<Layer> layers=productService.getLayers(ciKey);
    LayerDTO[] layerDtos=new LayerDTO[layers.size()];
    for (int i=0; i < layers.size(); i++) {
      layerDtos[i]=new LayerDTO(layers.get(i).getId(),layers.get(i).getName());
    }
    return layerDtos;
  }
 catch (  ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}

Fixed version (ground truth):
@GET @Produces(MediaType.APPLICATION_JSON) public LayerDTO[] getLayersInProduct(@PathParam("String_Node_Str") String workspaceId,@PathParam("String_Node_Str") String ciId){
  try {
    ConfigurationItemKey ciKey=new ConfigurationItemKey(workspaceId,ciId);
    List<Layer> layers=productService.getLayers(ciKey);
    LayerDTO[] layerDtos=new LayerDTO[layers.size()];
    for (int i=0; i < layers.size(); i++) {
      layerDtos[i]=new LayerDTO(layers.get(i).getId(),layers.get(i).getName(),layers.get(i).getColor());
    }
    return layerDtos;
  }
 catch (  ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}
Program: 86023
Project: 86023
Buggy source:
@POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public LayerDTO createLayer(@PathParam("String_Node_Str") String workspaceId,@PathParam("String_Node_Str") String ciId,LayerDTO layer){
  try {
    ConfigurationItemKey ciKey=new ConfigurationItemKey(workspaceId,ciId);
    Layer l=productService.createLayer(ciKey,layer.getName());
    return new LayerDTO(l.getId(),l.getName());
  }
 catch (  ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}

Fixed version (ground truth):
@POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public LayerDTO createLayer(@PathParam("String_Node_Str") String workspaceId,@PathParam("String_Node_Str") String ciId,LayerDTO layer){
  try {
    ConfigurationItemKey ciKey=new ConfigurationItemKey(workspaceId,ciId);
    Layer l=productService.createLayer(ciKey,layer.getName(),layer.getColor());
    return new LayerDTO(l.getId(),l.getName(),l.getColor());
  }
 catch (  ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}
Program: 86024
Project: 86024
Buggy source:
@PUT @Path("String_Node_Str") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public LayerDTO updateLayer(@PathParam("String_Node_Str") int layerId,@PathParam("String_Node_Str") String workspaceId,@PathParam("String_Node_Str") String ciId,LayerDTO layer){
  try {
    ConfigurationItemKey ciKey=new ConfigurationItemKey(workspaceId,ciId);
    Layer l=productService.updateLayer(ciKey,layerId,layer.getName());
    return new LayerDTO(l.getId(),l.getName());
  }
 catch (  ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}

Fixed version (ground truth):
@PUT @Path("String_Node_Str") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public LayerDTO updateLayer(@PathParam("String_Node_Str") int layerId,@PathParam("String_Node_Str") String workspaceId,@PathParam("String_Node_Str") String ciId,LayerDTO layer){
  try {
    ConfigurationItemKey ciKey=new ConfigurationItemKey(workspaceId,ciId);
    Layer l=productService.updateLayer(ciKey,layerId,layer.getName(),layer.getColor());
    return new LayerDTO(l.getId(),l.getName(),l.getColor());
  }
 catch (  ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}
Program: 86025
Project: 86025
Buggy source:
public LayerDTO(int pId,String pName){
  this.id=pId;
  this.name=pName;
}

Fixed version (ground truth):
public LayerDTO(int pId,String pName,String color){
  this.id=pId;
  this.name=pName;
  this.color=color;
}
Program: 86027
Project: 86027
Buggy source:
private DocumentMasterDTO[] getDocumentsCheckedOutByUser(String workspaceId){
  try {
    DocumentMaster[] docMs=documentService.getCheckedOutDocumentMasters(workspaceId);
    DocumentMasterDTO[] docMsDTOs=new DocumentMasterDTO[docMs.length];
    for (int i=0; i < docMs.length; i++) {
      docMsDTOs[i]=mapper.map(docMs[i],DocumentMasterDTO.class);
      docMsDTOs[i].setPath(docMs[i].getLocation().getCompletePath());
      docMsDTOs[i]=Tools.createLightDocumentMasterDTO(docMsDTOs[i]);
      docMsDTOs[i].setIterationSubscription(documentService.isUserIterationChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
      docMsDTOs[i].setStateSubscription(documentService.isUserStateChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
      ACL acl=docMs[i].getACL();
      if (acl != null) {
        docMsDTOs[i].setAcl(Tools.mapACLtoACLDTO(acl));
      }
    }
    return docMsDTOs;
  }
 catch (  com.docdoku.core.exceptions.ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}

Fixed version (ground truth):
private DocumentMasterDTO[] getDocumentsCheckedOutByUser(String workspaceId){
  try {
    DocumentMaster[] docMs=documentService.getCheckedOutDocumentMasters(workspaceId);
    DocumentMasterDTO[] docMsDTOs=new DocumentMasterDTO[docMs.length];
    for (int i=0; i < docMs.length; i++) {
      docMsDTOs[i]=mapper.map(docMs[i],DocumentMasterDTO.class);
      docMsDTOs[i].setPath(docMs[i].getLocation().getCompletePath());
      docMsDTOs[i]=Tools.createLightDocumentMasterDTO(docMsDTOs[i]);
      docMsDTOs[i].setIterationSubscription(documentService.isUserIterationChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
      docMsDTOs[i].setStateSubscription(documentService.isUserStateChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
    }
    return docMsDTOs;
  }
 catch (  com.docdoku.core.exceptions.ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}
Program: 86028
Project: 86028
Buggy source:
private DocumentMasterDTO[] getDocumentsWithGivenTagIdAndWorkspaceId(String workspaceId,String tagId){
  try {
    DocumentMaster[] docMs=documentService.findDocumentMastersByTag(new TagKey(workspaceId,tagId));
    DocumentMasterDTO[] docMsDTOs=new DocumentMasterDTO[docMs.length];
    for (int i=0; i < docMs.length; i++) {
      docMsDTOs[i]=mapper.map(docMs[i],DocumentMasterDTO.class);
      docMsDTOs[i].setPath(docMs[i].getLocation().getCompletePath());
      docMsDTOs[i]=Tools.createLightDocumentMasterDTO(docMsDTOs[i]);
      docMsDTOs[i].setIterationSubscription(documentService.isUserIterationChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
      docMsDTOs[i].setStateSubscription(documentService.isUserStateChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
      ACL acl=docMs[i].getACL();
      if (acl != null) {
        docMsDTOs[i].setAcl(Tools.mapACLtoACLDTO(acl));
      }
    }
    return docMsDTOs;
  }
 catch (  com.docdoku.core.exceptions.ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}

Fixed version (ground truth):
private DocumentMasterDTO[] getDocumentsWithGivenTagIdAndWorkspaceId(String workspaceId,String tagId){
  try {
    DocumentMaster[] docMs=documentService.findDocumentMastersByTag(new TagKey(workspaceId,tagId));
    DocumentMasterDTO[] docMsDTOs=new DocumentMasterDTO[docMs.length];
    for (int i=0; i < docMs.length; i++) {
      docMsDTOs[i]=mapper.map(docMs[i],DocumentMasterDTO.class);
      docMsDTOs[i].setPath(docMs[i].getLocation().getCompletePath());
      docMsDTOs[i]=Tools.createLightDocumentMasterDTO(docMsDTOs[i]);
      docMsDTOs[i].setIterationSubscription(documentService.isUserIterationChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
      docMsDTOs[i].setStateSubscription(documentService.isUserStateChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
    }
    return docMsDTOs;
  }
 catch (  com.docdoku.core.exceptions.ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}
Program: 86029
Project: 86029
Buggy source:
private DocumentMasterDTO[] getDocumentsInWorkspace(String workspaceId,int start){
  int maxResult=20;
  try {
    DocumentMaster[] docMs=documentService.getAllDocumentsInWorkspace(workspaceId,start,maxResult);
    DocumentMasterDTO[] docMsDTOs=new DocumentMasterDTO[docMs.length];
    for (int i=0; i < docMs.length; i++) {
      docMsDTOs[i]=mapper.map(docMs[i],DocumentMasterDTO.class);
      docMsDTOs[i].setPath(docMs[i].getLocation().getCompletePath());
      docMsDTOs[i]=Tools.createLightDocumentMasterDTO(docMsDTOs[i]);
      docMsDTOs[i].setIterationSubscription(documentService.isUserIterationChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
      docMsDTOs[i].setStateSubscription(documentService.isUserStateChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
      ACL acl=docMs[i].getACL();
      if (acl != null) {
        docMsDTOs[i].setAcl(Tools.mapACLtoACLDTO(acl));
      }
    }
    return docMsDTOs;
  }
 catch (  com.docdoku.core.exceptions.ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}

Fixed version (ground truth):
private DocumentMasterDTO[] getDocumentsInWorkspace(String workspaceId,int start){
  int maxResult=20;
  try {
    DocumentMaster[] docMs=documentService.getAllDocumentsInWorkspace(workspaceId,start,maxResult);
    DocumentMasterDTO[] docMsDTOs=new DocumentMasterDTO[docMs.length];
    for (int i=0; i < docMs.length; i++) {
      docMsDTOs[i]=mapper.map(docMs[i],DocumentMasterDTO.class);
      docMsDTOs[i].setPath(docMs[i].getLocation().getCompletePath());
      docMsDTOs[i]=Tools.createLightDocumentMasterDTO(docMsDTOs[i]);
      docMsDTOs[i].setIterationSubscription(documentService.isUserIterationChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
      docMsDTOs[i].setStateSubscription(documentService.isUserStateChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
    }
    return docMsDTOs;
  }
 catch (  com.docdoku.core.exceptions.ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}
Program: 86030
Project: 86030
Buggy source:
private DocumentMasterDTO[] getDocumentsWhereGivenUserHasAssignedTasks(String workspaceId,String assignedUserLogin,String filter){
  try {
    DocumentMaster[] docMs;
    if (filter == null) {
      docMs=documentService.getDocumentMastersWithAssignedTasksForGivenUser(workspaceId,assignedUserLogin);
    }
 else {
switch (filter) {
case "String_Node_Str":
        docMs=documentService.getDocumentMastersWithOpenedTasksForGivenUser(workspaceId,assignedUserLogin);
      break;
default :
    docMs=documentService.getDocumentMastersWithAssignedTasksForGivenUser(workspaceId,assignedUserLogin);
  break;
}
}
ArrayList<DocumentMasterDTO> docMsDTOs=new ArrayList<DocumentMasterDTO>();
for (int i=0; i < docMs.length; i++) {
DocumentMasterDTO docDTO=mapper.map(docMs[i],DocumentMasterDTO.class);
docDTO.setPath(docMs[i].getLocation().getCompletePath());
docDTO=Tools.createLightDocumentMasterDTO(docDTO);
docDTO.setIterationSubscription(documentService.isUserIterationChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
docDTO.setStateSubscription(documentService.isUserStateChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
ACL acl=docMs[i].getACL();
if (acl != null) {
docDTO.setAcl(Tools.mapACLtoACLDTO(acl));
}
docMsDTOs.add(docDTO);
}
return docMsDTOs.toArray(new DocumentMasterDTO[docMsDTOs.size()]);
}
 catch (com.docdoku.core.exceptions.ApplicationException ex) {
throw new RestApiException(ex.toString(),ex.getMessage());
}
}

Fixed version (ground truth):
private DocumentMasterDTO[] getDocumentsWhereGivenUserHasAssignedTasks(String workspaceId,String assignedUserLogin,String filter){
  try {
    DocumentMaster[] docMs;
    if (filter == null) {
      docMs=documentService.getDocumentMastersWithAssignedTasksForGivenUser(workspaceId,assignedUserLogin);
    }
 else {
switch (filter) {
case "String_Node_Str":
        docMs=documentService.getDocumentMastersWithOpenedTasksForGivenUser(workspaceId,assignedUserLogin);
      break;
default :
    docMs=documentService.getDocumentMastersWithAssignedTasksForGivenUser(workspaceId,assignedUserLogin);
  break;
}
}
ArrayList<DocumentMasterDTO> docMsDTOs=new ArrayList<DocumentMasterDTO>();
for (int i=0; i < docMs.length; i++) {
DocumentMasterDTO docDTO=mapper.map(docMs[i],DocumentMasterDTO.class);
docDTO.setPath(docMs[i].getLocation().getCompletePath());
docDTO=Tools.createLightDocumentMasterDTO(docDTO);
docDTO.setIterationSubscription(documentService.isUserIterationChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
docDTO.setStateSubscription(documentService.isUserStateChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
docMsDTOs.add(docDTO);
}
return docMsDTOs.toArray(new DocumentMasterDTO[docMsDTOs.size()]);
}
 catch (com.docdoku.core.exceptions.ApplicationException ex) {
throw new RestApiException(ex.toString(),ex.getMessage());
}
}
Program: 86031
Project: 86031
Buggy source:
private DocumentMasterDTO[] getDocumentsWithSearchQuery(String workspaceId,String pStringQuery){
  try {
    DocumentSearchQuery documentSearchQuery=SearchQueryParser.parseDocumentStringQuery(workspaceId,pStringQuery);
    DocumentMaster[] docMs=com.docdoku.core.util.Tools.resetParentReferences(documentService.searchDocumentMasters(documentSearchQuery));
    DocumentMasterDTO[] docMsDTOs=new DocumentMasterDTO[docMs.length];
    for (int i=0; i < docMs.length; i++) {
      docMsDTOs[i]=mapper.map(docMs[i],DocumentMasterDTO.class);
      docMsDTOs[i].setPath(docMs[i].getLocation().getCompletePath());
      docMsDTOs[i]=Tools.createLightDocumentMasterDTO(docMsDTOs[i]);
      docMsDTOs[i].setIterationSubscription(documentService.isUserIterationChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
      docMsDTOs[i].setStateSubscription(documentService.isUserStateChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
      ACL acl=docMs[i].getACL();
      if (acl != null) {
        docMsDTOs[i].setAcl(Tools.mapACLtoACLDTO(acl));
      }
    }
    return docMsDTOs;
  }
 catch (  com.docdoku.core.exceptions.ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}

Fixed version (ground truth):
private DocumentMasterDTO[] getDocumentsWithSearchQuery(String workspaceId,String pStringQuery){
  try {
    DocumentSearchQuery documentSearchQuery=SearchQueryParser.parseDocumentStringQuery(workspaceId,pStringQuery);
    DocumentMaster[] docMs=com.docdoku.core.util.Tools.resetParentReferences(documentService.searchDocumentMasters(documentSearchQuery));
    DocumentMasterDTO[] docMsDTOs=new DocumentMasterDTO[docMs.length];
    for (int i=0; i < docMs.length; i++) {
      docMsDTOs[i]=mapper.map(docMs[i],DocumentMasterDTO.class);
      docMsDTOs[i].setPath(docMs[i].getLocation().getCompletePath());
      docMsDTOs[i]=Tools.createLightDocumentMasterDTO(docMsDTOs[i]);
      docMsDTOs[i].setIterationSubscription(documentService.isUserIterationChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
      docMsDTOs[i].setStateSubscription(documentService.isUserStateChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
    }
    return docMsDTOs;
  }
 catch (  com.docdoku.core.exceptions.ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}
Program: 86032
Project: 86032
Buggy source:
private DocumentMasterDTO[] getDocumentsWithGivenFolderIdAndWorkspaceId(String workspaceId,String folderId){
  try {
    String decodedCompletePath=getPathFromUrlParams(workspaceId,folderId);
    DocumentMaster[] docMs=documentService.findDocumentMastersByFolder(decodedCompletePath);
    DocumentMasterDTO[] docMsDTOs=new DocumentMasterDTO[docMs.length];
    for (int i=0; i < docMs.length; i++) {
      docMsDTOs[i]=mapper.map(docMs[i],DocumentMasterDTO.class);
      docMsDTOs[i].setPath(docMs[i].getLocation().getCompletePath());
      docMsDTOs[i]=Tools.createLightDocumentMasterDTO(docMsDTOs[i]);
      docMsDTOs[i].setLifeCycleState(docMs[i].getLifeCycleState());
      docMsDTOs[i].setIterationSubscription(documentService.isUserIterationChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
      docMsDTOs[i].setStateSubscription(documentService.isUserStateChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
      ACL acl=docMs[i].getACL();
      if (acl != null) {
        docMsDTOs[i].setAcl(Tools.mapACLtoACLDTO(acl));
      }
    }
    return docMsDTOs;
  }
 catch (  com.docdoku.core.exceptions.ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}

Fixed version (ground truth):
private DocumentMasterDTO[] getDocumentsWithGivenFolderIdAndWorkspaceId(String workspaceId,String folderId){
  try {
    String decodedCompletePath=getPathFromUrlParams(workspaceId,folderId);
    DocumentMaster[] docMs=documentService.findDocumentMastersByFolder(decodedCompletePath);
    DocumentMasterDTO[] docMsDTOs=new DocumentMasterDTO[docMs.length];
    for (int i=0; i < docMs.length; i++) {
      docMsDTOs[i]=mapper.map(docMs[i],DocumentMasterDTO.class);
      docMsDTOs[i].setPath(docMs[i].getLocation().getCompletePath());
      docMsDTOs[i]=Tools.createLightDocumentMasterDTO(docMsDTOs[i]);
      docMsDTOs[i].setLifeCycleState(docMs[i].getLifeCycleState());
      docMsDTOs[i].setIterationSubscription(documentService.isUserIterationChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
      docMsDTOs[i].setStateSubscription(documentService.isUserStateChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
    }
    return docMsDTOs;
  }
 catch (  com.docdoku.core.exceptions.ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}
Program: 86033
Project: 86033
Buggy source:
public static DocumentMasterDTO createLightDocumentMasterDTO(DocumentMasterDTO docMsDTO){
  if (docMsDTO.getLastIteration() != null) {
    DocumentIterationDTO lastIteration=docMsDTO.getLastIteration();
    List<DocumentIterationDTO> iterations=new ArrayList<DocumentIterationDTO>();
    iterations.add(lastIteration);
    docMsDTO.setDocumentIterations(iterations);
  }
  docMsDTO.setTags(null);
  docMsDTO.setWorkflow(null);
  docMsDTO.setAcl(null);
  return docMsDTO;
}

Fixed version (ground truth):
public static DocumentMasterDTO createLightDocumentMasterDTO(DocumentMasterDTO docMsDTO){
  if (docMsDTO.getLastIteration() != null) {
    DocumentIterationDTO lastIteration=docMsDTO.getLastIteration();
    List<DocumentIterationDTO> iterations=new ArrayList<DocumentIterationDTO>();
    iterations.add(lastIteration);
    docMsDTO.setDocumentIterations(iterations);
  }
  docMsDTO.setTags(null);
  docMsDTO.setWorkflow(null);
  return docMsDTO;
}
Program: 86034
Project: 86034
Buggy source:
@Override public ACLDTO convertTo(ACL acl,ACLDTO aclDTO){
  aclDTO=new ACLDTO();
  if (acl != null) {
    for (    Map.Entry<User,ACLUserEntry> entry : acl.getUserEntries().entrySet()) {
      ACLUserEntry aclEntry=entry.getValue();
      aclDTO.addUserEntry(aclEntry.getPrincipalLogin(),aclEntry.getPermission());
    }
    for (    Map.Entry<UserGroup,ACLUserGroupEntry> entry : acl.getGroupEntries().entrySet()) {
      ACLUserGroupEntry aclEntry=entry.getValue();
      aclDTO.addGroupEntry(aclEntry.getPrincipalId(),aclEntry.getPermission());
    }
  }
  return aclDTO;
}

Fixed version (ground truth):
@Override public ACLDTO convertTo(ACL acl,ACLDTO aclDTO){
  aclDTO=new ACLDTO();
  if (acl != null) {
    for (    Map.Entry<User,ACLUserEntry> entry : acl.getUserEntries().entrySet()) {
      ACLUserEntry aclEntry=entry.getValue();
      aclDTO.addUserEntry(aclEntry.getPrincipalLogin(),aclEntry.getPermission());
    }
    for (    Map.Entry<UserGroup,ACLUserGroupEntry> entry : acl.getGroupEntries().entrySet()) {
      ACLUserGroupEntry aclEntry=entry.getValue();
      aclDTO.addGroupEntry(aclEntry.getPrincipalId(),aclEntry.getPermission());
    }
    return aclDTO;
  }
  return null;
}
Program: 86036
Project: 86036
Buggy source:
public void onProgressUpdate(int progress);

Fixed version (ground truth):
@Override public void onProgressUpdate(Integer... values){
  float progress=values[0];
  float size=values[1];
  float advancement=progress / size * 100;
  if (listener != null) {
    listener.onUploadProgressUpdate((int)advancement);
  }
}
Program: 86037
Project: 86037
Buggy source:
public PhoneNumber(String number,String type){
  this.number=number;
  this.type=type;
}

Fixed version (ground truth):
public PhoneNumber(String number,String type,int typeCode){
  this.number=number;
  this.type=type;
  this.typeCode=typeCode;
}
Program: 86038
Project: 86038
Buggy source:
/** 
 * Searches the phone number provided for this <code>User</code>. If a mobile phone number is found, returns it. Otherwise, if a phone number is found, returns the first one in the <code>ArrayList</code>. If no phone numbers are found, returns an empty <code>String</code>.
 * @return the best phone number found for contact
 */
public String getPhoneNumber(){
  for (  PhoneNumber phoneNumber : phoneNumbers) {
    if (phoneNumber.type.equals(ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE)) {
      Log.i(LOG_TAG,"String_Node_Str" + name);
      return phoneNumber.getNumber();
    }
  }
  try {
    return phoneNumbers.get(0).getNumber();
  }
 catch (  IndexOutOfBoundsException e) {
    Log.i(LOG_TAG,"String_Node_Str");
    return "String_Node_Str";
  }
}

Fixed version (ground truth):
/** 
 * Searches the phone number provided for this <code>User</code>. If a mobile phone number is found, returns it. Otherwise, if a phone number is found, returns the first one in the <code>ArrayList</code>. If no phone numbers are found, returns an empty <code>String</code>.
 * @return the best phone number found for contact
 */
public String getPhoneNumber(){
  for (  PhoneNumber phoneNumber : phoneNumbers) {
    if (phoneNumber.typeCode == ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE) {
      Log.i(LOG_TAG,"String_Node_Str" + name);
      return phoneNumber.getNumber();
    }
  }
  try {
    return phoneNumbers.get(0).getNumber();
  }
 catch (  IndexOutOfBoundsException e) {
    Log.i(LOG_TAG,"String_Node_Str");
    return "String_Node_Str";
  }
}
Program: 86039
Project: 86039
Buggy source:
/** 
 * Add a phone number belonging to a contact on the phone to this user
 * @param number the phone number
 * @param type the type of phone number (mobile, home, ...)
 */
public void addPhoneNumber(String number,String type){
  phoneNumbers.add(new PhoneNumber(number,type));
}

Fixed version (ground truth):
/** 
 * Add a phone number belonging to a contact on the phone to this user
 * @param number the phone number
 * @param type the type of phone number (mobile, home, ...)
 * @param typeCode
 */
public void addPhoneNumber(String number,String type,int typeCode){
  phoneNumbers.add(new PhoneNumber(number,type,typeCode));
}
Program: 86041
Project: 86041
Buggy source:
@Override public boolean isEnabled(int position){
  Document document=documents.get(position);
  if (document == null || document.getAuthor() == null) {
    return false;
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
@Override public boolean isEnabled(int position){
  try {
    Document document=documents.get(position);
    if (document == null || document.getAuthor() == null) {
      return false;
    }
 else {
      return true;
    }
  }
 catch (  IndexOutOfBoundsException e) {
    return false;
  }
}
Program: 86042
Project: 86042
Buggy source:
@Override public boolean isEnabled(int position){
  Part part=parts.get(position);
  if (part == null || part.getAuthor() == null) {
    return false;
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
@Override public boolean isEnabled(int position){
  try {
    Part part=parts.get(position);
    if (part == null || part.getAuthor() == null) {
      return false;
    }
 else {
      return true;
    }
  }
 catch (  IndexOutOfBoundsException e) {
    return false;
  }
}
Program: 86045
Project: 86045
Buggy source:
public static int extractPortFromUrl(String url){
  String finalUrl=url;
  if (finalUrl.substring(0,7).equals("String_Node_Str")) {
    finalUrl=finalUrl.substring(7,finalUrl.length());
  }
  int semicolonIndex=finalUrl.indexOf(':');
  if (semicolonIndex != -1) {
    String portString=finalUrl.substring(semicolonIndex + 1);
    int port=Integer.parseInt(portString);
    Log.i("String_Node_Str","String_Node_Str" + port);
    return Integer.parseInt(portString);
  }
  return -1;
}

Fixed version (ground truth):
public static int extractPortFromUrl(String url){
  String finalUrl=url;
  if (finalUrl != null && finalUrl.length() > 0) {
    if (finalUrl.length() > 7 && finalUrl.substring(0,7).equals("String_Node_Str")) {
      finalUrl=finalUrl.substring(7,finalUrl.length());
    }
    int semicolonIndex=finalUrl.indexOf(':');
    if (semicolonIndex != -1) {
      String portString=finalUrl.substring(semicolonIndex + 1);
      int port=Integer.parseInt(portString);
      Log.i("String_Node_Str","String_Node_Str" + port);
      return Integer.parseInt(portString);
    }
  }
  return -1;
}
Program: 86046
Project: 86046
Buggy source:
public static String extractHostFromUrl(String url){
  String finalUrl=url;
  if (finalUrl.substring(0,7).equals("String_Node_Str")) {
    finalUrl=finalUrl.substring(7,finalUrl.length());
  }
  int semicolonIndex=finalUrl.indexOf(':');
  if (semicolonIndex != -1) {
    finalUrl=finalUrl.substring(0,semicolonIndex);
  }
  if (finalUrl.charAt(finalUrl.length() - 1) == '/') {
    finalUrl=finalUrl.substring(0,finalUrl.length() - 1);
  }
  return finalUrl;
}

Fixed version (ground truth):
public static String extractHostFromUrl(String url){
  String finalUrl=url;
  if (finalUrl != null && finalUrl.length() > 0) {
    if (finalUrl.length() > 7 && finalUrl.substring(0,7).equals("String_Node_Str")) {
      finalUrl=finalUrl.substring(7,finalUrl.length());
    }
    int semicolonIndex=finalUrl.indexOf(':');
    if (semicolonIndex != -1) {
      finalUrl=finalUrl.substring(0,semicolonIndex);
    }
    if (finalUrl.charAt(finalUrl.length() - 1) == '/') {
      finalUrl=finalUrl.substring(0,finalUrl.length() - 1);
    }
  }
  return finalUrl;
}
Program: 86049
Project: 86049
Buggy source:
private boolean checkForWorkspaces(){
  if (DOWNLOADED_WORKSPACES == null) {
    SharedPreferences preferences=getActivity().getPreferences(Context.MODE_PRIVATE);
    Set<String> workspacesSet=preferences.getStringSet(PREFERENCE_KEY_DOWNLOADED_WORKSPACES,new HashSet<String>());
    DOWNLOADED_WORKSPACES=new String[workspacesSet.size()];
    Iterator<String> iterator=workspacesSet.iterator();
    int i=0;
    while (iterator.hasNext()) {
      String workspace=iterator.next();
      DOWNLOADED_WORKSPACES[i]=workspace;
      i++;
    }
  }
  if (DOWNLOADED_WORKSPACES.length == 0) {
    ((ViewGroup)expandRadioButtons.getParent()).removeView(expandRadioButtons);
    Log.e("String_Node_Str","String_Node_Str");
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean checkForWorkspaces(){
  if (DOWNLOADED_WORKSPACES == null) {
    SharedPreferences preferences=getActivity().getPreferences(Context.MODE_PRIVATE);
    Set<String> workspacesSet=preferences.getStringSet(PREFERENCE_KEY_DOWNLOADED_WORKSPACES,new HashSet<String>());
    DOWNLOADED_WORKSPACES=new String[workspacesSet.size()];
    Iterator<String> iterator=workspacesSet.iterator();
    int i=0;
    while (iterator.hasNext()) {
      String workspace=iterator.next();
      DOWNLOADED_WORKSPACES[i]=workspace;
      i++;
    }
  }
  if (DOWNLOADED_WORKSPACES.length == 0) {
    if (expandRadioButtons != null) {
      ((ViewGroup)expandRadioButtons.getParent()).removeView(expandRadioButtons);
      Log.e("String_Node_Str","String_Node_Str");
    }
    return false;
  }
  return true;
}
Program: 86055
Project: 86055
Buggy source:
public void logIn() throws ServletException, AccountNotFoundException, IOException {
  HttpServletRequest request=(HttpServletRequest)(FacesContext.getCurrentInstance().getExternalContext().getRequest());
  HttpSession session=(HttpSession)request.getSession();
  request.login(login,password);
  Account account=userManager.getAccount(login);
  if (!login.equals(account.getLogin())) {
    request.logout();
    throw new AccountNotFoundException(new Locale(account.getLanguage()),login);
  }
  session.setAttribute("String_Node_Str",account);
  Map<String,Workspace> administeredWorkspaces=new HashMap<String,Workspace>();
  for (  Workspace wks : userManager.getAdministratedWorkspaces()) {
    administeredWorkspaces.put(wks.getId(),wks);
  }
  session.setAttribute("String_Node_Str",administeredWorkspaces);
  Set<Workspace> regularWorkspaces=new HashSet<Workspace>();
  regularWorkspaces.addAll(Arrays.asList(userManager.getWorkspaces()));
  regularWorkspaces.removeAll(administeredWorkspaces.values());
  session.setAttribute("String_Node_Str",regularWorkspaces);
  FacesContext fc=FacesContext.getCurrentInstance();
  ExternalContext ec=fc.getExternalContext();
  if (originURL != null && originURL.length() > 1)   ec.redirect(URLDecoder.decode(originURL,"String_Node_Str"));
 else   ec.redirect(request.getContextPath() + "String_Node_Str");
}

Fixed version (ground truth):
public void logIn() throws ServletException, AccountNotFoundException, IOException {
  HttpServletRequest request=(HttpServletRequest)(FacesContext.getCurrentInstance().getExternalContext().getRequest());
  HttpSession session=(HttpSession)request.getSession();
  request.login(login,password);
  Account account=userManager.getAccount(login);
  if (!login.equals(account.getLogin())) {
    request.logout();
    throw new AccountNotFoundException(new Locale(account.getLanguage()),login);
  }
  session.setAttribute("String_Node_Str",account);
  Map<String,Workspace> administeredWorkspaces=new HashMap<String,Workspace>();
  for (  Workspace wks : userManager.getAdministratedWorkspaces()) {
    administeredWorkspaces.put(wks.getId(),wks);
  }
  session.setAttribute("String_Node_Str",administeredWorkspaces);
  Set<Workspace> regularWorkspaces=new HashSet<Workspace>();
  regularWorkspaces.addAll(Arrays.asList(userManager.getWorkspaces()));
  regularWorkspaces.removeAll(administeredWorkspaces.values());
  session.setAttribute("String_Node_Str",regularWorkspaces);
  FacesContext fc=FacesContext.getCurrentInstance();
  ExternalContext ec=fc.getExternalContext();
  if (originURL != null && originURL.length() > 1)   ec.redirect(originURL);
 else   ec.redirect(request.getContextPath() + "String_Node_Str");
}
Program: 86056
Project: 86056
Buggy source:
@Override protected void doGet(HttpServletRequest pRequest,HttpServletResponse pResponse) throws ServletException, IOException {
  String login=pRequest.getRemoteUser();
  String[] pathInfos=Pattern.compile("String_Node_Str").split(pRequest.getRequestURI());
  int offset;
  if (pRequest.getContextPath().equals("String_Node_Str")) {
    offset=2;
  }
 else {
    offset=3;
  }
  String workspaceID=null;
  String productID=null;
  try {
    workspaceID=URLDecoder.decode(pathInfos[offset],"String_Node_Str");
  }
 catch (  IndexOutOfBoundsException ex) {
  }
  try {
    productID=URLDecoder.decode(pathInfos[offset + 1],"String_Node_Str");
  }
 catch (  IndexOutOfBoundsException ex) {
  }
  if (workspaceID == null) {
    pResponse.sendRedirect(pRequest.getContextPath() + "String_Node_Str");
  }
 else   if (productID == null) {
    pResponse.sendRedirect(pRequest.getContextPath() + "String_Node_Str");
  }
 else {
    pRequest.setAttribute("String_Node_Str",getUrlRoot(pRequest));
    List<ConfigurationItem> products=null;
    try {
      products=productService.getConfigurationItems(workspaceID);
    }
 catch (    Exception ex) {
    }
    pRequest.setAttribute("String_Node_Str",products);
    pRequest.setAttribute("String_Node_Str",workspaceID);
    pRequest.setAttribute("String_Node_Str",productID);
    pRequest.setAttribute("String_Node_Str",login);
    pRequest.getRequestDispatcher("String_Node_Str").forward(pRequest,pResponse);
  }
}

Fixed version (ground truth):
@Override protected void doGet(HttpServletRequest pRequest,HttpServletResponse pResponse) throws ServletException, IOException {
  String login=pRequest.getRemoteUser();
  String[] pathInfos=Pattern.compile("String_Node_Str").split(pRequest.getRequestURI());
  int offset;
  if (pRequest.getContextPath().equals("String_Node_Str")) {
    offset=2;
  }
 else {
    offset=3;
  }
  String workspaceID=null;
  String productID=null;
  try {
    workspaceID=URLDecoder.decode(pathInfos[offset],"String_Node_Str");
  }
 catch (  IndexOutOfBoundsException ex) {
  }
  try {
    productID=URLDecoder.decode(pathInfos[offset + 1],"String_Node_Str");
  }
 catch (  IndexOutOfBoundsException ex) {
  }
  if (workspaceID == null) {
    pResponse.sendRedirect(pRequest.getContextPath() + "String_Node_Str");
  }
 else   if (productID == null) {
    pResponse.sendRedirect(pRequest.getContextPath() + "String_Node_Str");
  }
 else {
    pRequest.setAttribute("String_Node_Str",getUrlRoot(pRequest));
    pRequest.setAttribute("String_Node_Str",workspaceID);
    pRequest.setAttribute("String_Node_Str",productID);
    pRequest.setAttribute("String_Node_Str",login);
    pRequest.getRequestDispatcher("String_Node_Str").forward(pRequest,pResponse);
  }
}
Program: 86057
Project: 86057
Buggy source:
public void execImpl() throws Exception {
  productS=ScriptingTools.createProductService(getServerURL(),user,password);
  getPart(partNumber,revision.toString(),iteration);
}

Fixed version (ground truth):
public void execImpl() throws Exception {
  productS=ScriptingTools.createProductService(getServerURL(),user,password);
  String strRevision=revision == null ? null : revision.toString();
  getPart(partNumber,strRevision,iteration);
}
Program: 86059
Project: 86059
Buggy source:
PartRevision updatePartIteration(PartIterationKey pKey,java.lang.String pIterationNote,PartIteration.Source source,java.util.List<PartUsageLink> pUsageLinks,java.util.List<InstanceAttribute> pAttributes) throws UserNotFoundException, WorkspaceNotFoundException, AccessRightException, NotAllowedException, PartRevisionNotFoundException ;

Fixed version (ground truth):
PartRevision updatePartIteration(PartIterationKey pKey,java.lang.String pIterationNote,PartIteration.Source source,java.util.List<PartUsageLink> pUsageLinks,java.util.List<InstanceAttribute> pAttributes) throws UserNotFoundException, WorkspaceNotFoundException, AccessRightException, NotAllowedException, PartRevisionNotFoundException, PartMasterNotFoundException ;
Program: 86060
Project: 86060
Buggy source:
/** 
 * Updates the specified <a href="PartIteration.html">PartIteration</a> with the properties passed as parameters. The corresponding part revision should be in checkout state.
 * @param key The id of the part iteration to modify
 * @param iterationNote A note to describe the iteration and thus the modifications made to the part
 * @param source The <a href="PartIteration.Source.html">PartIteration.Source</a> attribute of the part
 * @param usageLinks Links to other parts. Only assembly parts can define usage links
 * @param attributes Custom attributes that may be added to the part
 * @return The <a href="PartRevision.html">PartRevision</a> of the updated part iteration
 * @throws UserNotFoundException
 * @throws WorkspaceNotFoundException
 * @throws AccessRightException
 * @throws NotAllowedException
 * @throws PartRevisionNotFoundException
 */
PartRevision updatePartIteration(PartIterationKey key,java.lang.String iterationNote,PartIteration.Source source,java.util.List<PartUsageLink> usageLinks,java.util.List<InstanceAttribute> attributes) throws UserNotFoundException, WorkspaceNotFoundException, AccessRightException, NotAllowedException, PartRevisionNotFoundException ;

Fixed version (ground truth):
/** 
 * Updates the specified <a href="PartIteration.html">PartIteration</a> with the properties passed as parameters. The corresponding part revision should be in checkout state.
 * @param key The id of the part iteration to modify
 * @param iterationNote A note to describe the iteration and thus the modifications made to the part
 * @param source The <a href="PartIteration.Source.html">PartIteration.Source</a> attribute of the part
 * @param usageLinks Links to other parts. Only assembly parts can define usage links
 * @param attributes Custom attributes that may be added to the part
 * @return The <a href="PartRevision.html">PartRevision</a> of the updated part iteration
 * @throws UserNotFoundException
 * @throws WorkspaceNotFoundException
 * @throws AccessRightException
 * @throws NotAllowedException
 * @throws PartRevisionNotFoundException
 * @throws PartMasterNotFoundException
 */
PartRevision updatePartIteration(PartIterationKey key,java.lang.String iterationNote,PartIteration.Source source,java.util.List<PartUsageLink> usageLinks,java.util.List<InstanceAttribute> attributes) throws UserNotFoundException, WorkspaceNotFoundException, AccessRightException, NotAllowedException, PartRevisionNotFoundException, PartMasterNotFoundException ;
Program: 86062
Project: 86062
Buggy source:
private PartMaster filterLatestConfigSpec(PartMaster root,int depth){
  PartRevision partR=root.getLastRevision();
  PartIteration partI=null;
  if (partR != null) {
    partI=partR.getLastIteration();
  }
  em.detach(root);
  if (root.getPartRevisions().size() > 1) {
    root.getPartRevisions().retainAll(Collections.singleton(partR));
  }
  if (partR != null && partR.getNumberOfIterations() > 1) {
    partR.getPartIterations().retainAll(Collections.singleton(partI));
  }
  if (partI != null) {
    if (depth != 0) {
      depth--;
      for (      PartUsageLink usageLink : partI.getComponents()) {
        filterLatestConfigSpec(usageLink.getComponent(),depth);
        for (        PartSubstituteLink subLink : usageLink.getSubstitutes()) {
          filterLatestConfigSpec(subLink.getSubstitute(),0);
        }
      }
    }
  }
  for (  PartAlternateLink alternateLink : root.getAlternates()) {
    filterLatestConfigSpec(alternateLink.getAlternate(),0);
  }
  return root;
}

Fixed version (ground truth):
private PartMaster filterLatestConfigSpec(PartMaster root,int depth){
  PartRevision partR=root.getLastRevision();
  PartIteration partI=null;
  if (partR != null) {
    partI=partR.getLastIteration();
  }
  if (partI != null) {
    if (depth != 0) {
      depth--;
      for (      PartUsageLink usageLink : partI.getComponents()) {
        filterLatestConfigSpec(usageLink.getComponent(),depth);
        for (        PartSubstituteLink subLink : usageLink.getSubstitutes()) {
          filterLatestConfigSpec(subLink.getSubstitute(),0);
        }
      }
    }
  }
  for (  PartAlternateLink alternateLink : root.getAlternates()) {
    filterLatestConfigSpec(alternateLink.getAlternate(),0);
  }
  em.detach(root);
  if (root.getPartRevisions().size() > 1) {
    root.getPartRevisions().retainAll(Collections.singleton(partR));
  }
  if (partR != null && partR.getNumberOfIterations() > 1) {
    partR.getPartIterations().retainAll(Collections.singleton(partI));
  }
  return root;
}
Program: 86064
Project: 86064
Buggy source:
@GET @Produces("String_Node_Str") public DocumentMasterDTO getDocumentMaster(@PathParam("String_Node_Str") String workspaceId,@PathParam("String_Node_Str") String docKey){
  int lastDash=docKey.lastIndexOf('-');
  String id=docKey.substring(0,lastDash);
  String version=docKey.substring(lastDash + 1,docKey.length());
  try {
    DocumentMaster docM=documentService.getDocumentMaster(new DocumentMasterKey(workspaceId,id,version));
    DocumentMasterDTO docMsDTO=mapper.map(docM,DocumentMasterDTO.class);
    docMsDTO.setPath(docM.getLocation().getCompletePath());
    docMsDTO.setLifeCycleState(docM.getLifeCycleState());
    return docMsDTO;
  }
 catch (  com.docdoku.core.services.ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}

Fixed version (ground truth):
@GET @Produces("String_Node_Str") public DocumentMasterDTO getDocumentMaster(@PathParam("String_Node_Str") String workspaceId,@PathParam("String_Node_Str") String docKey){
  int lastDash=docKey.lastIndexOf('-');
  String id=docKey.substring(0,lastDash);
  String version=docKey.substring(lastDash + 1,docKey.length());
  try {
    DocumentMaster docM=documentService.getDocumentMaster(new DocumentMasterKey(workspaceId,id,version));
    DocumentMasterDTO docMsDTO=mapper.map(docM,DocumentMasterDTO.class);
    docMsDTO.setPath(docM.getLocation().getCompletePath());
    docMsDTO.setLifeCycleState(docM.getLifeCycleState());
    docMsDTO.setIterationSubscription(documentService.isUserIterationChangeEventSubscribedForGivenDocument(workspaceId,docM));
    docMsDTO.setStateSubscription(documentService.isUserStateChangeEventSubscribedForGivenDocument(workspaceId,docM));
    return docMsDTO;
  }
 catch (  com.docdoku.core.services.ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}
Program: 86065
Project: 86065
Buggy source:
@GET @Path("String_Node_Str") @Produces("String_Node_Str") public DocumentMasterDTO[] getCheckedOutDocMs(@PathParam("String_Node_Str") String workspaceId) throws ApplicationException {
  try {
    DocumentMaster[] checkedOutdocMs=documentService.getCheckedOutDocumentMasters(workspaceId);
    DocumentMasterDTO[] checkedOutdocMsDTO=new DocumentMasterDTO[checkedOutdocMs.length];
    for (int i=0; i < checkedOutdocMs.length; i++) {
      checkedOutdocMsDTO[i]=mapper.map(checkedOutdocMs[i],DocumentMasterDTO.class);
      checkedOutdocMsDTO[i].setPath(checkedOutdocMs[i].getLocation().getCompletePath());
      checkedOutdocMsDTO[i]=Tools.createLightDocumentMasterDTO(checkedOutdocMsDTO[i]);
    }
    return checkedOutdocMsDTO;
  }
 catch (  com.docdoku.core.services.ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") @Produces("String_Node_Str") public DocumentMasterDTO[] getCheckedOutDocMs(@PathParam("String_Node_Str") String workspaceId) throws ApplicationException {
  try {
    DocumentMaster[] checkedOutdocMs=documentService.getCheckedOutDocumentMasters(workspaceId);
    DocumentMasterDTO[] checkedOutdocMsDTO=new DocumentMasterDTO[checkedOutdocMs.length];
    for (int i=0; i < checkedOutdocMs.length; i++) {
      checkedOutdocMsDTO[i]=mapper.map(checkedOutdocMs[i],DocumentMasterDTO.class);
      checkedOutdocMsDTO[i].setPath(checkedOutdocMs[i].getLocation().getCompletePath());
      checkedOutdocMsDTO[i]=Tools.createLightDocumentMasterDTO(checkedOutdocMsDTO[i]);
      checkedOutdocMsDTO[i].setIterationSubscription(documentService.isUserIterationChangeEventSubscribedForGivenDocument(workspaceId,checkedOutdocMs[i]));
      checkedOutdocMsDTO[i].setStateSubscription(documentService.isUserStateChangeEventSubscribedForGivenDocument(workspaceId,checkedOutdocMs[i]));
    }
    return checkedOutdocMsDTO;
  }
 catch (  com.docdoku.core.services.ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}
Program: 86066
Project: 86066
Buggy source:
private DocumentMasterDTO[] getDocumentsWithGivenTagIdAndWorkspaceId(String workspaceId,String tagId){
  try {
    DocumentMaster[] docMs=documentService.findDocumentMastersByTag(new TagKey(workspaceId,tagId));
    DocumentMasterDTO[] docMsDTOs=new DocumentMasterDTO[docMs.length];
    for (int i=0; i < docMs.length; i++) {
      docMsDTOs[i]=mapper.map(docMs[i],DocumentMasterDTO.class);
      docMsDTOs[i]=Tools.createLightDocumentMasterDTO(docMsDTOs[i]);
    }
    return docMsDTOs;
  }
 catch (  com.docdoku.core.services.ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}

Fixed version (ground truth):
private DocumentMasterDTO[] getDocumentsWithGivenTagIdAndWorkspaceId(String workspaceId,String tagId){
  try {
    DocumentMaster[] docMs=documentService.findDocumentMastersByTag(new TagKey(workspaceId,tagId));
    DocumentMasterDTO[] docMsDTOs=new DocumentMasterDTO[docMs.length];
    for (int i=0; i < docMs.length; i++) {
      docMsDTOs[i]=mapper.map(docMs[i],DocumentMasterDTO.class);
      docMsDTOs[i]=Tools.createLightDocumentMasterDTO(docMsDTOs[i]);
      docMsDTOs[i].setIterationSubscription(documentService.isUserIterationChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
      docMsDTOs[i].setStateSubscription(documentService.isUserStateChangeEventSubscribedForGivenDocument(workspaceId,docMs[i]));
    }
    return docMsDTOs;
  }
 catch (  com.docdoku.core.services.ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}