nus-yam/ex-repair huggingface dataset:
Program: 95035
Project: 95035
Buggy source:
protected int namespaceHashCode(){
  return uri.hashCode();
}

Fixed version (ground truth):
protected int namespaceHashCode(){
  return this.domain.hashCode() ^ this.host.hashCode() ^ this.nickname.hashCode()^ this.roomname.hashCode()^ this.username.hashCode();
}
Program: 95036
Project: 95036
Buggy source:
public String getNickname(){
  String query=uri.getQuery();
  if (query == null) {
    return uri.getUserInfo();
  }
 else {
    return query.substring(query.indexOf('=') + 1);
  }
}

Fixed version (ground truth):
public String getNickname(){
  return nickname;
}
Program: 95037
Project: 95037
Buggy source:
public String toString(){
  StringBuffer sb=new StringBuffer("String_Node_Str");
  sb.append(uri).append("String_Node_Str");
  return sb.toString();
}

Fixed version (ground truth):
public String toString(){
  StringBuffer sb=new StringBuffer("String_Node_Str");
  sb.append(getNamespace().getScheme() + "String_Node_Str" + getUsername()+ "String_Node_Str"+ this.domain+ "String_Node_Str"+ this.host+ "String_Node_Str"+ this.roomname).append("String_Node_Str");
  return sb.toString();
}
Program: 95038
Project: 95038
Buggy source:
protected void parseMessageAndSend(String message){
  if (isCommand(message)) {
    String[] tokens=parseCommandTokens(message);
synchronized (this) {
      if (connection != null) {
        handleCommandMessage(tokens);
      }
 else {
        trace("String_Node_Str" + message + "String_Node_Str"+ getID());
      }
    }
  }
 else {
    trace(message + "String_Node_Str");
  }
}

