nus-yam/ex-repair huggingface dataset:
Program: 86067
Project: 86067
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]);
    }
    return docMsDTOs;
  }
 catch (  com.docdoku.core.services.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].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());
  }
}
Program: 86068
Project: 86068
Buggy source:
@Override public void init(ServletConfig config) throws ServletException {
  Logger.getLogger(MainChannelSocketServlet.class.getName()).log(Level.SEVERE,"String_Node_Str");
  WebSocketEngine.getEngine().register(config.getServletContext().getContextPath() + "String_Node_Str",app);
  app.setUserManager(userManager);
}

Fixed version (ground truth):
@Override public void init(ServletConfig config) throws ServletException {
  WebSocketEngine.getEngine().register(config.getServletContext().getContextPath() + "String_Node_Str",app);
  app.setUserManager(userManager);
}
Program: 86069
Project: 86069
Buggy source:
@Override public void destroy(){
  System.out.println("String_Node_Str");
  WebSocketEngine.getEngine().unregister(app);
}

Fixed version (ground truth):
@Override public void destroy(){
  WebSocketEngine.getEngine().unregister(app);
}
Program: 86070
Project: 86070
Buggy source:
private void onWebRTCAcceptMessage(String callerLogin,JSONObject jsobj) throws JSONException {
  String remoteUser=jsobj.getString("String_Node_Str");
  String roomKey=jsobj.getString("String_Node_Str");
  Room room=Room.getByKeyName(roomKey);
  if (room != null) {
    room.addUser(callerLogin);
    boolean sent=send(remoteUser,ChatMessagesBuilder.BuildWebRTCAcceptMessage(callerLogin,room.key()));
  }
 else {
  }
}

Fixed version (ground truth):
private void onWebRTCAcceptMessage(String callerLogin,JSONObject jsobj) throws JSONException {
  String remoteUser=jsobj.getString("String_Node_Str");
  String roomKey=jsobj.getString("String_Node_Str");
  Room room=Room.getByKeyName(roomKey);
  if (room != null && room.hasUser(remoteUser)) {
    room.addUser(callerLogin);
    boolean sent=send(remoteUser,ChatMessagesBuilder.BuildWebRTCAcceptMessage(callerLogin,room.key()));
  }
 else {
  }
}
Program: 86071
Project: 86071
Buggy source:
@Override public void onMessage(WebSocket socket,String data){
  MainChannelWebSocket ws=(MainChannelWebSocket)socket;
  if (data.startsWith("String_Node_Str") && ws.getUserLogin() == null) {
    onPeerDeclarationMessage(data,ws);
  }
 else {
    String callerLogin=ws.getUserLogin();
    try {
      JSONObject jsobj=new JSONObject(data);
      String type=jsobj.getString("String_Node_Str");
switch (type) {
case ChannelMessagesType.USER_STATUS:
        onUserStatusRequestMessage(callerLogin,jsobj);
      break;
case ChannelMessagesType.WEBRTC_INVITE:
    onWebRTCInviteMessage(callerLogin,jsobj);
  break;
case ChannelMessagesType.WEBRTC_ACCEPT:
onWebRTCAcceptMessage(callerLogin,jsobj);
break;
case ChannelMessagesType.WEBRTC_REJECT:
onWebRTCRejectMessage(callerLogin,jsobj);
break;
case ChannelMessagesType.WEBRTC_HANGUP:
onWebRTCHangupMessage(callerLogin,jsobj);
break;
case ChannelMessagesType.WEBRTC_ANSWER:
case ChannelMessagesType.WEBRTC_OFFER:
case ChannelMessagesType.WEBRTC_CANDIDATE:
case ChannelMessagesType.WEBRTC_BYE:
onWebRTCSignalingMessage(callerLogin,jsobj,data);
break;
case ChannelMessagesType.CHAT_MESSAGE:
onChatMessage(callerLogin,jsobj);
break;
default :
onUnrecognizedMessageType(callerLogin);
break;
}
}
 catch (JSONException ex) {
send(callerLogin,ChatMessagesBuilder.BuildJsonExMessage());
}
}
}

Fixed version (ground truth):
@Override public void onMessage(WebSocket socket,String data){
  MainChannelWebSocket ws=(MainChannelWebSocket)socket;
  if (data.startsWith("String_Node_Str") && ws.getUserLogin() == null) {
    onPeerDeclarationMessage(data,ws);
  }
 else {
    String callerLogin=ws.getUserLogin();
    try {
      JSONObject jsobj=new JSONObject(data);
      String type=jsobj.getString("String_Node_Str");
switch (type) {
case ChannelMessagesType.USER_STATUS:
        onUserStatusRequestMessage(callerLogin,jsobj);
      break;
case ChannelMessagesType.WEBRTC_INVITE:
    onWebRTCInviteMessage(callerLogin,jsobj);
  break;
case ChannelMessagesType.WEBRTC_INVITE_TIMEOUT:
onWebRTCInviteTimeoutMessage(callerLogin,jsobj);
break;
case ChannelMessagesType.WEBRTC_ACCEPT:
onWebRTCAcceptMessage(callerLogin,jsobj);
break;
case ChannelMessagesType.WEBRTC_REJECT:
onWebRTCRejectMessage(callerLogin,jsobj);
break;
case ChannelMessagesType.WEBRTC_HANGUP:
onWebRTCHangupMessage(callerLogin,jsobj);
break;
case ChannelMessagesType.WEBRTC_ANSWER:
case ChannelMessagesType.WEBRTC_OFFER:
case ChannelMessagesType.WEBRTC_CANDIDATE:
case ChannelMessagesType.WEBRTC_BYE:
onWebRTCSignalingMessage(callerLogin,jsobj,data,type);
break;
case ChannelMessagesType.CHAT_MESSAGE:
onChatMessage(callerLogin,jsobj);
break;
default :
onUnrecognizedMessageType(callerLogin);
break;
}
}
 catch (JSONException ex) {
send(callerLogin,ChatMessagesBuilder.BuildJsonExMessage());
}
}
Room.debug();
}
Program: 86072
Project: 86072
Buggy source:
private void onWebRTCSignalingMessage(String callerLogin,JSONObject jsobj,String data) throws JSONException {
  String roomKey=jsobj.getString("String_Node_Str");
  Room room=Room.getByKeyName(roomKey);
  if (room != null) {
    if (room.hasUser(callerLogin)) {
      String remoteUser=room.getOtherUser(callerLogin);
      if (remoteUser != null) {
        send(remoteUser,data);
      }
 else {
      }
    }
 else {
    }
  }
 else {
  }
}

Fixed version (ground truth):
private void onWebRTCSignalingMessage(String callerLogin,JSONObject jsobj,String data,String messageType) throws JSONException {
  String roomKey=jsobj.getString("String_Node_Str");
  Room room=Room.getByKeyName(roomKey);
  if (room != null) {
    if (room.hasUser(callerLogin)) {
      String remoteUser=room.getOtherUser(callerLogin);
      if (remoteUser != null) {
        send(remoteUser,data);
        if (messageType.equals(ChannelMessagesType.WEBRTC_BYE)) {
          room.removeUser(callerLogin);
        }
      }
 else {
      }
    }
 else {
    }
  }
 else {
  }
}
Program: 86073
Project: 86073
Buggy source:
/** 
 * Add a new participant to this room
 * @return if participant is found 
 */
public boolean addUser(String user){
  boolean success=true;
  if (user1 == null || user1.equals("String_Node_Str")) {
    user1=user;
  }
 else   if (user2 == null || user2.equals("String_Node_Str")) {
    user2=user;
  }
 else {
    success=false;
  }
  return success;
}

Fixed version (ground truth):
/** 
 * Add a new participant to this room
 * @return if participant is found 
 */
public boolean addUser(String user){
  boolean success=true;
  if (this.hasUser(user)) {
    return success;
  }
  if (user1 == null || user1.equals("String_Node_Str")) {
    user1=user;
  }
 else   if (user2 == null || user2.equals("String_Node_Str")) {
    user2=user;
  }
 else {
    success=false;
  }
  return success;
}
Program: 86074
Project: 86074
Buggy source:
List<List<PartUsageLink>> findPartUsages(ConfigurationItemKey pKey,PartMasterKey pPartMKey) throws WorkspaceNotFoundException, UserNotFoundException, UserNotActiveException ;

Fixed version (ground truth):
List<PartUsageLink[]> findPartUsages(ConfigurationItemKey pKey,PartMasterKey pPartMKey) throws WorkspaceNotFoundException, UserNotFoundException, UserNotActiveException ;
Program: 86075
Project: 86075
Buggy source:
/** 
 * Searchs all instances of a part and returns their paths, defined by a serie of usage links, from the top of the structure to their own usage link.
 * @param ciKey The configuration item under which context the search is made
 * @param partMKey The id of the part master to search on the structure
 * @return The usage paths to all instances of the supplied part
 * @throws WorkspaceNotFoundException
 * @throws UserNotFoundException
 * @throws UserNotActiveException
 */
List<List<PartUsageLink>> findPartUsages(ConfigurationItemKey ciKey,PartMasterKey partMKey) throws WorkspaceNotFoundException, UserNotFoundException, UserNotActiveException ;

Fixed version (ground truth):
/** 
 * Searchs all instances of a part and returns their paths, defined by a serie of usage links, from the top of the structure to their own usage link.
 * @param ciKey The configuration item under which context the search is made
 * @param partMKey The id of the part master to search on the structure
 * @return The usage paths to all instances of the supplied part
 * @throws WorkspaceNotFoundException
 * @throws UserNotFoundException
 * @throws UserNotActiveException
 */
List<PartUsageLink[]> findPartUsages(ConfigurationItemKey ciKey,PartMasterKey partMKey) throws WorkspaceNotFoundException, UserNotFoundException, UserNotActiveException ;
Program: 86076
Project: 86076
Buggy source:
@RolesAllowed("String_Node_Str") @Override public List<List<PartUsageLink>> findPartUsages(ConfigurationItemKey pKey,PartMasterKey pPartMKey) throws WorkspaceNotFoundException, UserNotFoundException, UserNotActiveException {
  User user=userManager.checkWorkspaceReadAccess(pKey.getWorkspace());
  PartUsageLinkDAO linkDAO=new PartUsageLinkDAO(new Locale(user.getLanguage()),em);
  List<List<PartUsageLink>> usagePaths=linkDAO.findPartUsagePaths(pPartMKey);
  return usagePaths;
}

Fixed version (ground truth):
@RolesAllowed("String_Node_Str") @Override public List<PartUsageLink[]> findPartUsages(ConfigurationItemKey pKey,PartMasterKey pPartMKey) throws WorkspaceNotFoundException, UserNotFoundException, UserNotActiveException {
  User user=userManager.checkWorkspaceReadAccess(pKey.getWorkspace());
  PartUsageLinkDAO linkDAO=new PartUsageLinkDAO(new Locale(user.getLanguage()),em);
  List<PartUsageLink[]> usagePaths=linkDAO.findPartUsagePaths(pPartMKey);
  return usagePaths;
}
Program: 86077
Project: 86077
Buggy source:
public List<List<PartUsageLink>> findPartUsagePaths(PartMasterKey pPartMKey){
  List<PartUsageLink> usages=findPartUsages(pPartMKey.getWorkspace(),pPartMKey.getNumber());
  List<List<PartUsageLink>> usagePaths=new ArrayList<List<PartUsageLink>>();
  for (  PartUsageLink usage : usages) {
    List<PartUsageLink> path=new ArrayList<PartUsageLink>();
    path.add(usage);
    createPath(usage,path,usagePaths);
  }
  return usagePaths;
}

Fixed version (ground truth):
public List<PartUsageLink[]> findPartUsagePaths(PartMasterKey pPartMKey){
  List<PartUsageLink> usages=findPartUsages(pPartMKey.getWorkspace(),pPartMKey.getNumber());
  List<PartUsageLink[]> usagePaths=new ArrayList<PartUsageLink[]>();
  for (  PartUsageLink usage : usages) {
    List<PartUsageLink> path=new ArrayList<PartUsageLink>();
    path.add(usage);
    createPath(usage,path,usagePaths);
  }
  return usagePaths;
}
Program: 86078
Project: 86078
Buggy source:
private void createPath(PartUsageLink currentUsage,List<PartUsageLink> currentPath,List<List<PartUsageLink>> usagePaths){
  PartIteration owner=em.createNamedQuery("String_Node_Str",PartIteration.class).setParameter("String_Node_Str",currentUsage).getSingleResult();
  List<PartUsageLink> parentUsages=findPartUsages(owner.getWorkspaceId(),owner.getPartNumber());
  for (  PartUsageLink parentUsage : parentUsages) {
    List<PartUsageLink> newPath=new ArrayList<PartUsageLink>(currentPath);
    newPath.add(0,parentUsage);
    createPath(parentUsage,newPath,usagePaths);
  }
  if (parentUsages.isEmpty())   usagePaths.add(currentPath);
}