Fixed version (ground truth):
protected void parseMessageAndSend(String message){
  if (isCommand(message)) {
synchronized (this) {
      if (connection != null) {
        String lowerCase=message.toLowerCase();
        if (lowerCase.startsWith("String_Node_Str")) {
          message=message.substring(5);
          int index=message.indexOf(COMMAND_DELIM);
          if (index != -1) {
            connection.doPrivmsg(message.substring(0,index),message.substring(index + 1));
          }
        }
 else         if (lowerCase.startsWith("String_Node_Str")) {
          message=message.substring(9);
          int index=message.indexOf(COMMAND_DELIM);
          if (index != -1) {
            connection.doPrivmsg(message.substring(0,index),message.substring(index + 1));
          }
        }
 else {
          String[] tokens=parseCommandTokens(message);
          handleCommandMessage(tokens);
        }
      }
 else {
        trace("String_Node_Str" + message + "String_Node_Str"+ getID());
      }
    }
  }
 else {
    trace(message + "String_Node_Str");
  }
}
Program: 95040
Project: 95040
Buggy source:
public SelectProviderAction(){
  try {
    IExtensionRegistry registry=Platform.getExtensionRegistry();
    IExtension[] configurationWizards=registry.getExtensionPoint(CONFIGURE_EPOINT_ID).getExtensions();
    IExtension[] connectWizards=registry.getExtensionPoint(CONNECT_EPOINT_ID).getExtensions();
    for (int i=0; i < connectWizards.length; i++) {
      final IConfigurationElement[] ices=connectWizards[i].getConfigurationElements();
      for (int j=0; j < ices.length; j++) {
        final String factoryName=ices[j].getAttribute(ATT_CONTAINER_TYPE_NAME);
        final IConfigurationWizard wizard=getWizard(configurationWizards,factoryName);
        final IConfigurationElement ice=ices[j];
        if (wizard == null) {
          map.put(ice.getAttribute(ATT_NAME),new SelectionAdapter(){
            public void widgetSelected(            SelectionEvent e){
              openConnectWizard(ice,factoryName);
            }
          }
);
        }
 else {
          map.put(ice.getAttribute(ATT_NAME),new SelectionAdapter(){
            public void widgetSelected(            SelectionEvent e){
              openConnectWizard(wizard,ice,factoryName);
            }
          }
);
        }
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public SelectProviderAction(){
  try {
    IExtensionRegistry registry=Platform.getExtensionRegistry();
    IExtension[] configurationWizards=registry.getExtensionPoint(CONFIGURE_EPOINT_ID).getExtensions();
    IExtension[] connectWizards=registry.getExtensionPoint(CONNECT_EPOINT_ID).getExtensions();
    for (int i=0; i < connectWizards.length; i++) {
      final IConfigurationElement[] ices=connectWizards[i].getConfigurationElements();
      for (int j=0; j < ices.length; j++) {
        if (ices[j].getName().equals(ELEMENT_CATEGORY)) {
          continue;
        }
        final String factoryName=ices[j].getAttribute(ATT_CONTAINER_TYPE_NAME);
        final IConfigurationWizard wizard=getWizard(configurationWizards,factoryName);
        final IConfigurationElement ice=ices[j];
        if (wizard == null) {
          map.put(ice.getAttribute(ATT_NAME),new SelectionAdapter(){
            public void widgetSelected(            SelectionEvent e){
              openConnectWizard(ice,factoryName);
            }
          }
);
        }
 else {
          map.put(ice.getAttribute(ATT_NAME),new SelectionAdapter(){
            public void widgetSelected(            SelectionEvent e){
              openConnectWizard(wizard,ice,factoryName);
            }
          }
);
        }
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 95041
Project: 95041
Buggy source:
public byte[] getPhotoDataAsBytes(){
  return StringUtils.decodeBase64(photoData);
}

Fixed version (ground truth):
public byte[] getPhotoDataAsBytes(){
  if (photoData == null)   return new byte[0];
  return StringUtils.decodeBase64(photoData);
}
Program: 95043
Project: 95043
Buggy source:
protected void sendMessageLine(String line){
  try {
    channelMessageSender.sendMessage(line);
  }
 catch (  ECFException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
protected void sendMessageLine(String line){
  try {
    channelMessageSender.sendMessage(line);
  }
 catch (  ECFException e) {
    disconnected();
  }
}
Program: 95044
Project: 95044
Buggy source:
public int getActiveCount(){
  RosterObject[] childs=getChildren();
  int totCount=0;
  for (int i=0; i < childs.length; i++) {
    if (childs[i] instanceof RosterBuddy) {
      RosterBuddy tb=(RosterBuddy)childs[i];
      IPresence presence=tb.getPresence();
      if (presence != null && presence.getMode().equals(IPresence.Mode.AVAILABLE))       totCount++;
    }
  }
  return totCount;
}

Fixed version (ground truth):
public int getActiveCount(){
  RosterObject[] childs=getChildren();
  int totCount=0;
  for (int i=0; i < childs.length; i++) {
    if (childs[i] instanceof RosterBuddy) {
      RosterBuddy tb=(RosterBuddy)childs[i];
      IPresence presence=tb.getPresence();
      if (presence != null && presence.getType().equals(IPresence.Type.AVAILABLE))       totCount++;
    }
  }
  return totCount;
}
Program: 95045
Project: 95045
Buggy source:
protected void removeAccount(ID serviceID){
  accounts.remove(serviceID);
}

Fixed version (ground truth):
protected void removeAccount(ID serviceID){
synchronized (accounts) {
    for (Iterator i=accounts.keySet().iterator(); i.hasNext(); ) {
      ID key=(ID)i.next();
      if (key.equals(serviceID))       i.remove();
    }
  }
}
Program: 95048
Project: 95048
Buggy source:
protected void handleAccountDisconnected(RosterUserAccount account){
  removeAllRosterEntriesForAccount(account);
  disposeAllChatWindowsForAccount(account,"String_Node_Str");
  accounts.remove(account.getServiceID());
  if (accounts.size() == 0)   setToolbarEnabled(false);
}

Fixed version (ground truth):
protected void handleAccountDisconnected(RosterUserAccount account){
  removeAllRosterEntriesForAccount(account);
  disposeAllChatWindowsForAccount(account,"String_Node_Str");
  removeAccount(account.getServiceID());
  if (accounts.size() == 0)   setToolbarEnabled(false);
}
Program: 95049
Project: 95049
Buggy source:
protected void handleOnError(String arg0){
  trace("String_Node_Str" + arg0 + "String_Node_Str");
  showMessage(null,"String_Node_Str" + arg0);
  disconnect();
}

Fixed version (ground truth):
protected void handleOnError(String arg0){
  trace("String_Node_Str" + arg0 + "String_Node_Str");
  showMessage(null,"String_Node_Str" + arg0);
}
Program: 95051
Project: 95051
Buggy source:
public void onError(int arg0,String arg1){
  trace("String_Node_Str" + arg0 + "String_Node_Str"+ arg1+ "String_Node_Str");
  showMessage(null,"String_Node_Str" + arg0 + "String_Node_Str"+ arg1);
  handleDisconnected();
}

Fixed version (ground truth):
public void onError(int arg0,String arg1){
  trace("String_Node_Str" + arg0 + "String_Node_Str"+ arg1+ "String_Node_Str");
  showMessage(null,"String_Node_Str" + arg0 + "String_Node_Str"+ arg1);
}
Program: 95052
Project: 95052
Buggy source:
public void selectionChanged(SelectionChangedEvent event){
  StructuredSelection selection=(StructuredSelection)event.getSelection();
  ContainerTypeDescription desc=(ContainerTypeDescription)selection.getFirstElement();
  containerType=desc.getName();
  createPropertyComposite(paramComp,desc.getProperties());
}

Fixed version (ground truth):
public void selectionChanged(SelectionChangedEvent event){
  StructuredSelection selection=(StructuredSelection)event.getSelection();
  ContainerTypeDescription desc=(ContainerTypeDescription)selection.getFirstElement();
  if (desc != null) {
    containerType=desc.getName();
    createPropertyComposite(paramComp,desc.getProperties());
  }
}
Program: 95053
Project: 95053
Buggy source:
public void handlePresence(final ID fromID,final IPresence presence){
  Display.getDefault().syncExec(new Runnable(){
    public void run(){
      if (disposed)       return;
      boolean isAdd=presence.getType().equals(IPresence.Type.AVAILABLE);
      Participant p=new Participant(fromID);
      if (isAdd) {
        if (localUser == null && !otherUsers.contains(fromID)) {
          localUser=p;
        }
        addParticipant(p);
      }
 else {
        removeParticipant(p);
        if (isLocalUser(fromID))         removeLocalUser();
      }
    }
  }
);
}

Fixed version (ground truth):
public void handlePresence(final ID fromID,final IPresence presence){
  Display.getDefault().asyncExec(new Runnable(){
    public void run(){
      if (disposed)       return;
      boolean isAdd=presence.getType().equals(IPresence.Type.AVAILABLE);
      Participant p=new Participant(fromID);
      if (isAdd) {
        if (localUser == null && !otherUsers.contains(fromID)) {
          localUser=p;
        }
        addParticipant(p);
      }
 else {
        removeParticipant(p);
        if (isLocalUser(fromID))         removeLocalUser();
      }
    }
  }
);
}
Program: 95054
Project: 95054
Buggy source:
/** 
 * Get the name of this namespace. May not return null.
 * @return String name of Namespace instance
 */
public String getName(){
  return name;
}

Fixed version (ground truth):
/** 
 * Get the name of this namespace. Must not return null.
 * @return String name of Namespace instance
 */
public String getName(){
  return name;
}
Program: 95055
Project: 95055
Buggy source:
public final boolean initialize(String name,String desc){
  if (name == null)   throw new NullPointerException("String_Node_Str");
  if (!isInitialized) {
    this.name=name;
    this.description=desc;
    this.hashCode=name.hashCode();
    this.isInitialized=true;
    return true;
  }
 else   return false;
}

Fixed version (ground truth):
public final boolean initialize(String name,String desc){
  Assert.isNotNull(name,"String_Node_Str");
  if (!isInitialized) {
    this.name=name;
    this.description=desc;
    this.hashCode=name.hashCode();
    this.isInitialized=true;
    return true;
  }
 else   return false;
}
Program: 95056
Project: 95056
Buggy source:
/** 
 * Get array of supported adapters for the given container type description. Providers implement this method to allow clients to inspect the adapter types exposed by the container described by the given description. The returned array entries will be the fully qualified names of the adapter classes. Note that the returned types do not guarantee that a subsequent call to  {@link IContainer#getAdapter(Class)} with the same type name as areturned value will return a non-<code>null</code> result. In other words, even if the class name is in the returned array, subsequent calls to  {@link IContainer#getAdapter(Class)} may still return<code>null</code>.
 * @param description the ContainerTypeDescription to report adapters for. Must not be <code>null</code>.
 * @return String[] of supported adapters. The entries in the returned arraywill be the fully qualified class names of adapters supported by the given description. <code>null</code> will be returned by the provider if no adapters are supported for this description.
 */
public String[] getSupportedAdapterTypes(ContainerTypeDescription description);

Fixed version (ground truth):
/** 
 * Get array of supported adapters for the given container type description. Providers implement this method to allow clients to inspect the adapter types exposed by the container described by the given description. The returned array entries will be the fully qualified names of the adapter classes. Note that the returned types do not guarantee that a subsequent call to  {@link IContainer#getAdapter(Class)} with the same type name as areturned value will return a non-<code>null</code> result. In other words, even if the class name is in the returned array, subsequent calls to  {@link IContainer#getAdapter(Class)} may still return<code>null</code>.
 * @param description the ContainerTypeDescription to report adapters for. Must not be <code>null</code>.
 * @return String[] of supported adapters. The entries in the returned arraywill be the fully qualified class names of adapters supported by the given description. <code>null</code> may be returned by the provider if no adapters are supported for this description.
 */
public String[] getSupportedAdapterTypes(ContainerTypeDescription description);
Program: 95057
Project: 95057
Buggy source:
/** 
 * Get array of supported adapters for the given container type description. Providers can implement this method to allow clients to inspect the adapter types implemented by the container described by the given description. The returned array entries will be the fully qualified names of the adapter classes. Note that the returned types do not guarantee that a subsequent call to  {@link IContainer#getAdapter(Class)} with the same type name as areturned value will return a non-null result. In other words, even if the class name is in the returned array, subsequent calls to {@link IContainer#getAdapter(Class)} may still return <code>null</code>.
 * @return String[] of supported adapters. The entries in the returned arraywill be the fully qualified class names of adapters supported by the given description. An empty string array (String[0]) will be returned if no adapters are supported.
 */
public String[] getSupportedAdapterTypes(){
  String method="String_Node_Str";
  Trace.entering(ECFPlugin.getDefault(),ECFDebugOptions.METHODS_ENTERING,this.getClass(),method);
  String[] result=new String[0];
  try {
    result=getInstantiator().getSupportedAdapterTypes(this);
  }
 catch (  Exception e) {
    traceAndLogException(GET_SUPPORTED_ADAPTERS_ERROR_CODE,method,e);
  }
  Trace.exiting(ECFPlugin.getDefault(),ECFDebugOptions.METHODS_EXITING,this.getClass(),method,result);
  return result;
}

Fixed version (ground truth):
/** 
 * Get array of supported adapters for this container type description. The returned array entries will be the fully qualified names of the adapter classes. Note that the returned types do not guarantee that a subsequent call to  {@link IContainer#getAdapter(Class)} with the same type name as areturned value will return a non-<code>null</code result. In other words, even if the class name is in the returned array, subsequent calls to {@link IContainer#getAdapter(Class)} may still return <code>null</code>.
 * @return String[] of supported adapters. The entries in the returned arraywill be the fully qualified class names of adapters supported by the given description. An empty string array (String[0]) will be returned if no adapters are supported.
 */
public String[] getSupportedAdapterTypes(){
  String method="String_Node_Str";
  Trace.entering(ECFPlugin.getDefault(),ECFDebugOptions.METHODS_ENTERING,this.getClass(),method);
  String[] result=new String[0];
  try {
    String[] r=getInstantiator().getSupportedAdapterTypes(this);
    if (r != null)     result=r;
  }
 catch (  Exception e) {
    traceAndLogException(GET_SUPPORTED_ADAPTERS_ERROR_CODE,method,e);
  }
  Trace.exiting(ECFPlugin.getDefault(),ECFDebugOptions.METHODS_EXITING,this.getClass(),method,result);
  return result;
}
Program: 95058
Project: 95058
Buggy source:
/** 
 * Get array of parameter types for this ContainerTypeDescription. Each of the rows of the returned array specifies a Class[] of parameter types. These parameter types correspond to the types of Objects that can be passed into the second parameter of  {@link IContainerInstantiator#createInstance(ContainerTypeDescription,Object[])}. For example, if this method returns a Class [] = {{ String.class, String.class }, { String.class }} this indicates that a call to createInstance(description,new String[] { "hello", "there" }) and a call to createInstance(description,new String[] { "hello" }) will be understood by the underlying provider implementation.
 * @return Class[][] array of Class arrays. Each row corresponds to aClass[] that describes the types of Objects for second parameter to {@link IContainerInstantiator#createInstance(ContainerTypeDescription,Object[])}. If no parameter types are understood as arguments, a Class[0][0] array will be returned
 */
public Class[][] getSupportedParameterTypes(){
  String method="String_Node_Str";
  Trace.entering(ECFPlugin.getDefault(),ECFDebugOptions.METHODS_ENTERING,this.getClass(),method);
  Class[][] result=new Class[0][0];
  try {
    result=getInstantiator().getSupportedParameterTypes(this);
  }
 catch (  Exception e) {
    traceAndLogException(GET_PARAMETER_TYPES_ERROR_CODE,method,e);
  }
  Trace.exiting(ECFPlugin.getDefault(),ECFDebugOptions.METHODS_EXITING,this.getClass(),method,result);
  return result;
}

Fixed version (ground truth):
/** 
 * Get array of parameter types for this ContainerTypeDescription. Each of the rows of the returned array specifies a Class[] of parameter types. These parameter types correspond to the types of Objects that can be passed into the second parameter of  {@link IContainerInstantiator#createInstance(ContainerTypeDescription,Object[])}. For example, if this method returns a Class [] = {{ String.class, String.class }, { String.class }} this indicates that a call to createInstance(description,new String[] { "hello", "there" }) and a call to createInstance(description,new String[] { "hello" }) will be understood by the underlying provider implementation.
 * @return Class[][] array of Class arrays. Each row corresponds to aClass[] that describes the types of Objects for second parameter to {@link IContainerInstantiator#createInstance(ContainerTypeDescription,Object[])}. If no parameter types are understood as arguments, a Class[0][0] array will be returned
 */
public Class[][] getSupportedParameterTypes(){
  String method="String_Node_Str";
  Trace.entering(ECFPlugin.getDefault(),ECFDebugOptions.METHODS_ENTERING,this.getClass(),method);
  Class[][] result=new Class[0][0];
  try {
    Class[][] r=getInstantiator().getSupportedParameterTypes(this);
    if (r != null)     result=r;
  }
 catch (  Exception e) {
    traceAndLogException(GET_PARAMETER_TYPES_ERROR_CODE,method,e);
  }
  Trace.exiting(ECFPlugin.getDefault(),ECFDebugOptions.METHODS_EXITING,this.getClass(),method,result);
  return result;
}
Program: 95059
Project: 95059
Buggy source:
/** 
 * Get array of supported adapters for the given container type description. Providers can implement this method to allow clients to inspect the adapter types implemented by the container described by the given description. The returned array entries will be the fully qualified names of the adapter classes. Note that the returned types do not guarantee that a subsequent call to  {@link IContainer#getAdapter(Class)} with the same type name as areturned value will return a non-null result. In other words, even if the class name is in the returned array, subsequent calls to {@link IContainer#getAdapter(Class)} may still return <code>null</code>.This method should not return null, but rather an empty String[] if no adapters are exposed.
 * @param description the ContainerTypeDescription to report adapters for. Must not be null
 * @return String[] of supported adapters. The entries in the returned arraywill be the fully qualified class names of adapters supported by the given description. Null returned if no adapters are supported for given description.
 */
public String[] getSupportedAdapterTypes(ContainerTypeDescription description);

Fixed version (ground truth):
/** 
 * Get array of supported adapters for the given container type description. Providers implement this method to allow clients to inspect the adapter types exposed by the container described by the given description. The returned array entries will be the fully qualified names of the adapter classes. Note that the returned types do not guarantee that a subsequent call to  {@link IContainer#getAdapter(Class)} with the same type name as areturned value will return a non-<code>null</code> result. In other words, even if the class name is in the returned array, subsequent calls to  {@link IContainer#getAdapter(Class)} may still return<code>null</code>.
 * @param description the ContainerTypeDescription to report adapters for. Must not be <code>null</code>.
 * @return String[] of supported adapters. The entries in the returned arraywill be the fully qualified class names of adapters supported by the given description. <code>null</code> will be returned by the provider if no adapters are supported for this description.
 */
public String[] getSupportedAdapterTypes(ContainerTypeDescription description);
Program: 95061
Project: 95061
Buggy source:
public void handleInvitationReceived(ID roomID,ID from,ID toID,String subject,String body){
  System.out.println("String_Node_Str" + roomID + "String_Node_Str"+ from+ "String_Node_Str"+ toID+ "String_Node_Str"+ subject+ "String_Node_Str"+ body);
}

Fixed version (ground truth):
public void handleInvitationReceived(ID roomID,ID from,String subject,String body){
  System.out.println("String_Node_Str" + roomID + "String_Node_Str"+ from+ "String_Node_Str"+ subject+ "String_Node_Str"+ body);
}
Program: 95062
Project: 95062
Buggy source:
public void handleInvitationReceived(ID roomID,ID from,ID toID,String subject,String body){
  System.out.println("String_Node_Str" + roomID + "String_Node_Str"+ from+ "String_Node_Str"+ toID+ "String_Node_Str"+ subject+ "String_Node_Str"+ body);
}

Fixed version (ground truth):
public void handleInvitationReceived(ID roomID,ID from,String subject,String body){
  System.out.println("String_Node_Str" + roomID + "String_Node_Str"+ from+ "String_Node_Str"+ subject+ "String_Node_Str"+ body);
}
Program: 95063
Project: 95063
Buggy source:
/** 
 * Handle notification of a received invitation to join chat room. This method will be called by some thread when an invitiation is received by this user account to join a chat room
 * @param roomID the room id associated with the invitation
 * @param from the id of the sender
 * @param to the id of the intended receiver
 * @param subject a subject for the invitation
 * @param body a message body for the invitation
 */
public void handleInvitationReceived(ID roomID,ID from,ID to,String subject,String body);

Fixed version (ground truth):
/** 
 * Handle notification of a received invitation to join chat room. This method will be called by some thread when an invitiation is received by this user account to join a chat room
 * @param roomID the room id associated with the invitation
 * @param from the id of the sender
 * @param subject a subject for the invitation
 * @param body a message body for the invitation
 */
public void handleInvitationReceived(ID roomID,ID from,String subject,String body);
Program: 95064
Project: 95064
Buggy source:
public IAccountManager getAccountManager(){
  return new IAccountManager(){
    public boolean changePassword(    String newpassword) throws ECFException {
      return delegate.changePassword(newpassword);
    }
    public boolean createAccount(    String username,    String password,    Map attributes) throws ECFException {
      return delegate.createAccount(username,password,attributes);
    }
    public boolean deleteAccount() throws ECFException {
      return delegate.deleteAccount();
    }
    public String getAccountInstructions() throws ECFException {
      return delegate.getAccountInstructions();
    }
    public String[] getAccountAttributeNames() throws ECFException {
      return delegate.getAccountAttributeNames();
    }
    public Object getAccountAttribute(    String name) throws ECFException {
      return delegate.getAccountAttribute(name);
    }
    public boolean isAccountCreationSupported(){
      return delegate.isAccountCreationSupported();
    }
  }
;
}

Fixed version (ground truth):
public IAccountManager getAccountManager(){
  return new IAccountManager(){
    public boolean changePassword(    String newpassword) throws ECFException {
      return delegate.changePassword(newpassword);
    }
    public boolean createAccount(    String username,    String password,    Map attributes) throws ECFException {
      return delegate.createAccount(username,password,attributes);
    }
    public boolean deleteAccount() throws ECFException {
      return delegate.deleteAccount();
    }
    public String getAccountCreationInstructions() throws ECFException {
      return delegate.getAccountCreationInstructions();
    }
    public String[] getAccountAttributeNames() throws ECFException {
      return delegate.getAccountAttributeNames();
    }
    public Object getAccountAttribute(    String name) throws ECFException {
      return delegate.getAccountAttribute(name);
    }
    public boolean isAccountCreationSupported(){
      return delegate.isAccountCreationSupported();
    }
  }
;
}
Program: 95065
Project: 95065
Buggy source:
protected void fireInvitationReceived(ID roomID,ID fromID,ID toID,String subject,String body){
  for (Iterator i=invitationListeners.iterator(); i.hasNext(); ) {
    IInvitationListener l=(IInvitationListener)i.next();
    l.handleInvitationReceived(roomID,fromID,toID,subject,body);
  }
}

Fixed version (ground truth):
protected void fireInvitationReceived(ID roomID,ID fromID,ID toID,String subject,String body){
  for (Iterator i=invitationListeners.iterator(); i.hasNext(); ) {
    IInvitationListener l=(IInvitationListener)i.next();
    l.handleInvitationReceived(roomID,fromID,subject,body);
  }
}
Program: 95066
Project: 95066
Buggy source:
public PermissionCollection checkConnect(Object addr,ID fromID,ID targetID,String targetGroup,Object joinData) throws SecurityException {
  System.out.println("String_Node_Str" + addr + "String_Node_Str"+ fromID+ "String_Node_Str"+ targetGroup+ "String_Node_Str"+ joinData);
  return null;
}

Fixed version (ground truth):
public PermissionCollection checkConnect(Object addr,ID fromID,ID targetID,String targetGroup,Object joinData) throws Exception {
  System.out.println("String_Node_Str" + addr + "String_Node_Str"+ fromID+ "String_Node_Str"+ targetGroup+ "String_Node_Str"+ joinData);
  return null;
}
Program: 95068
Project: 95068
Buggy source:
protected ID handleConnectResponse(ID orginalTarget,Object serverData) throws Exception {
  ContainerMessage aPacket=(ContainerMessage)serverData;
  ID fromID=aPacket.getFromContainerID();
  if (fromID == null)   throw new InvalidObjectException("String_Node_Str");
  ID[] ids=((ContainerMessage.ViewChangeMessage)aPacket.getData()).getChangeIDs();
  if (ids == null)   throw new java.io.InvalidObjectException("String_Node_Str");
  for (int i=0; i < ids.length; i++) {
    ID id=ids[i];
    if (id != null && !id.equals(getID())) {
      addNewRemoteMember(id,null);
      fireContainerEvent(new ContainerConnectedEvent(this.getID(),id));
    }
  }
  return fromID;
}

Fixed version (ground truth):
protected ID handleConnectResponse(ID orginalTarget,Object serverData) throws Exception {
  ContainerMessage aPacket=(ContainerMessage)serverData;
  ID fromID=aPacket.getFromContainerID();
  if (fromID == null)   throw new NullPointerException("String_Node_Str");
  ContainerMessage.ViewChangeMessage viewChangeMessage=(ContainerMessage.ViewChangeMessage)aPacket.getData();
  if (!viewChangeMessage.isAdd()) {
    Object data=viewChangeMessage.getData();
    if (data != null && data instanceof Exception)     throw (Exception)data;
 else     throw new NullPointerException("String_Node_Str");
  }
  ID[] ids=viewChangeMessage.getChangeIDs();
  if (ids == null)   throw new NullPointerException("String_Node_Str");
  for (int i=0; i < ids.length; i++) {
    ID id=ids[i];
    if (id != null && !id.equals(getID())) {
      addNewRemoteMember(id,null);
      fireContainerEvent(new ContainerConnectedEvent(this.getID(),id));
    }
  }
  return fromID;
}
Program: 95071
Project: 95071
Buggy source:
protected final static Namespace removeNamespace0(Namespace n){
  if (n == null)   return null;
  return (Namespace)namespaces.remove(n);
}

Fixed version (ground truth):
protected final static Namespace removeNamespace0(Namespace n){
  if (n == null)   return null;
  return (Namespace)namespaces.remove(n.getName());
}
Program: 95072
Project: 95072
Buggy source:
public ID createInstance(Object[] args) throws IDCreateException {
  return new StringID(this,(String)args[0]);
}

Fixed version (ground truth):
public ID createInstance(Object[] args) throws IDCreateException {
  if (args == null || args.length == 0) {
    throw new IDCreateException("String_Node_Str");
  }
 else   return new StringID(this,(String)args[0]);
}
Program: 95073
Project: 95073
Buggy source:
public IRemoteServiceReference[] getRemoteServiceReferences(ID[] idFilter,String clazz,String filter){
  IRemoteFilter remoteFilter=createRemoteFilterFromString(filter);
  List references=new ArrayList();
synchronized (remoteRegistrys) {
    if (idFilter == null) {
      ArrayList registrys=new ArrayList(remoteRegistrys.values());
      for (Iterator i=registrys.iterator(); i.hasNext(); ) {
        RemoteServiceRegistryImpl registry=(RemoteServiceRegistryImpl)i.next();
        addReferencesFromRegistry(clazz,remoteFilter,registry,references);
      }
    }
 else {
      for (int i=0; i < idFilter.length; i++) {
        RemoteServiceRegistryImpl registry=(RemoteServiceRegistryImpl)remoteRegistrys.get(idFilter[i]);
        if (registry != null)         addReferencesFromRegistry(clazz,remoteFilter,registry,references);
      }
    }
  }
  return (IRemoteServiceReference[])references.toArray(new IRemoteServiceReference[references.size()]);
}

Fixed version (ground truth):
public IRemoteServiceReference[] getRemoteServiceReferences(ID[] idFilter,String clazz,String filter){
  IRemoteFilter remoteFilter=createRemoteFilterFromString(filter);
  List references=new ArrayList();
synchronized (remoteRegistrys) {
    if (idFilter == null) {
      ArrayList registrys=new ArrayList(remoteRegistrys.values());
      for (Iterator i=registrys.iterator(); i.hasNext(); ) {
        RemoteServiceRegistryImpl registry=(RemoteServiceRegistryImpl)i.next();
        addReferencesFromRegistry(clazz,remoteFilter,registry,references);
      }
    }
 else {
      for (int i=0; i < idFilter.length; i++) {
        RemoteServiceRegistryImpl registry=(RemoteServiceRegistryImpl)remoteRegistrys.get(idFilter[i]);
        if (registry != null)         addReferencesFromRegistry(clazz,remoteFilter,registry,references);
      }
    }
  }
synchronized (localRegistry) {
    addReferencesFromRegistry(clazz,remoteFilter,localRegistry,references);
  }
  return (IRemoteServiceReference[])references.toArray(new IRemoteServiceReference[references.size()]);
}
Program: 95074
Project: 95074
Buggy source:
public IRemoteServiceRegistration registerRemoteService(String[] clazzes,Object service,Dictionary properties){
  if (service == null)   throw new NullPointerException("String_Node_Str");
  int size=clazzes.length;
  if (size == 0)   throw new IllegalArgumentException("String_Node_Str");
  String[] copy=new String[clazzes.length];
  for (int i=0; i < clazzes.length; i++) {
    copy[i]=new String(clazzes[i].getBytes());
  }
  clazzes=copy;
  String invalidService=checkServiceClass(clazzes,service);
  if (invalidService != null)   throw new IllegalArgumentException("String_Node_Str" + invalidService);
  RemoteServiceRegistrationImpl reg=new RemoteServiceRegistrationImpl();
  reg.publish(this,localRegistry,service,clazzes,properties);
  sendAddRegistration(reg);
  return reg;
}

Fixed version (ground truth):
public IRemoteServiceRegistration registerRemoteService(String[] clazzes,Object service,Dictionary properties){
  if (service == null)   throw new NullPointerException("String_Node_Str");
  int size=clazzes.length;
  if (size == 0)   throw new IllegalArgumentException("String_Node_Str");
  String[] copy=new String[clazzes.length];
  for (int i=0; i < clazzes.length; i++) {
    copy[i]=new String(clazzes[i].getBytes());
  }
  clazzes=copy;
  String invalidService=checkServiceClass(clazzes,service);
  if (invalidService != null)   throw new IllegalArgumentException("String_Node_Str" + invalidService);
  RemoteServiceRegistrationImpl reg=new RemoteServiceRegistrationImpl();
  reg.publish(this,localRegistry,service,clazzes,properties);
  sendAddRegistration(null,reg);
  return reg;
}
Program: 95075
Project: 95075
Buggy source:
protected void sendAddRegistration(RemoteServiceRegistrationImpl reg){
  trace("String_Node_Str" + null + "String_Node_Str"+ reg+ "String_Node_Str");
  try {
    sendSharedObjectMsgTo(null,SharedObjectMsg.createMsg(null,ADD_REGISTRATION,getLocalContainerID(),reg));
  }
 catch (  IOException e) {
    logSendError(ADD_REGISTRATION_ERROR_CODE,ADD_REGISTRATION_ERROR_MESSAGE,e);
  }
}

Fixed version (ground truth):
protected void sendAddRegistration(ID receiver,RemoteServiceRegistrationImpl reg){
  trace("String_Node_Str" + null + "String_Node_Str"+ reg+ "String_Node_Str");
  try {
    sendSharedObjectMsgTo(null,SharedObjectMsg.createMsg(null,ADD_REGISTRATION,getLocalContainerID(),reg));
  }
 catch (  IOException e) {
    logSendError(ADD_REGISTRATION_ERROR_CODE,ADD_REGISTRATION_ERROR_MESSAGE,e);
  }
}
Program: 95076
Project: 95076
Buggy source:
protected void handleContainerConnectedEvent(IContainerConnectedEvent event){
  if (getContext().isGroupManager() || event.getTargetID().equals(getGroupID())) {
    trace("String_Node_Str" + getLocalContainerID() + "String_Node_Str"+ getGroupID());
synchronized (localRegistry) {
      RemoteServiceRegistrationImpl registrations[]=localRegistry.getRegistrations();
      if (registrations != null)       for (int i=0; i < registrations.length; i++) {
        RemoteServiceRegistrationImpl registration=registrations[i];
        sendAddRegistration(registration);
      }
    }
  }
}

Fixed version (ground truth):
protected void handleContainerConnectedEvent(IContainerConnectedEvent event){
  ID targetID=event.getTargetID();
  if (getContext().isGroupManager() || event.getTargetID().equals(getGroupID())) {
    targetID=null;
  }
synchronized (localRegistry) {
    RemoteServiceRegistrationImpl registrations[]=localRegistry.getRegistrations();
    if (registrations != null)     for (int i=0; i < registrations.length; i++) {
      RemoteServiceRegistrationImpl registration=registrations[i];
      sendAddRegistration(targetID,registration);
    }
  }
}
Program: 95077
Project: 95077
Buggy source:
/** 
 * Cancel this file transfer.  If file transfer has already been completed, then this method has no effect.  If the file transfer has not been completed then calling this method will result in an   {@link IFileTransferEvent} beingdelivered to the  {@link IFileTransferListener} indicating that transferis done ( {@link #isDone()} returns true), and some exception will be madeavailable
 */
public void cancel();

Fixed version (ground truth):
/** 
 * Cancel this file transfer. If file transfer has already been completed, then this method has no effect. If the file transfer has not been completed then calling this method will result in an  {@link IFileTransferEvent} being delivered to the{@link IFileTransferListener} indicating that transfer is done ({@link #isDone()}returns true), and some exception will be made available
 */
public void cancel();
Program: 95078
Project: 95078
Buggy source:
/** 
 * Get any properties associated with this file transfer. The map keys and values are assumed to be Strings.
 * @return Map of properties associated with this file transfer info.Will not return null.
 */
public Map getProperties();

Fixed version (ground truth):
/** 
 * Get any properties associated with this file transfer. The map keys and values are assumed to be Strings.
 * @return Map of properties associated with this file transfer info. Willnot return null.
 */
public Map getProperties();
Program: 95079
Project: 95079
Buggy source:
public final boolean initialize(String name,String desc){
  if (name == null)   throw new RuntimeException(new InstantiationException("String_Node_Str"));
  if (!isInitialized) {
    this.name=name;
    this.description=desc;
    this.hashCode=name.hashCode();
    return true;
  }
 else   return false;
}

Fixed version (ground truth):
public final boolean initialize(String name,String desc){
  if (name == null)   throw new RuntimeException(new InstantiationException("String_Node_Str"));
  if (!isInitialized) {
    this.name=name;
    this.description=desc;
    this.hashCode=name.hashCode();
    this.isInitialized=true;
    return true;
  }
 else   return false;
}
Program: 95080
Project: 95080
Buggy source:
protected void openStreams() throws IncomingFileTransferException {
  URL theURL=null;
  try {
    theURL=getRemoteFileReference().toURL();
    urlConnection=theURL.openConnection();
    setInputStream(urlConnection.getInputStream());
    setFileLength(fileLength=urlConnection.getContentLength());
    listener.handleTransferEvent(new IIncomingFileTransferReceiveStartEvent(){
      private static final long serialVersionUID=-59096575294481755L;
      public URI getURI(){
        try {
          return new URI(urlConnection.getURL().toString());
        }
 catch (        Exception e) {
          return getRemoteFileReference();
        }
      }
      public IIncomingFileTransfer receive(      File localFileToSave) throws IOException {
        setOutputStream(new BufferedOutputStream(new FileOutputStream(localFileToSave)));
        job=new FileTransferJob(getRemoteFileReference().toString());
        job.schedule();
        return UrlRetrieveFileTransfer.this;
      }
      public String toString(){
        StringBuffer sb=new StringBuffer("String_Node_Str");
        sb.append("String_Node_Str").append(done).append("String_Node_Str");
        sb.append("String_Node_Str").append(bytesReceived).append("String_Node_Str");
        return sb.toString();
      }
    }
);
  }
 catch (  Exception e) {
    throw new IncomingFileTransferException("String_Node_Str" + theURL.toString(),e);
  }
}

Fixed version (ground truth):
protected void openStreams() throws IncomingFileTransferException {
  URL theURL=null;
  try {
    theURL=getRemoteFileReference().toURL();
    urlConnection=theURL.openConnection();
    setInputStream(urlConnection.getInputStream());
    setFileLength(fileLength=urlConnection.getContentLength());
    listener.handleTransferEvent(new IIncomingFileTransferReceiveStartEvent(){
      private static final long serialVersionUID=-59096575294481755L;
      public URI getURI(){
        try {
          return new URI(urlConnection.getURL().toString());
        }
 catch (        Exception e) {
          return getRemoteFileReference();
        }
      }
      public IIncomingFileTransfer receive(      File localFileToSave) throws IOException {
        setOutputStream(new BufferedOutputStream(new FileOutputStream(localFileToSave)));
        job=new FileTransferJob(getRemoteFileReference().toString());
        job.schedule();
        return UrlRetrieveFileTransfer.this;
      }
      public String toString(){
        StringBuffer sb=new StringBuffer("String_Node_Str");
        sb.append("String_Node_Str").append(done).append("String_Node_Str");
        sb.append("String_Node_Str").append(bytesReceived).append("String_Node_Str");
        return sb.toString();
      }
      public void cancel(){
        hardClose();
      }
    }
);
  }
 catch (  Exception e) {
    throw new IncomingFileTransferException("String_Node_Str" + theURL.toString(),e);
  }
}
Program: 95081
Project: 95081
Buggy source:
public IContainer createInstance(ContainerTypeDescription description,Object[] args) throws ContainerCreateException {
  boolean isClient=true;
  if (description.getName().equals(TCPSERVER_NAME)) {
    debug("String_Node_Str");
    isClient=false;
  }
 else {
    debug("String_Node_Str");
  }
  ID newID=null;
  try {
    String[] argDefaults=description.getArgDefaults();
    newID=(argDefaults == null || argDefaults.length == 0) ? null : getIDFromArg(description.getArgDefaults()[0]);
    Integer ka=(argDefaults == null || argDefaults.length < 2) ? null : getIntegerFromArg(description.getArgDefaults()[1]);
    if (args != null) {
      if (args.length > 0) {
        newID=getIDFromArg(args[0]);
        if (args.length > 1) {
          ka=getIntegerFromArg(args[1]);
        }
      }
    }
    debug("String_Node_Str" + newID + "String_Node_Str"+ ka);
    if (newID == null)     throw new ContainerCreateException("String_Node_Str");
    if (isClient) {
      return new TCPClientSOContainer(new SOContainerConfig(newID),ka.intValue());
    }
 else {
      return new TCPServerSOContainer(new SOContainerConfig(newID),ka.intValue());
    }
  }
 catch (  ClassCastException e) {
    traceStack("String_Node_Str",e);
    throw new ContainerCreateException("String_Node_Str",e);
  }
catch (  Exception e) {
    traceStack("String_Node_Str",e);
    throw new ContainerCreateException("String_Node_Str" + newID,e);
  }
}

Fixed version (ground truth):
public IContainer createInstance(ContainerTypeDescription description,Object[] args) throws ContainerCreateException {
  boolean isClient=true;
  if (description.getName().equals(TCPSERVER_NAME)) {
    debug("String_Node_Str");
    isClient=false;
  }
 else {
    debug("String_Node_Str");
  }
  try {
    GenericContainerArgs gcargs=null;
    String[] argDefaults=description.getArgDefaults();
    if (isClient)     gcargs=getClientArgs(argDefaults,args);
 else     gcargs=getServerArgs(argDefaults,args);
    if (isClient) {
      return new TCPClientSOContainer(new SOContainerConfig(gcargs.getID()),gcargs.getKeepAlive().intValue());
    }
 else {
      return new TCPServerSOContainer(new SOContainerConfig(gcargs.getID()),gcargs.getKeepAlive().intValue());
    }
  }
 catch (  Exception e) {
    traceStack("String_Node_Str",e);
    throw new ContainerCreateException("String_Node_Str",e);
  }
}
Program: 95082
Project: 95082
Buggy source:
protected ISharedObjectContainer createClient() throws Exception {
  ID newContainerID=IDFactory.getDefault().createGUID();
  ISharedObjectContainer result=SharedObjectContainerFactory.getDefault().createSharedObjectContainer(contd,null,new Object[]{newContainerID,new Integer(DEFAULT_TIMEOUT)});
  return result;
}

Fixed version (ground truth):
protected ISharedObjectContainer createClient() throws Exception {
  ID newContainerID=IDFactory.getDefault().createGUID();
  ISharedObjectContainer result=SharedObjectContainerFactory.getDefault().createSharedObjectContainer(contd,new Object[]{newContainerID,new Integer(DEFAULT_TIMEOUT)});
  return result;
}
Program: 95083
Project: 95083
Buggy source:
public void handleEvent(Event event){
  traceEntering("String_Node_Str",event);
  Trace.trace(Activator.getDefault(),getID() + "String_Node_Str" + "String_Node_Str"+ event+ "String_Node_Str");
synchronized (eventProcessors) {
    fireEventProcessors(event);
  }
  traceExiting("String_Node_Str",event);
}

Fixed version (ground truth):
public void handleEvent(Event event){
  traceEntering("String_Node_Str",event);
synchronized (eventProcessors) {
    fireEventProcessors(event);
  }
  traceExiting("String_Node_Str");
}
Program: 95084
Project: 95084
Buggy source:
protected void destroySelfLocal(){
  traceEntering("String_Node_Str",null);
  try {
    ISharedObjectManager manager=getContext().getSharedObjectManager();
    if (manager != null) {
      manager.removeSharedObject(getID());
    }
  }
 catch (  Exception e) {
    traceCatching("String_Node_Str",e);
  }
  traceExiting("String_Node_Str",null);
}

Fixed version (ground truth):
protected void destroySelfLocal(){
  traceEntering("String_Node_Str");
  try {
    ISharedObjectManager manager=getContext().getSharedObjectManager();
    if (manager != null) {
      manager.removeSharedObject(getID());
    }
  }
 catch (  Exception e) {
    traceCatching("String_Node_Str",e);
    logError(DESTROYSELFLOCAL_CODE,"String_Node_Str",e);
  }
  traceExiting("String_Node_Str");
}
Program: 95085
Project: 95085
Buggy source:
/** 
 * Send SharedObjectMessage to container with given ID. The toID parameter may be null, and if null the message will be delivered to <b>all</b> containers in group. The second parameter may not be null.
 * @param toID the target container ID for the SharedObjectMsg. If null, the given message is sent to all other containers currently in group
 * @param msg the message instance to send
 * @throws IOException thrown if the local container is not connected or unable to send for other reason
 */
protected void sendSharedObjectMsgTo(ID toID,SharedObjectMsg msg) throws IOException {
  if (msg == null)   throw new NullPointerException("String_Node_Str");
  String method="String_Node_Str";
  traceEntering(method,new Object[]{toID,msg});
  getContext().sendMessage(toID,new SharedObjectMsgEvent(getID(),toID,msg));
  traceExiting(method,null);
}

Fixed version (ground truth):
/** 
 * Send SharedObjectMessage to container with given ID. The toID parameter may be null, and if null the message will be delivered to <b>all</b> containers in group. The second parameter may not be null.
 * @param toID the target container ID for the SharedObjectMsg. If null, the given message is sent to all other containers currently in group
 * @param msg the message instance to send
 * @throws IOException thrown if the local container is not connected or unable to send for other reason
 */
protected void sendSharedObjectMsgTo(ID toID,SharedObjectMsg msg) throws IOException {
  if (msg == null)   throw new NullPointerException("String_Node_Str");
  String method="String_Node_Str";
  traceEntering(method,new Object[]{toID,msg});
  getContext().sendMessage(toID,new SharedObjectMsgEvent(getID(),toID,msg));
  traceExiting(method);
}