Fixed version (ground truth):
private void createPath(PartUsageLink currentUsage,List<PartUsageLink> currentPath,List<PartUsageLink[]> usagePaths){
  PartIteration owner=em.createNamedQuery("String_Node_Str",PartIteration.class).setParameter("String_Node_Str",currentUsage).getSingleResult();
  List<PartUsageLink> parentUsages=findPartUsages(owner.getWorkspaceId(),owner.getPartNumber());
  for (  PartUsageLink parentUsage : parentUsages) {
    List<PartUsageLink> newPath=new ArrayList<PartUsageLink>(currentPath);
    newPath.add(0,parentUsage);
    createPath(parentUsage,newPath,usagePaths);
  }
  if (parentUsages.isEmpty())   usagePaths.add(currentPath.toArray(new PartUsageLink[currentPath.size()]));
}
Program: 86080
Project: 86080
Buggy source:
@Override public void writeTo(InstanceCollection object,Class<?> type,Type genericType,Annotation[] annotations,MediaType mediaType,MultivaluedMap<String,Object> httpHeaders,OutputStream entityStream) throws IOException, WebApplicationException {
  try {
    this.entityStream=entityStream;
    this.marshaller=((JSONJAXBContext)getJAXBContext(InstanceDTO.class,mediaType)).createJSONMarshaller();
    Map<String,String> mediaTypeParameters=mediaType.getParameters();
    String charSet="String_Node_Str";
    if (mediaTypeParameters.containsKey(CHARSET)) {
      charSet=mediaTypeParameters.get(CHARSET);
      this.marshaller.setProperty(Marshaller.JAXB_ENCODING,charSet);
    }
    PartUsageLink rootUsageLink=object.getRootUsageLink();
    List<Integer> usageLinkPaths=object.getUsageLinkPaths();
    leftSquareBrace="String_Node_Str".getBytes(charSet);
    rightSquareBrace="String_Node_Str".getBytes(charSet);
    comma="String_Node_Str".getBytes(charSet);
    this.addComma=false;
    this.entityStream.write(leftSquareBrace);
    generateInstanceStream(rootUsageLink,0,0,0,0,0,0,usageLinkPaths);
    this.entityStream.write(rightSquareBrace);
  }
 catch (  JAXBException ex) {
    throw new WebApplicationException(ex);
  }
}

Fixed version (ground truth):
@Override public void writeTo(InstanceCollection object,Class<?> type,Type genericType,Annotation[] annotations,MediaType mediaType,MultivaluedMap<String,Object> httpHeaders,OutputStream entityStream) throws IOException, WebApplicationException {
  try {
    setEntityStream(entityStream);
    setMarshaller(((JSONJAXBContext)getJAXBContext(InstanceDTO.class,mediaType)).createJSONMarshaller());
    Map<String,String> mediaTypeParameters=mediaType.getParameters();
    String charSet="String_Node_Str";
    if (mediaTypeParameters.containsKey(CHARSET)) {
      charSet=mediaTypeParameters.get(CHARSET);
      getMarshaller().setProperty(Marshaller.JAXB_ENCODING,charSet);
    }
    PartUsageLink rootUsageLink=object.getRootUsageLink();
    List<Integer> usageLinkPaths=object.getUsageLinkPaths();
    byte[] leftSquareBrace="String_Node_Str".getBytes(charSet);
    byte[] rightSquareBrace="String_Node_Str".getBytes(charSet);
    setComma("String_Node_Str".getBytes(charSet));
    setAddComma(false);
    getEntityStream().write(leftSquareBrace);
    generateInstanceStream(rootUsageLink,0,0,0,0,0,0,usageLinkPaths);
    getEntityStream().write(rightSquareBrace);
  }
 catch (  JAXBException ex) {
    throw new WebApplicationException(ex);
  }
 finally {
    tlEntityStream.remove();
    tlMarshaller.remove();
    tlAddComma.remove();
    tlComma.remove();
  }
}
Program: 86082
Project: 86082
Buggy source:
@GET @Path("String_Node_Str") @Produces("String_Node_Str") public InstanceCollection getInstances(@PathParam("String_Node_Str") String workspaceId,@PathParam("String_Node_Str") String ciId,@QueryParam("String_Node_Str") String configSpecType,@QueryParam("String_Node_Str") String path){
  try {
    ConfigurationItemKey ciKey=new ConfigurationItemKey(workspaceId,ciId);
    ConfigSpec cs=new LatestConfigSpec();
    String[] partUsageIdsString=path.split("String_Node_Str");
    List<Integer> usageLinkPaths=new ArrayList<Integer>();
    for (int i=0; i < partUsageIdsString.length; i++) {
      usageLinkPaths.add(Integer.parseInt(partUsageIdsString[i]));
    }
    PartUsageLink rootUsageLink=productService.filterProductStructure(ciKey,cs,usageLinkPaths.get(0),0);
    usageLinkPaths.remove(0);
    return new InstanceCollection(rootUsageLink,usageLinkPaths);
  }
 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 Response getInstances(@PathParam("String_Node_Str") String workspaceId,@PathParam("String_Node_Str") String ciId,@QueryParam("String_Node_Str") String configSpecType,@QueryParam("String_Node_Str") String path){
  try {
    ConfigurationItemKey ciKey=new ConfigurationItemKey(workspaceId,ciId);
    ConfigSpec cs=new LatestConfigSpec();
    String[] partUsageIdsString=path.split("String_Node_Str");
    List<Integer> usageLinkPaths=new ArrayList<Integer>();
    for (int i=0; i < partUsageIdsString.length; i++) {
      usageLinkPaths.add(Integer.parseInt(partUsageIdsString[i]));
    }
    PartUsageLink rootUsageLink=productService.filterProductStructure(ciKey,cs,usageLinkPaths.get(0),0);
    usageLinkPaths.remove(0);
    CacheControl cc=new CacheControl();
    cc.setMaxAge(60 * 60);
    cc.setNoCache(false);
    return Response.ok().cacheControl(cc).entity(new InstanceCollection(rootUsageLink,usageLinkPaths)).build();
  }
 catch (  com.docdoku.core.services.ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}
Program: 86083
Project: 86083
Buggy source:
private static void init(){
  Toolkit.getDefaultToolkit().setDynamicLayout(true);
  Prefs.initLocale();
  FileIO.rmDir(Config.LOCAL_TEMP_FOLDER);
  try {
    String version=System.getProperty("String_Node_Str");
    if (version.startsWith("String_Node_Str")) {
      for (      UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
        if ("String_Node_Str".equals(laf.getName())) {
          UIManager.setLookAndFeel(laf.getClassName());
        }
      }
    }
 else {
      UIManager.setLookAndFeel("String_Node_Str");
    }
  }
 catch (  Exception pEx) {
    System.err.println("String_Node_Str");
    System.err.println(pEx.getMessage());
  }
}

Fixed version (ground truth):
private static void init(){
  Toolkit.getDefaultToolkit().setDynamicLayout(true);
  Prefs.initLocale();
  FileIO.rmDir(Config.LOCAL_TEMP_FOLDER);
  try {
    String version=System.getProperty("String_Node_Str");
    if (version.startsWith("String_Node_Str")) {
      Config.HTTP_CLIENT_STREAMING_CHUNK_SIZE=Config.JAVA7_HTTP_CLIENT_STREAMING_CHUNK_SIZE;
      for (      UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
        if ("String_Node_Str".equals(laf.getName())) {
          UIManager.setLookAndFeel(laf.getClassName());
        }
      }
    }
 else {
      Config.HTTP_CLIENT_STREAMING_CHUNK_SIZE=Config.JAVA6_HTTP_CLIENT_STREAMING_CHUNK_SIZE;
      UIManager.setLookAndFeel("String_Node_Str");
    }
  }
 catch (  Exception pEx) {
    System.err.println("String_Node_Str");
    System.err.println(pEx.getMessage());
  }
}
Program: 86084
Project: 86084
Buggy source:
public static void main(String[] args) throws MalformedURLException, Exception {
  Console c=System.console();
  login=c.readLine("String_Node_Str");
  password=new String(c.readPassword("String_Node_Str"));
  workspace=c.readLine("String_Node_Str");
  String serverURL=c.readLine("String_Node_Str");
  pm=ScriptingTools.createProductService(serverURL + "String_Node_Str",login,password);
  fm=ScriptingTools.createFileManagerService(serverURL + "String_Node_Str",login,password);
  System.out.println("String_Node_Str");
  createBikeSampleProduct();
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
public static void main(String[] args) throws MalformedURLException, Exception {
  Console c=System.console();
  login=c.readLine("String_Node_Str");
  password=new String(c.readPassword("String_Node_Str"));
  workspace=c.readLine("String_Node_Str");
  String serverURL=c.readLine("String_Node_Str");
  pm=ScriptingTools.createProductService(serverURL + "String_Node_Str",login,password);
  fm=ScriptingTools.createFileManagerService(serverURL + "String_Node_Str",login,password);
  System.out.println("String_Node_Str");
  createBuildingSampleProduct();
  System.out.println("String_Node_Str");
}
Program: 86085
Project: 86085
Buggy source:
/** 
 * Creates a regular file, <a href="BinaryResource.html">BinaryResource</a> object, and attachs it to the part iteration instance passed as parameter. The part must be in the checkout state and the calling user must have write access rights to the part.
 * @param partIPK The id of the part iteration on which the file will be attached
 * @param name The name of the binary resource to create
 * @param size Number of bytes of the physical file
 * @return The physical file, a java.io.File instance, that now needs to be created
 * @throws UserNotFoundException
 * @throws UserNotActiveException
 * @throws WorkspaceNotFoundException
 * @throws NotAllowedException
 * @throws PartRevisionNotFoundException
 * @throws FileAlreadyExistsException
 * @throws CreationException
 */
java.io.File saveFileInPartIteration(PartIterationKey pPartIPK,String name,long size) throws UserNotFoundException, UserNotActiveException, WorkspaceNotFoundException, NotAllowedException, PartRevisionNotFoundException, FileAlreadyExistsException, CreationException ;

Fixed version (ground truth):
/** 
 * Creates a regular file, <a href="BinaryResource.html">BinaryResource</a> object, and attachs it to the part iteration instance passed as parameter. The part must be in the checkout state and the calling user must have write access rights to the part.
 * @param partIPK The id of the part iteration on which the file will be attached
 * @param name The name of the binary resource to create
 * @param size Number of bytes of the physical file
 * @return The physical file, a java.io.File instance, that now needs to be created
 * @throws UserNotFoundException
 * @throws UserNotActiveException
 * @throws WorkspaceNotFoundException
 * @throws NotAllowedException
 * @throws PartRevisionNotFoundException
 * @throws FileAlreadyExistsException
 * @throws CreationException
 */
java.io.File saveFileInPartIteration(PartIterationKey partIPK,String name,long size) throws UserNotFoundException, UserNotActiveException, WorkspaceNotFoundException, NotAllowedException, PartRevisionNotFoundException, FileAlreadyExistsException, CreationException ;
Program: 86086
Project: 86086
Buggy source:
public List<ConfigurationItem> findAllConfigurationItems(String pWorkspaceId){
  TypedQuery query=em.createQuery("String_Node_Str",ConfigurationItem.class);
  return query.setParameter("String_Node_Str",pWorkspaceId).getResultList();
}

Fixed version (ground truth):
public List<ConfigurationItem> findAllConfigurationItems(String pWorkspaceId){
  TypedQuery<ConfigurationItem> query=em.createQuery("String_Node_Str",ConfigurationItem.class);
  return query.setParameter("String_Node_Str",pWorkspaceId).getResultList();
}
Program: 86087
Project: 86087
Buggy source:
/** 
 * DELETE method for deleting an instance of FolderResource
 * @param parent folder path
 * @return the array of the documents that have also been deleted
 */
@DELETE @Path("String_Node_Str") @Produces("String_Node_Str") public DocumentMasterKey[] deleteJson(@PathParam("String_Node_Str") String completePath){
  try {
    return commandService.deleteFolder(completePath);
  }
 catch (  com.docdoku.core.services.ApplicationException ex) {
    throw new RESTException(ex.toString(),ex.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * DELETE method for deleting an instance of FolderResource
 * @param parent folder path
 * @return the array of the documents that have also been deleted
 */
@DELETE @Path("String_Node_Str") @Produces("String_Node_Str") public DocumentMasterKey[] deleteJson(@PathParam("String_Node_Str") String parentFolder,@PathParam("String_Node_Str") String folderName){
  try {
    String completePath=parentFolder + "String_Node_Str" + folderName;
    return commandService.deleteFolder(completePath);
  }
 catch (  com.docdoku.core.services.ApplicationException ex) {
    throw new RESTException(ex.toString(),ex.getMessage());
  }
}
Program: 86088
Project: 86088
Buggy source:
/** 
 * Retrieves representation of an instance of FolderResource
 * @param parent folder path
 * @return the array of sub-folders
 */
@GET @Path("String_Node_Str") @Produces("String_Node_Str") public String[] getJson(@PathParam("String_Node_Str") String completePath){
  try {
    return commandService.getFolders(completePath);
  }
 catch (  com.docdoku.core.services.ApplicationException ex) {
    throw new RESTException(ex.toString(),ex.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Retrieves representation of an instance of FolderResource
 * @param parent folder path
 * @return the array of sub-folders
 */
@GET @Path("String_Node_Str") @Produces("String_Node_Str") public String[] getJson(@PathParam("String_Node_Str") String parentFolder,@PathParam("String_Node_Str") String folderName){
  try {
    String completePath=parentFolder + "String_Node_Str" + folderName;
    return commandService.getFolders(completePath);
  }
 catch (  com.docdoku.core.services.ApplicationException ex) {
    throw new RESTException(ex.toString(),ex.getMessage());
  }
}
Program: 86089
Project: 86089
Buggy source:
/** 
 * DELETE method for deleting an instance of FolderResource
 * @param parent folder path
 * @return the array of the documents that have also been deleted
 */
@DELETE @Path("String_Node_Str") @Produces("String_Node_Str") public DocumentMasterKey[] deleteJson(@PathParam("String_Node_Str") String parentFolder,@PathParam("String_Node_Str") String folderName){
  try {
    String completePath=parentFolder + "String_Node_Str" + folderName;
    return commandService.deleteFolder(completePath);
  }
 catch (  com.docdoku.core.services.ApplicationException ex) {
    throw new RESTException(ex.toString(),ex.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * DELETE method for deleting an instance of FolderResource
 * @param parent folder path
 * @return the array of the documents that have also been deleted
 */
@DELETE @Path("String_Node_Str") @Produces("String_Node_Str") public DocumentMasterKey[] deleteJson(@PathParam("String_Node_Str") String workspace,@PathParam("String_Node_Str") String folderPath){
  try {
    String completePath=workspace + "String_Node_Str" + folderPath;
    return commandService.deleteFolder(completePath);
  }
 catch (  com.docdoku.core.services.ApplicationException ex) {
    throw new RESTException(ex.toString(),ex.getMessage());
  }
}
Program: 86090
Project: 86090
Buggy source:
/** 
 * Retrieves representation of an instance of FolderResource
 * @param parent folder path
 * @return the array of sub-folders
 */
@GET @Path("String_Node_Str") @Produces("String_Node_Str") public String[] getJson(@PathParam("String_Node_Str") String parentFolder,@PathParam("String_Node_Str") String folderName){
  try {
    String completePath=parentFolder + "String_Node_Str" + folderName;
    return commandService.getFolders(completePath);
  }
 catch (  com.docdoku.core.services.ApplicationException ex) {
    throw new RESTException(ex.toString(),ex.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Retrieves representation of an instance of FolderResource
 * @param parent folder path
 * @return the array of sub-folders
 */
@GET @Path("String_Node_Str") @Produces("String_Node_Str") public String[] getJson(@PathParam("String_Node_Str") String workspace,@PathParam("String_Node_Str") String folderPath){
  try {
    String completePath=workspace;
    if (!"String_Node_Str".equals(folderPath)) {
      completePath+="String_Node_Str" + folderPath;
    }
    if (completePath.charAt(completePath.length() - 1) == '/')     completePath=completePath.substring(0,completePath.length() - 1);
    return commandService.getFolders(completePath);
  }
 catch (  com.docdoku.core.services.ApplicationException ex) {
    throw new RESTException(ex.toString(),ex.getMessage());
  }
}
Program: 86091
Project: 86091
Buggy source:
public void onResize(ResizeEvent event){
  if (m_wfEditor.isVisible()) {
    m_wfEditor.setVisible(false);
    m_wfEditor.setWidth(inputPanel.getOffsetWidth() - 10);
    m_wfEditor.setVisible(true);
  }
}

Fixed version (ground truth):
public void onResize(ResizeEvent event){
  if (m_wfEditor.isVisible() && m_wfEditor.isAttached()) {
    m_wfEditor.setVisible(false);
    m_wfEditor.setWidth(inputPanel.getOffsetWidth() - 10);
    m_wfEditor.setVisible(true);
  }
}
Program: 86092
Project: 86092
Buggy source:
public void execute(Object... userObject){
  FileUpload upload=m_mainPage.getEditDocFilesPanel().getFileUpload();
  FormPanel form=m_mainPage.getEditDocFilesPanel().getForm();
  MasterDocumentDTO mdoc=m_mainPage.getLastOpenedMDoc();
  String fileName=upload.getFilename();
  int index=fileName.lastIndexOf('/');
  if (index == -1)   index=fileName.lastIndexOf('\\');
  if (index != -1)   fileName=fileName.substring(index + 1);
  String webappContext=HTMLUtil.getWebContext();
  String url="String_Node_Str" + webappContext + "String_Node_Str"+ URL.encode(mdoc.getWorkspaceId())+ "String_Node_Str"+ "String_Node_Str"+ URL.encode(mdoc.getId())+ "String_Node_Str"+ mdoc.getVersion()+ "String_Node_Str"+ mdoc.getLastIteration().getIteration()+ "String_Node_Str"+ URL.encode(fileName);
  form.setAction(url);
  form.submit();
}

Fixed version (ground truth):
public void execute(Object... userObject){
  FileUpload upload=m_mainPage.getEditDocFilesPanel().getFileUpload();
  FormPanel form=m_mainPage.getEditDocFilesPanel().getForm();
  MasterDocumentDTO mdoc=m_mainPage.getLastOpenedMDoc();
  String fileName=upload.getFilename();
  int index=fileName.lastIndexOf('/');
  if (index == -1)   index=fileName.lastIndexOf('\\');
  if (index != -1)   fileName=fileName.substring(index + 1);
  String webappContext=HTMLUtil.getWebContext();
  String url="String_Node_Str" + (webappContext == null ? "String_Node_Str" : webappContext + "String_Node_Str") + "String_Node_Str"+ URL.encode(mdoc.getWorkspaceId())+ "String_Node_Str"+ "String_Node_Str"+ URL.encode(mdoc.getId())+ "String_Node_Str"+ mdoc.getVersion()+ "String_Node_Str"+ mdoc.getLastIteration().getIteration()+ "String_Node_Str"+ URL.encode(fileName);
  form.setAction(url);
  form.submit();
}
Program: 86093
Project: 86093
Buggy source:
public void execute(Object... userObject){
  FileUpload upload=m_mainPage.getEditTemplateFilesPanel().getFileUpload();
  FormPanel form=m_mainPage.getEditTemplateFilesPanel().getForm();
  MasterDocumentTemplateDTO template=m_mainPage.getLastOpenedMDocTemplate();
  String webappContext=HTMLUtil.getWebContext();
  String url="String_Node_Str" + webappContext + "String_Node_Str"+ URL.encode(template.getWorkspaceId())+ "String_Node_Str"+ "String_Node_Str"+ URL.encode(template.getId())+ "String_Node_Str"+ URL.encode(upload.getFilename());
  form.setAction(url);
  form.submit();
}

Fixed version (ground truth):
public void execute(Object... userObject){
  FileUpload upload=m_mainPage.getEditTemplateFilesPanel().getFileUpload();
  FormPanel form=m_mainPage.getEditTemplateFilesPanel().getForm();
  MasterDocumentTemplateDTO template=m_mainPage.getLastOpenedMDocTemplate();
  String webappContext=HTMLUtil.getWebContext();
  String url="String_Node_Str" + (webappContext == null ? "String_Node_Str" : webappContext + "String_Node_Str") + "String_Node_Str"+ URL.encode(template.getWorkspaceId())+ "String_Node_Str"+ "String_Node_Str"+ URL.encode(template.getId())+ "String_Node_Str"+ URL.encode(upload.getFilename());
  form.setAction(url);
  form.submit();
}
Program: 86095
Project: 86095
Buggy source:
public void setFiles(Map<String,String> files){
  m_fileList.resize(files.size(),2);
  m_files=files;
  int i=0;
  for (  Map.Entry<String,String> file : files.entrySet()) {
    CheckBox fileCheckBox=new CheckBox();
    fileCheckBox.setVisible(m_editionMode);
    m_fileList.setWidget(i,0,fileCheckBox);
    String webappContext=HTMLUtil.getWebContext();
    String htmlLink="String_Node_Str" + webappContext + "String_Node_Str"+ file.getValue()+ "String_Node_Str"+ file.getKey()+ "String_Node_Str";
    m_fileList.setHTML(i,1,htmlLink);
    i++;
  }
}

Fixed version (ground truth):
public void setFiles(Map<String,String> files){
  m_fileList.resize(files.size(),2);
  m_files=files;
  int i=0;
  for (  Map.Entry<String,String> file : files.entrySet()) {
    CheckBox fileCheckBox=new CheckBox();
    fileCheckBox.setVisible(m_editionMode);
    m_fileList.setWidget(i,0,fileCheckBox);
    String webappContext=HTMLUtil.getWebContext();
    String htmlLink="String_Node_Str" + (webappContext == null ? "String_Node_Str" : webappContext + "String_Node_Str") + "String_Node_Str"+ file.getValue()+ "String_Node_Str"+ file.getKey()+ "String_Node_Str";
    m_fileList.setHTML(i,1,htmlLink);
    i++;
  }
}
Program: 86096
Project: 86096
Buggy source:
public static String getWebContext(){
  String moduleBaseURL=GWT.getModuleBaseURL();
  String moduleName=GWT.getModuleName();
  String webContext=moduleBaseURL.split("String_Node_Str")[3];
  if (webContext.equals(moduleName)) {
    return "String_Node_Str";
  }
 else {
    return webContext;
  }
}

Fixed version (ground truth):
public static String getWebContext(){
  String moduleBaseURL=GWT.getModuleBaseURL();
  String moduleName=GWT.getModuleName();
  String webContext=moduleBaseURL.split("String_Node_Str")[3];
  if (webContext.equals(moduleName)) {
    return null;
  }
 else {
    return webContext;
  }
}
Program: 86098
Project: 86098
Buggy source:
public void setWorkflow(WorkflowDTO wk,String visitor){
  m_workflowPanel.setWorkflow(wk,visitor);
}

Fixed version (ground truth):
public void setWorkflow(WorkflowDTO wk){
  m_workflowPanel.setWorkflow(wk);
}
Program: 86099
Project: 86099
Buggy source:
public DocMainPanel(){
  createLayout();
}

Fixed version (ground truth):
public DocMainPanel(final Map<String,Action> cmds){
  createLayout();
  m_workflowPanel.setApproveAction(cmds.get("String_Node_Str"));
  m_workflowPanel.setRejectAction(cmds.get("String_Node_Str"));
}
Program: 86102
Project: 86102
Buggy source:
/** 
 * Gets the type associated with this event.
 * @return returns the handler type
 */
public static Type<PageHandler> getType(){
  if (TYPE == null) {
    TYPE=new Type<PageHandler>();
  }
  return TYPE;
}

Fixed version (ground truth):
/** 
 * Gets the type associated with this event.
 * @return returns the handler type
 */
@SuppressWarnings(value="String_Node_Str") public static Type<PageHandler> getType(){
  if (TYPE == null) {
    TYPE=new Type<PageHandler>();
  }
  return TYPE;
}
Program: 86103
Project: 86103
Buggy source:
public void onMouseMove(MouseMoveEvent event){
  tooltipPanel.setPopupPosition(event.getClientX() + 10,event.getClientY() + 10);
  if (!tooltipPanel.isShowing()) {
    tooltipPanel.show();
  }
}

Fixed version (ground truth):
public void onMouseMove(MouseMoveEvent event){
  if (!tooltipPanel.isShowing()) {
    tooltipPanel.showRelativeTo(this);
  }
}
Program: 86104
Project: 86104
Buggy source:
void dataReady(ExplorerServiceResponse response){
  currentModel=currentBackend.getTableModel();
  numberOfPages=response.getTotalSize() / pageSize + 1;
  currentPage=response.getChunckOffset() / pageSize;
  PageManagerEvent.fire(this,currentPage,numberOfPages,response.getChunckOffset() + 1,response.getChunckOffset() + response.getData().length,response.getTotalSize());
}

Fixed version (ground truth):
void dataReady(ExplorerServiceResponse response){
  currentModel=currentBackend.getTableModel();
  if (response.getTotalSize() % pageSize != 0) {
    numberOfPages=response.getTotalSize() / pageSize + 1;
  }
 else {
    numberOfPages=response.getTotalSize() / pageSize;
  }
  currentPage=response.getChunckOffset() / pageSize;
  PageManagerEvent.fire(this,currentPage,numberOfPages,response.getChunckOffset() + 1,response.getChunckOffset() + response.getData().length,response.getTotalSize());
}
Program: 86105
Project: 86105
Buggy source:
public void execute(Object... userObject){
  AsyncCallback<MasterDocumentDTO[]> callback=new AsyncCallback<MasterDocumentDTO[]>(){
    public void onFailure(    Throwable caught){
      HTMLUtil.showError(caught.getMessage());
    }
    public void onSuccess(    MasterDocumentDTO[] result){
      m_mainPage.showSearchResult(result);
    }
  }
;
  String workspaceId=(String)userObject[0];
  String mdocId=(String)userObject[1];
  String title=(String)userObject[2];
  String version=(String)userObject[3];
  String author=(String)userObject[4];
  String type=(String)userObject[5];
  Date fromDate=(Date)userObject[6];
  Date toDate=(Date)userObject[7];
  InstanceAttributeDTO[] attributes=(InstanceAttributeDTO[])userObject[8];
  String[] tags=(String[])userObject[9];
  String content=(String)userObject[10];
  ServiceLocator.getInstance().getExplorerService().searchMDocs(workspaceId,mdocId,title,version,author,type,fromDate,toDate,attributes,tags,content,callback);
}

Fixed version (ground truth):
public void execute(Object... userObject){
  String workspaceId=(String)userObject[0];
  String mdocId=(String)userObject[1];
  String title=(String)userObject[2];
  String version=(String)userObject[3];
  String author=(String)userObject[4];
  String type=(String)userObject[5];
  Date fromDate=(Date)userObject[6];
  Date toDate=(Date)userObject[7];
  InstanceAttributeDTO[] attributes=(InstanceAttributeDTO[])userObject[8];
  String[] tags=(String[])userObject[9];
  String content=(String)userObject[10];
  m_mainPage.showSearchResult(new MDocSearchBackend(m_mainPage.getLogin(),workspaceId,mdocId,title,version,author,type,fromDate,toDate,attributes,tags,content));
}
Program: 86106
Project: 86106
Buggy source:
public ExplorerPage(String workspaceId,String login){
  m_workspaceId=workspaceId;
  m_login=login;
  m_dndController=new DocDragController(RootPanel.get(),false);
  m_dndController.setBehaviorDragProxy(true);
  ExplorerConstants.init(workspaceId);
  Window.addResizeHandler(this);
}

Fixed version (ground truth):
public ExplorerPage(String workspaceId,String login){
  m_workspaceId=workspaceId;
  m_login=login;
  m_dndController=new DocDragController(RootPanel.get(),false);
  m_dndController.setBehaviorDragProxy(true);
  ExplorerConstants.init(workspaceId);
  Window.addResizeHandler(this);
  pageManager=new PageManager();
}
Program: 86108
Project: 86108
Buggy source:
public void showSearchResult(MasterDocumentDTO[] result){
  inputPanel.clear();
  MDocTableModel source=new MDocTableModel(result,m_login,true);
  m_elementTable.setModel(source,m_tableProfiles.getProfile("String_Node_Str"));
  m_menuDocumentBarBottom.setStyleName("String_Node_Str");
  m_menuDocumentBarTop.setStyleName("String_Node_Str");
  elementTableDecPanel.addStyleName("String_Node_Str");
  showTablePanel(false);
}

Fixed version (ground truth):
public void showSearchResult(PageManagerBackend backend){
  inputPanel.clear();
  desiredProfile=m_tableProfiles.getProfile("String_Node_Str");
  elementTableDecPanel.addStyleName("String_Node_Str");
  pageManager.setPageManagerBackend(backend);
}
Program: 86109
Project: 86109
Buggy source:
private void fetchCheckedOutMDocs(String workspaceId){
  AsyncCallback<MasterDocumentDTO[]> callback=new AsyncCallback<MasterDocumentDTO[]>(){
    public void onSuccess(    MasterDocumentDTO[] mdocs){
      MDocTableModel model=new MDocTableModel(mdocs,m_login,true);
      m_elementTable.setModel(model);
      showTablePanel();
    }
    public void onFailure(    Throwable caught){
      HTMLUtil.showError(caught.getMessage());
    }
  }
;
  ServiceLocator.getInstance().getExplorerService().getCheckedOutMDocs(workspaceId,callback);
}

Fixed version (ground truth):
private void fetchCheckedOutMDocs(String workspaceId){
  desiredProfile=m_tableProfiles.getProfile("String_Node_Str");
  elementTableDecPanel.removeStyleName("String_Node_Str");
  pageManager.setPageManagerBackend(new MDocCheckedOutBackend(m_login,workspaceId));
}
Program: 86110
Project: 86110
Buggy source:
private void fetchMDocTemplates(String workspaceId){
  AsyncCallback<MasterDocumentTemplateDTO[]> callback=new AsyncCallback<MasterDocumentTemplateDTO[]>(){
    public void onSuccess(    MasterDocumentTemplateDTO[] templates){
      m_elementTable.setModel(new MDocTemplateTableModel(templates),m_tableProfiles.getProfile("String_Node_Str"));
      showTablePanel();
    }
    public void onFailure(    Throwable caught){
      HTMLUtil.showError(caught.getMessage());
    }
  }
;
  ServiceLocator.getInstance().getExplorerService().getMDocTemplates(workspaceId,callback);
}

Fixed version (ground truth):
private void fetchMDocTemplates(String workspaceId){
  desiredProfile=m_tableProfiles.getProfile("String_Node_Str");
  pageManager.setPageManagerBackend(new MDocTemplateBackend(workspaceId));
}
Program: 86111
Project: 86111
Buggy source:
public void showTablePanel(boolean maskSearchComplete){
  if (maskSearchComplete) {
    showBasicSearchPanel();
  }
  inputPanel.clear();
  m_group.unselect();
  VerticalPanel vp=new VerticalPanel();
  vp.setWidth("String_Node_Str");
  if (m_elementTable.getTableModel() instanceof MDocTableModel) {
    vp.add(m_menuDocumentBarTop);
    vp.add(m_elementTable);
    vp.add(m_menuDocumentBarBottom);
  }
 else {
    vp.add(m_menuBarTop);
    vp.add(m_elementTable);
    vp.add(m_menuBarBottom);
  }
  inputPanel.setWidget(vp);
}

Fixed version (ground truth):
public void showTablePanel(boolean maskSearchComplete){
  if (maskSearchComplete) {
    showBasicSearchPanel();
  }
  inputPanel.clear();
  m_group.unselect();
  inputPanel.setWidget(m_elementTable);
}
Program: 86112
Project: 86112
Buggy source:
private void fetchMDocsByFolder(String completePath){
  AsyncCallback<MasterDocumentDTO[]> callback=new AsyncCallback<MasterDocumentDTO[]>(){
    public void onSuccess(    MasterDocumentDTO[] mdocs){
      MDocTableModel mdocSource=new MDocTableModel(mdocs,m_login,true);
      m_elementTable.setModel(mdocSource,m_tableProfiles.getProfile("String_Node_Str"));
      showTablePanel();
    }
    public void onFailure(    Throwable caught){
      HTMLUtil.showError(caught.getMessage());
    }
  }
;
  ServiceLocator.getInstance().getExplorerService().findMDocsByFolder(completePath,callback);
}

Fixed version (ground truth):
private void fetchMDocsByFolder(String completePath){
  desiredProfile=m_tableProfiles.getProfile("String_Node_Str");
  elementTableDecPanel.removeStyleName("String_Node_Str");
  pageManager.setPageManagerBackend(new MDocFolderBackend(completePath,m_login));
}
Program: 86113
Project: 86113
Buggy source:
private void fetchMDocsByTag(String workspaceId,String label){
  AsyncCallback<MasterDocumentDTO[]> callback=new AsyncCallback<MasterDocumentDTO[]>(){
    public void onSuccess(    MasterDocumentDTO[] mdocs){
      MDocTableModel mdocSource=new MDocTableModel(mdocs,m_login,true);
      m_elementTable.setModel(mdocSource,m_tableProfiles.getProfile("String_Node_Str"));
      showTablePanel();
    }
    public void onFailure(    Throwable caught){
      HTMLUtil.showError(caught.getMessage());
    }
  }
;
  ServiceLocator.getInstance().getExplorerService().findMDocsByTag(workspaceId,label,callback);
}

Fixed version (ground truth):
private void fetchMDocsByTag(String workspaceId,String label){
  desiredProfile=m_tableProfiles.getProfile("String_Node_Str");
  pageManager.setPageManagerBackend(new MDocTagBackend(m_login,label,workspaceId));
}
Program: 86114
Project: 86114
Buggy source:
public void onPageChanged(PageManagerEvent event){
  first.setVisible(event.getCurrentPage() > 0);
  previous.setVisible(event.getCurrentPage() > 0);
  next.setVisible(event.getCurrentPage() < event.getNumberOfPages() - 2);
  last.setVisible(event.getCurrentPage() < event.getNumberOfPages() - 2);
}

Fixed version (ground truth):
public void onPageChanged(PageManagerEvent event){
  first.setVisible(event.getCurrentPage() > 0);
  previous.setVisible(event.getCurrentPage() > 0);
  next.setVisible(event.getCurrentPage() < event.getNumberOfPages() - 1);
  last.setVisible(event.getCurrentPage() < event.getNumberOfPages() - 1);
}
Program: 86115
Project: 86115
Buggy source:
public MDocCheckedOutBackend(String login,String workspaceId){
  this.login=login;
  this.workspaceId=workspaceId;
}

Fixed version (ground truth):
public MDocCheckedOutBackend(String login,String workspaceId){
  this.login=login;
  this.workspaceId=workspaceId;
  callback=new InternalCallback();
}
Program: 86116
Project: 86116
Buggy source:
public MDocTemplateResponse getMDocTemplates(String workspaceId,int startOffset,int chunkSize) throws ApplicationException {
  MasterDocumentTemplateDTO response[]=getMDocTemplates(workspaceId);
  if (startOffset < response.length) {
    MasterDocumentTemplateDTO chunk[];
    if (startOffset + chunkSize <= response.length) {
      chunk=new MasterDocumentTemplateDTO[chunkSize];
      int j=0;
      for (int i=startOffset; i < startOffset + chunkSize; i++) {
        chunk[j]=response[i];
        j++;
      }
    }
 else {
      chunk=new MasterDocumentTemplateDTO[response.length - startOffset];
      int j=0;
      for (int i=startOffset; i < response.length; i++) {
        chunk[j]=response[i];
        j++;
      }
    }
    MDocTemplateResponse result=new MDocTemplateResponse();
    result.setChunckOffset(startOffset);
    result.setTotalSize(response.length);
    result.setData(chunk);
    return result;
  }
  return null;
}

Fixed version (ground truth):
public MDocTemplateResponse getMDocTemplates(String workspaceId,int startOffset,int chunkSize) throws ApplicationException {
  MasterDocumentTemplateDTO response[]=getMDocTemplates(workspaceId);
  if (startOffset < response.length) {
    MasterDocumentTemplateDTO chunk[];
    if (startOffset + chunkSize <= response.length) {
      chunk=new MasterDocumentTemplateDTO[chunkSize];
      int j=0;
      for (int i=startOffset; i < startOffset + chunkSize; i++) {
        chunk[j]=response[i];
        j++;
      }
    }
 else {
      chunk=new MasterDocumentTemplateDTO[response.length - startOffset];
      int j=0;
      for (int i=startOffset; i < response.length; i++) {
        chunk[j]=response[i];
        j++;
      }
    }
    MDocTemplateResponse result=new MDocTemplateResponse();
    result.setChunckOffset(startOffset);
    result.setTotalSize(response.length);
    result.setData(chunk);
    return result;
  }
  MDocTemplateResponse defaultResponse=new MDocTemplateResponse();
  MasterDocumentTemplateDTO defaultChunk[]=new MasterDocumentTemplateDTO[0];
  defaultResponse.setTotalSize(0);
  defaultResponse.setChunckOffset(0);
  defaultResponse.setData(defaultChunk);
  return defaultResponse;
}