nus-yam/ex-repair huggingface dataset:
Program: 95086
Project: 95086
Buggy source:
/** 
 * Handle a ISharedObjectCreateResponseEvent. This handler is called by handleSharedObjectMsgEvent when the ISharedObjectMessageEvent is of type ISharedObjectCreateResponseEvent. This default implementation simply returns false. Subclasses may override as appropriate. Note that if return value is true, it will prevent subsequent event processors from having a chance to process event
 * @param createResponseEvent the ISharedObjectCreateResponseEvent received
 * @return true if the provided event should receive no further processing.If false the provided Event should be passed to subsequent event processors.
 */
protected boolean handleSharedObjectCreateResponseEvent(ISharedObjectCreateResponseEvent createResponseEvent){
  traceEntering("String_Node_Str",createResponseEvent);
  return false;
}

Fixed version (ground truth):
/** 
 * Handle a ISharedObjectCreateResponseEvent. This handler is called by handleSharedObjectMsgEvent when the ISharedObjectMessageEvent is of type ISharedObjectCreateResponseEvent. This default implementation simply returns false. Subclasses may override as appropriate. Note that if return value is true, it will prevent subsequent event processors from having a chance to process event
 * @param createResponseEvent the ISharedObjectCreateResponseEvent received
 * @return true if the provided event should receive no further processing.If false the provided Event should be passed to subsequent event processors.
 */
protected boolean handleSharedObjectCreateResponseEvent(ISharedObjectCreateResponseEvent createResponseEvent){
  return false;
}
Program: 95087
Project: 95087
Buggy source:
public final void init(ISharedObjectConfig initData) throws SharedObjectInitException {
  String methodName="String_Node_Str";
  traceEntering(methodName,new Object[]{initData});
  this.config=initData;
  addEventProcessor(new SharedObjectMsgEventProcessor(this));
  initialize();
  traceExiting(methodName,null);
}

Fixed version (ground truth):
public final void init(ISharedObjectConfig initData) throws SharedObjectInitException {
  this.config=initData;
  traceEntering("String_Node_Str",initData);
  addEventProcessor(new SharedObjectMsgEventProcessor(this));
  initialize();
  traceExiting("String_Node_Str");
}
Program: 95088
Project: 95088
Buggy source:
/** 
 * Send SharedObjectMsg to local shared object. This places the given message at the end of this shared object's message queue for processing.
 * @param msg the message instance to send.
 */
protected void sendSharedObjectMsgToSelf(SharedObjectMsg msg){
  if (msg == null)   throw new NullPointerException("String_Node_Str");
  ISharedObjectContext context=getContext();
  if (context == null)   return;
  IQueueEnqueue queue=context.getQueue();
  try {
    queue.enqueue(new SharedObjectMsgEvent(getID(),getContext().getLocalContainerID(),msg));
  }
 catch (  QueueException e) {
    traceCatching("String_Node_Str",e);
    Activator.getDefault().getLog().log(new Status(IStatus.ERROR,Activator.PLUGIN_ID,DESTROYREMOTE_CODE,"String_Node_Str" + getID(),e));
  }
}

Fixed version (ground truth):
/** 
 * Send SharedObjectMsg to local shared object. This places the given message at the end of this shared object's message queue for processing.
 * @param msg the message instance to send.
 */
protected void sendSharedObjectMsgToSelf(SharedObjectMsg msg){
  if (msg == null)   throw new NullPointerException("String_Node_Str");
  ISharedObjectContext context=getContext();
  if (context == null)   return;
  IQueueEnqueue queue=context.getQueue();
  try {
    queue.enqueue(new SharedObjectMsgEvent(getID(),getContext().getLocalContainerID(),msg));
  }
 catch (  QueueException e) {
    traceCatching("String_Node_Str",e);
    logError(DESTROYREMOTE_CODE,"String_Node_Str",e);
  }
}
Program: 95089
Project: 95089
Buggy source:
/** 
 * Get SharedObjectMsg from ISharedObjectMessageEvent. ISharedObjectMessageEvents can come from both local and remote sources. In the remote case, the SharedObjectMsg has to be retrieved from the RemoteSharedObjectEvent rather than the ISharedObjectMessageEvent.getData() directly. This method will provide a non-null SharedObjectMsg if it's provided either via remotely or locally. Returns null if the given event does not provide a valid SharedObjectMsg.
 * @param event
 * @return SharedObjectMsg the SharedObjectMsg delivered by the given event
 */
protected SharedObjectMsg getSharedObjectMsgFromEvent(ISharedObjectMessageEvent event){
  String method="String_Node_Str";
  traceEntering(method,event);
  Object eventData=event.getData();
  Object msgData=null;
  if (eventData != null && eventData instanceof RemoteSharedObjectEvent) {
    Object rsoeData=((RemoteSharedObjectEvent)event).getData();
    if (rsoeData != null && rsoeData instanceof SharedObjectMsgEvent)     msgData=((SharedObjectMsgEvent)rsoeData).getData();
  }
 else   msgData=eventData;
  if (msgData != null && msgData instanceof SharedObjectMsg)   return (SharedObjectMsg)msgData;
  return null;
}

Fixed version (ground truth):
/** 
 * Get SharedObjectMsg from ISharedObjectMessageEvent. ISharedObjectMessageEvents can come from both local and remote sources. In the remote case, the SharedObjectMsg has to be retrieved from the RemoteSharedObjectEvent rather than the ISharedObjectMessageEvent.getData() directly. This method will provide a non-null SharedObjectMsg if it's provided either via remotely or locally. Returns null if the given event does not provide a valid SharedObjectMsg.
 * @param event
 * @return SharedObjectMsg the SharedObjectMsg delivered by the given event
 */
protected SharedObjectMsg getSharedObjectMsgFromEvent(ISharedObjectMessageEvent event){
  traceEntering("String_Node_Str",event);
  Object eventData=event.getData();
  Object msgData=null;
  if (eventData != null && eventData instanceof RemoteSharedObjectEvent) {
    Object rsoeData=((RemoteSharedObjectEvent)event).getData();
    if (rsoeData != null && rsoeData instanceof SharedObjectMsgEvent)     msgData=((SharedObjectMsgEvent)rsoeData).getData();
  }
 else   msgData=eventData;
  if (msgData != null && msgData instanceof SharedObjectMsg) {
    traceExiting("String_Node_Str",msgData);
    return (SharedObjectMsg)msgData;
  }
 else {
    traceExiting("String_Node_Str",null);
    return null;
  }
}
Program: 95090
Project: 95090
Buggy source:
/** 
 * SharedObjectMsg handler method. This method will be called by  {@link #handleSharedObjectMsgEvent(ISharedObjectMessageEvent)} when aSharedObjectMsg is received either from a local source or a remote source. This default implementation simply returns false so that other processing of of the given msg can occur. Subclasses should override this behavior to define custom logic for handling SharedObjectMsgs.
 * @param msg the SharedObjectMsg received
 * @return true if the msg has been completely handled and subsequentprocessing should stop. False if processing should continue
 */
protected boolean handleSharedObjectMsg(SharedObjectMsg msg){
  traceEntering("String_Node_Str",msg);
  return false;
}

Fixed version (ground truth):
/** 
 * SharedObjectMsg handler method. This method will be called by  {@link #handleSharedObjectMsgEvent(ISharedObjectMessageEvent)} when aSharedObjectMsg is received either from a local source or a remote source. This default implementation simply returns false so that other processing of of the given msg can occur. Subclasses should override this behavior to define custom logic for handling SharedObjectMsgs.
 * @param msg the SharedObjectMsg received
 * @return true if the msg has been completely handled and subsequentprocessing should stop. False if processing should continue
 */
protected boolean handleSharedObjectMsg(SharedObjectMsg msg){
  return false;
}
Program: 95091
Project: 95091
Buggy source:
private void traceCatching(String method,Throwable t){
  Trace.catching(Activator.getDefault(),SharedObjectDebugOptions.EXCEPTIONS_CATCHING,BaseSharedObject.class,getID() + "String_Node_Str" + method,t);
}

Fixed version (ground truth):
protected void traceCatching(String method,Throwable t){
  Trace.catching(Activator.getDefault(),SharedObjectDebugOptions.EXCEPTIONS_CATCHING,this.getClass(),getSharedObjectAsString(method),t);
}
Program: 95092
Project: 95092
Buggy source:
/** 
 * Replicate this shared object to a given set of remote containers. This method will invoke the method getReplicaDescriptions in order to determine the set of ReplicaSharedObjectDescriptions to send to remote containers.
 * @param remoteContainers the set of remote containers to replicate to. If null, <b>all</b> containers in the current group are sent a message to create a replica of this shared object.
 */
protected void replicateToRemoteContainers(ID[] remoteContainers){
  traceEntering("String_Node_Str",remoteContainers);
  try {
    ISharedObjectContext context=getContext();
    if (context == null)     return;
    ID[] group=context.getGroupMemberIDs();
    if (group == null || group.length < 1) {
      return;
    }
    ReplicaSharedObjectDescription[] createInfos=getReplicaDescriptions(remoteContainers);
    if (createInfos != null) {
      if (createInfos.length == 1) {
        context.sendCreate((remoteContainers == null) ? null : remoteContainers[0],createInfos[0]);
      }
 else {
        for (int i=0; i < remoteContainers.length; i++) {
          context.sendCreate(remoteContainers[i],createInfos[i]);
        }
      }
    }
  }
 catch (  IOException e) {
    traceCatching("String_Node_Str",e);
    Activator.getDefault().getLog().log(new Status(IStatus.ERROR,Activator.PLUGIN_ID,DESTROYREMOTE_CODE,"String_Node_Str" + getID(),e));
  }
}

Fixed version (ground truth):
/** 
 * Replicate this shared object to a given set of remote containers. This method will invoke the method getReplicaDescriptions in order to determine the set of ReplicaSharedObjectDescriptions to send to remote containers.
 * @param remoteContainers the set of remote containers to replicate to. If null, <b>all</b> containers in the current group are sent a message to create a replica of this shared object.
 */
protected void replicateToRemoteContainers(ID[] remoteContainers){
  traceEntering("String_Node_Str",remoteContainers);
  try {
    ReplicaSharedObjectDescription[] createInfos=getReplicaDescriptions(remoteContainers);
    if (createInfos != null) {
      if (createInfos.length == 1) {
        getContext().sendCreate((remoteContainers == null) ? null : remoteContainers[0],createInfos[0]);
      }
 else {
        for (int i=0; i < remoteContainers.length; i++) {
          getContext().sendCreate(remoteContainers[i],createInfos[i]);
        }
      }
    }
  }
 catch (  IOException e) {
    traceCatching("String_Node_Str" + DESTROYREMOTE_CODE,e);
    logError(DESTROYREMOTE_CODE,"String_Node_Str",e);
  }
}
Program: 95093
Project: 95093
Buggy source:
protected void destroySelf(){
  traceEntering("String_Node_Str",null);
  if (isPrimary()) {
    try {
      destroyRemote(null);
    }
 catch (    IOException e) {
      traceCatching("String_Node_Str",e);
      Activator.getDefault().getLog().log(new Status(IStatus.ERROR,Activator.PLUGIN_ID,DESTROYREMOTE_CODE,"String_Node_Str" + getID(),e));
    }
  }
  destroySelfLocal();
  traceExiting("String_Node_Str",null);
}

Fixed version (ground truth):
protected void destroySelf(){
  traceEntering("String_Node_Str");
  if (isPrimary()) {
    try {
      destroyRemote(null);
    }
 catch (    IOException e) {
      traceCatching("String_Node_Str",e);
      logError(DESTROYREMOTE_CODE,"String_Node_Str",e);
    }
  }
  destroySelfLocal();
  traceExiting("String_Node_Str");
}
Program: 95094
Project: 95094
Buggy source:
private void traceEntering(String methodName,Object param){
  Trace.entering(Activator.getDefault(),SharedObjectDebugOptions.METHODS_ENTERING,BaseSharedObject.class,getID() + "String_Node_Str" + methodName,param);
}

Fixed version (ground truth):
protected void traceEntering(String methodName,Object param){
  Trace.entering(Activator.getDefault(),SharedObjectDebugOptions.METHODS_ENTERING,this.getClass(),getSharedObjectAsString(methodName));
}
Program: 95095
Project: 95095
Buggy source:
private void traceExiting(String methodName,Object result){
  Trace.entering(Activator.getDefault(),SharedObjectDebugOptions.METHODS_EXITING,BaseSharedObject.class,getID() + "String_Node_Str" + methodName,result);
}

Fixed version (ground truth):
protected void traceExiting(String methodName,Object result){
  Trace.entering(Activator.getDefault(),SharedObjectDebugOptions.METHODS_EXITING,this.getClass(),getSharedObjectAsString(methodName));
}
Program: 95096
Project: 95096
Buggy source:
/** 
 * Handle a ISharedObjectMessageEvent. This method will be automatically called by the SharedObjectMsgEventProcessor when a ISharedObjectMessageEvent is received. The SharedObjectMsgEventProcessor is associated with this object via the initialize() method
 * @param event the event to handle
 * @return true if the provided event should receive no further processing.If false the provided Event should be passed to subsequent event processors.
 */
protected boolean handleSharedObjectMsgEvent(ISharedObjectMessageEvent event){
  traceEntering("String_Node_Str",event);
  if (event instanceof ISharedObjectCreateResponseEvent)   return handleSharedObjectCreateResponseEvent((ISharedObjectCreateResponseEvent)event);
 else {
    SharedObjectMsg msg=getSharedObjectMsgFromEvent(event);
    if (msg != null)     return handleSharedObjectMsg(msg);
 else     return false;
  }
}

Fixed version (ground truth):
/** 
 * Handle a ISharedObjectMessageEvent. This method will be automatically called by the SharedObjectMsgEventProcessor when a ISharedObjectMessageEvent is received. The SharedObjectMsgEventProcessor is associated with this object via the initialize() method
 * @param event the event to handle
 * @return true if the provided event should receive no further processing.If false the provided Event should be passed to subsequent event processors.
 */
protected boolean handleSharedObjectMsgEvent(ISharedObjectMessageEvent event){
  traceEntering("String_Node_Str",event);
  boolean result=false;
  if (event instanceof ISharedObjectCreateResponseEvent)   result=handleSharedObjectCreateResponseEvent((ISharedObjectCreateResponseEvent)event);
 else {
    SharedObjectMsg msg=getSharedObjectMsgFromEvent(event);
    if (msg != null)     result=handleSharedObjectMsg(msg);
  }
  traceExiting("String_Node_Str",new Boolean(result));
  return result;
}
Program: 95097
Project: 95097
Buggy source:
public void dispose(ID containerID){
  traceEntering("String_Node_Str",new Object[]{containerID});
  eventProcessors.clear();
  config=null;
  traceExiting("String_Node_Str",null);
}

Fixed version (ground truth):
public void dispose(ID containerID){
  traceEntering("String_Node_Str",containerID);
  eventProcessors.clear();
  config=null;
  traceExiting("String_Node_Str");
}
Program: 95098
Project: 95098
Buggy source:
/** 
 * Initialize this shared object. Subclasses may override as appropriate to define custom initialization behavior. If initialization should fail, then a SharedObjectInitException should be thrown by implementing code. Also, subclasses overriding this method should call super.initialize() before running their own code.
 * @throws SharedObjectInitException if initialization should throw
 */
protected void initialize() throws SharedObjectInitException {
  traceEntering("String_Node_Str",null);
}

Fixed version (ground truth):
/** 
 * Initialize this shared object. Subclasses may override as appropriate to define custom initialization behavior. If initialization should fail, then a SharedObjectInitException should be thrown by implementing code. Also, subclasses overriding this method should call super.initialize() before running their own code.
 * @throws SharedObjectInitException if initialization should throw
 */
protected void initialize() throws SharedObjectInitException {
  traceEntering("String_Node_Str");
}
Program: 95099
Project: 95099
Buggy source:
public void handleEvents(Event[] events){
  traceEntering("String_Node_Str",events);
  if (events == null)   return;
  for (int i=0; i < events.length; i++) {
    handleEvent(events[i]);
  }
  traceExiting("String_Node_Str",null);
}

Fixed version (ground truth):
public void handleEvents(Event[] events){
  traceEntering("String_Node_Str",events);
  if (events == null)   return;
  for (int i=0; i < events.length; i++) {
    handleEvent(events[i]);
  }
  traceExiting("String_Node_Str");
}
Program: 95100
Project: 95100
Buggy source:
public List getNamespaces(){
  initialize();
  Trace.entering(Activator.getDefault(),IdentityDebugOptions.METHODS_ENTERING,IDFactory.class,"String_Node_Str");
  return new ArrayList(namespaces.values());
}

Fixed version (ground truth):
public List getNamespaces(){
  Trace.entering(Activator.getDefault(),IdentityDebugOptions.METHODS_ENTERING,IDFactory.class,"String_Node_Str");
  return new ArrayList(namespaces.values());
}
Program: 95101
Project: 95101
Buggy source:
public Namespace getNamespaceByName(String name) throws SecurityException {
  initialize();
  Trace.entering(Activator.getDefault(),IdentityDebugOptions.METHODS_ENTERING,IDFactory.class,"String_Node_Str",name);
  Namespace result=getNamespace0(name);
  Trace.exiting(Activator.getDefault(),IdentityDebugOptions.METHODS_EXITING,IDFactory.class,"String_Node_Str",result);
  return result;
}

Fixed version (ground truth):
public Namespace getNamespaceByName(String name) throws SecurityException {
  Trace.entering(Activator.getDefault(),IdentityDebugOptions.METHODS_ENTERING,IDFactory.class,"String_Node_Str",name);
  Namespace result=getNamespace0(name);
  Trace.exiting(Activator.getDefault(),IdentityDebugOptions.METHODS_EXITING,IDFactory.class,"String_Node_Str",result);
  return result;
}
Program: 95102
Project: 95102
Buggy source:
public Namespace getNamespace(Namespace namespace) throws SecurityException {
  initialize();
  Trace.entering(Activator.getDefault(),IdentityDebugOptions.METHODS_ENTERING,IDFactory.class,"String_Node_Str",namespace);
  if (namespace == null)   return null;
  checkPermission(new NamespacePermission(namespace.toString(),NamespacePermission.GET_NAMESPACE));
  Namespace result=getNamespace0(namespace);
  Trace.exiting(Activator.getDefault(),IdentityDebugOptions.METHODS_EXITING,IDFactory.class,"String_Node_Str",result);
  return result;
}

Fixed version (ground truth):
public Namespace getNamespace(Namespace namespace) throws SecurityException {
  Trace.entering(Activator.getDefault(),IdentityDebugOptions.METHODS_ENTERING,IDFactory.class,"String_Node_Str",namespace);
  if (namespace == null)   return null;
  checkPermission(new NamespacePermission(namespace.toString(),NamespacePermission.GET_NAMESPACE));
  Namespace result=getNamespace0(namespace);
  Trace.exiting(Activator.getDefault(),IdentityDebugOptions.METHODS_EXITING,IDFactory.class,"String_Node_Str",result);
  return result;
}
Program: 95103
Project: 95103
Buggy source:
protected IDFactory(){
}

Fixed version (ground truth):
protected IDFactory(){
  if (!initialized) {
    if (standAlone)     System.out.println("String_Node_Str");
 else     Activator.getDefault().setupNamespaceExtensionPoint();
  }
  initialized=true;
}
Program: 95104
Project: 95104
Buggy source:
/** 
 * An ECF client container implementation that runs as an application. <p> Usage: java org.eclipse.ecf.provider.app.ClientApplication &lt;serverid&gt <p> If &lt;serverid&gt; is omitted or "-" is specified, ecftcp://localhost:3282/server" is used.  
 */
public static void main(String[] args) throws Exception {
  ClientApplication st=new ClientApplication();
  st.init(args);
  ID serverID=IDFactory.getDefault().createStringID(st.serverName);
  st.connect(serverID);
  st.createSharedObjects();
  System.out.println("String_Node_Str" + DEFAULT_WAITTIME + "String_Node_Str");
  Thread.sleep(DEFAULT_WAITTIME);
  st.removeSharedObjects();
  st.disconnect();
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * An ECF client container implementation that runs as an application. <p> Usage: java org.eclipse.ecf.provider.app.ClientApplication &lt;serverid&gt <p> If &lt;serverid&gt; is omitted or "-" is specified, ecftcp://localhost:3282/server" is used.  
 */
public static void main(String[] args) throws Exception {
  System.setProperty("String_Node_Str","String_Node_Str");
  System.setProperty("String_Node_Str","String_Node_Str");
  ClientApplication st=new ClientApplication();
  st.init(args);
  ID serverID=IDFactory.getDefault().createStringID(st.serverName);
  st.connect(serverID);
  st.createSharedObjects();
  System.out.println("String_Node_Str" + DEFAULT_WAITTIME + "String_Node_Str");
  Thread.sleep(DEFAULT_WAITTIME);
  st.removeSharedObjects();
  st.disconnect();
  System.out.println("String_Node_Str");
}
Program: 95106
Project: 95106
Buggy source:
protected ContainerFactory(){
  try {
    ECFPlugin.getDefault().addDisposable(new IDisposable(){
      public void dispose(){
        doDispose();
      }
    }
);
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str");
    e.printStackTrace(System.err);
  }
}

Fixed version (ground truth):
protected ContainerFactory(){
  if (!standAlone) {
    ECFPlugin.getDefault().addDisposable(new IDisposable(){
      public void dispose(){
        doDispose();
      }
    }
);
  }
 else {
    System.out.println("String_Node_Str");
  }
}
Program: 95107
Project: 95107
Buggy source:
/** 
 * An ECF client container implementation that runs as an application. <p> Usage: java org.eclipse.ecf.provider.app.ClientApplication &lt;serverid&gt <p> If &lt;serverid&gt; is omitted or "-" is specified, ecftcp://localhost:3282/server" is used.  
 */
public static void main(String[] args) throws Exception {
  System.setProperty("String_Node_Str","String_Node_Str");
  ClientApplication st=new ClientApplication();
  st.init(args);
  ID serverID=IDFactory.getDefault().createStringID(st.serverName);
  st.connect(serverID);
  st.createSharedObjects();
  System.out.println("String_Node_Str" + DEFAULT_WAITTIME + "String_Node_Str");
  Thread.sleep(DEFAULT_WAITTIME);
  st.removeSharedObjects();
  st.disconnect();
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * An ECF client container implementation that runs as an application. <p> Usage: java org.eclipse.ecf.provider.app.ClientApplication &lt;serverid&gt <p> If &lt;serverid&gt; is omitted or "-" is specified, ecftcp://localhost:3282/server" is used.  
 */
public static void main(String[] args) throws Exception {
  ClientApplication st=new ClientApplication();
  st.init(args);
  ID serverID=IDFactory.getDefault().createStringID(st.serverName);
  st.connect(serverID);
  st.createSharedObjects();
  System.out.println("String_Node_Str" + DEFAULT_WAITTIME + "String_Node_Str");
  Thread.sleep(DEFAULT_WAITTIME);
  st.removeSharedObjects();
  st.disconnect();
  System.out.println("String_Node_Str");
}
Program: 95108
Project: 95108
Buggy source:
protected ID getIDFromArg(Object arg) throws IDCreateException {
  if (arg instanceof ID)   return (ID)arg;
  if (arg instanceof String) {
    String val=(String)arg;
    if (val == null || val.equals("String_Node_Str")) {
      return IDFactory.getDefault().createGUID();
    }
 else     return IDFactory.getDefault().createStringID((String)arg);
  }
 else   if (arg instanceof Integer) {
    return IDFactory.getDefault().createGUID(((Integer)arg).intValue());
  }
 else   return IDFactory.getDefault().createGUID();
}

Fixed version (ground truth):
protected ID getIDFromArg(Object arg) throws IDCreateException {
  if (arg instanceof ID)   return (ID)arg;
  if (arg instanceof String) {
    String val=(String)arg;
    if (val.equals("String_Node_Str")) {
      return IDFactory.getDefault().createGUID();
    }
 else     return IDFactory.getDefault().createStringID((String)arg);
  }
 else   if (arg instanceof Integer) {
    return IDFactory.getDefault().createGUID(((Integer)arg).intValue());
  }
 else   return IDFactory.getDefault().createGUID();
}
Program: 95109
Project: 95109
Buggy source:
public IContainer createInstance(ContainerTypeDescription description,Object[] args) throws ContainerCreateException {
  String[] argDefaults=description.getArgDefaults();
  try {
    ID newID=(argDefaults == null || argDefaults.length == 0) ? null : getIDFromArg(description.getArgDefaults()[0]);
    if (args != null) {
      if (args.length > 0) {
        newID=getIDFromArg(args[0]);
      }
    }
 else {
      newID=IDFactory.getDefault().createGUID();
    }
    return new DatashareContainer(new DatashareContainerConfig(newID));
  }
 catch (  IDCreateException e) {
    throw new ContainerCreateException("String_Node_Str" + description,e);
  }
}

Fixed version (ground truth):
public IContainer createInstance(ContainerTypeDescription description,Object[] args) throws ContainerCreateException {
  String[] argDefaults=description.getArgDefaults();
  try {
    ID newID=null;
    if (args != null && args.length != 0) {
      newID=getIDFromArg(args[0]);
    }
 else     if (argDefaults != null && argDefaults.length != 0) {
      newID=getIDFromArg(description.getArgDefaults()[0]);
    }
 else {
      newID=IDFactory.getDefault().createGUID();
    }
    return new DatashareContainer(new DatashareContainerConfig(newID));
  }
 catch (  IDCreateException e) {
    throw new ContainerCreateException("String_Node_Str" + description,e);
  }
}
Program: 95110
Project: 95110
Buggy source:
public ID createInstance(Class[] argTypes,Object[] args) throws IDCreateException {
  if (args == null || args.length <= 0)   return new GUID(this);
 else   return new GUID(this,((Integer)args[0]).intValue());
}

Fixed version (ground truth):
public ID createInstance(Class[] argTypes,Object[] args) throws IDCreateException {
  if (args == null || args.length <= 0)   return new GUID(this);
 else   if (args.length == 1)   return new GUID(((Namespace)args[0]));
 else   if (args.length == 2)   return new GUID(((Namespace)args[0]),((Integer)args[1]).intValue());
 else   return new GUID(this);
}
Program: 95112
Project: 95112
Buggy source:
protected void handleContainerDisconnectedEvent(IContainerDisconnectedEvent event){
  ID targetID=event.getTargetID();
synchronized (remoteRegistrys) {
    RemoteServiceRegistryImpl registry=getRemoteRegistry(targetID);
    if (registry != null) {
      RemoteServiceRegistrationImpl registrations[]=registry.getRegistrations();
      if (registrations != null) {
        for (int i=0; i < registrations.length; i++) {
          trace("String_Node_Str" + registrations[i].getServiceId());
          registry.unpublishService(registrations[i]);
          fireRemoteServiceListeners(createUnregisteredEvent(registrations[i]));
        }
      }
    }
    removeRemoteRegistry(targetID);
  }
}

Fixed version (ground truth):
protected void handleContainerDisconnectedEvent(IContainerDisconnectedEvent event){
  trace("String_Node_Str" + event + "String_Node_Str");
  ID targetID=event.getTargetID();
synchronized (remoteRegistrys) {
    RemoteServiceRegistryImpl registry=getRemoteRegistry(targetID);
    removeRemoteRegistry(targetID);
    if (registry != null) {
      RemoteServiceRegistrationImpl registrations[]=registry.getRegistrations();
      if (registrations != null) {
        for (int i=0; i < registrations.length; i++) {
          trace("String_Node_Str" + registrations[i].getServiceId());
          registry.unpublishService(registrations[i]);
          fireRemoteServiceListeners(createUnregisteredEvent(registrations[i]));
        }
      }
    }
  }
}
Program: 95113
Project: 95113
Buggy source:
protected void handleContainerDisconnectedEvent(IContainerDisconnectedEvent event){
  trace("String_Node_Str" + event + "String_Node_Str");
  ID targetID=event.getTargetID();
synchronized (remoteRegistrys) {
    RemoteServiceRegistryImpl registry=getRemoteRegistry(targetID);
    removeRemoteRegistry(targetID);
    if (registry != null) {
      RemoteServiceRegistrationImpl registrations[]=registry.getRegistrations();
      if (registrations != null) {
        for (int i=0; i < registrations.length; i++) {
          trace("String_Node_Str" + registrations[i].getServiceId());
          registry.unpublishService(registrations[i]);
          fireRemoteServiceListeners(createUnregisteredEvent(registrations[i]));
        }
      }
    }
  }
}

Fixed version (ground truth):
protected void handleContainerDisconnectedEvent(IContainerDisconnectedEvent event){
  trace("String_Node_Str" + event + "String_Node_Str");
  ID targetID=event.getTargetID();
synchronized (remoteRegistrys) {
    RemoteServiceRegistryImpl registry=getRemoteRegistry(targetID);
    if (registry != null) {
      removeRemoteRegistry(targetID);
      RemoteServiceRegistrationImpl registrations[]=registry.getRegistrations();
      if (registrations != null) {
        for (int i=0; i < registrations.length; i++) {
          trace("String_Node_Str" + registrations[i].getServiceId());
          registry.unpublishService(registrations[i]);
          fireRemoteServiceListeners(createUnregisteredEvent(registrations[i]));
        }
      }
    }
  }
}
Program: 95115
Project: 95115
Buggy source:
/** 
 * Handle a ISharedObjectCreateResponseEvent.  This handler is called by handleSharedObjectMsgEvent when the ISharedObjectMessageEvent is of type ISharedObjectCreateResponseEvent. This default  implementation simply returns true.  Subclasses may override as appropriate.
 * @param the ISharedObjectCreateResponseEvent
 * @return true if the provided event should receive no further processing.  If false the provided Event should bepassed to further event processors.  
 */
protected boolean handleSharedObjectCreateResponseEvent(ISharedObjectCreateResponseEvent createResponseEvent){
  trace("String_Node_Str" + createResponseEvent + "String_Node_Str");
  return true;
}

Fixed version (ground truth):
/** 
 * Handle a ISharedObjectCreateResponseEvent.  This handler is called by handleSharedObjectMsgEvent when the ISharedObjectMessageEvent is of type ISharedObjectCreateResponseEvent. This default  implementation simply returns true.  Subclasses may override as appropriate.
 * @param createResponseEvent the ISharedObjectCreateResponseEvent received
 * @return true if the provided event should receive no further processing.  If false the provided Event should bepassed to further event processors.  
 */
protected boolean handleSharedObjectCreateResponseEvent(ISharedObjectCreateResponseEvent createResponseEvent){
  trace("String_Node_Str" + createResponseEvent + "String_Node_Str");
  return true;
}
Program: 95116
Project: 95116
Buggy source:
protected Object deserializeSharedObjectMessage(byte[] bytes) throws IOException, ClassNotFoundException {
  ByteArrayInputStream bins=new ByteArrayInputStream(bytes);
  Object obj=null;
  try {
    ObjectInputStream oins=new ObjectInputStream(bins);
    obj=oins.readObject();
  }
 catch (  ClassNotFoundException e) {
    dumpStack("String_Node_Str",e);
    IdentifiableObjectInputStream iins=new IdentifiableObjectInputStream(new IClassLoaderMapper(){
      public ClassLoader mapNameToClassLoader(      String name){
        ISharedObjectManager manager=getSharedObjectManager();
        ID[] ids=manager.getSharedObjectIDs();
        ID found=null;
        for (int i=0; i < ids.length; i++) {
          ID id=ids[i];
          if (name.equals(id.getName())) {
            found=id;
            break;
          }
        }
        if (found == null)         return null;
        ISharedObject obj=manager.getSharedObject(found);
        if (obj == null)         return null;
        return obj.getClass().getClassLoader();
      }
    }
,bins);
    obj=iins.readObject();
  }
  return obj;
}

Fixed version (ground truth):
protected Object deserializeSharedObjectMessage(byte[] bytes) throws IOException, ClassNotFoundException {
  ByteArrayInputStream bins=new ByteArrayInputStream(bytes);
  Object obj=null;
  try {
    ObjectInputStream oins=new ObjectInputStream(bins);
    obj=oins.readObject();
  }
 catch (  ClassNotFoundException e) {
    bins.reset();
    IdentifiableObjectInputStream iins=new IdentifiableObjectInputStream(new IClassLoaderMapper(){
      public ClassLoader mapNameToClassLoader(      String name){
        ISharedObjectManager manager=getSharedObjectManager();
        ID[] ids=manager.getSharedObjectIDs();
        ID found=null;
        for (int i=0; i < ids.length; i++) {
          ID id=ids[i];
          if (name.equals(id.getName())) {
            found=id;
            break;
          }
        }
        if (found == null)         return null;
        ISharedObject obj=manager.getSharedObject(found);
        if (obj == null)         return null;
        return obj.getClass().getClassLoader();
      }
    }
,bins);
    obj=iins.readObject();
  }
  return obj;
}
Program: 95117
Project: 95117
Buggy source:
protected ClassLoader getClassLoaderForContainer(){
  return ISharedObjectContainer.class.getClassLoader();
}

Fixed version (ground truth):
protected ClassLoader getClassLoaderForContainer(){
  return this.getClass().getClassLoader();
}
Program: 95118
Project: 95118
Buggy source:
public void handleMessage(ID groupID,ID fromID,ID toID,IMessageListener.Type type,String subject,String message){
  ChatWindow window=openChatWindowForTarget(fromID);
  if (window != null) {
    window.handleMessage(fromID,toID,type,subject,message);
    window.setStatus("String_Node_Str" + (new SimpleDateFormat("String_Node_Str").format(new Date())));
  }
}

Fixed version (ground truth):
public void handleMessage(ID groupID,ID fromID,ID toID,IMessageListener.Type type,String subject,String message){
  ChatWindow window=openChatWindowForTarget(fromID);
  System.out.println("String_Node_Str" + groupID + "String_Node_Str"+ fromID+ "String_Node_Str"+ toID+ "String_Node_Str"+ type+ "String_Node_Str"+ subject+ "String_Node_Str"+ message+ "String_Node_Str");
  if (window != null) {
    window.handleMessage(fromID,toID,type,subject,message);
    window.setStatus("String_Node_Str" + (new SimpleDateFormat("String_Node_Str").format(new Date())));
  }
}
Program: 95119
Project: 95119
Buggy source:
protected void handleEnter(){
  String text=textinput.getText().trim();
  if (text.length() > 0)   sendTextLineInput(text);
  clearInput();
  isTyping=false;
}

Fixed version (ground truth):
protected void handleEnter(){
  String text=textinput.getText().trim();
  if (text != null)   sendTextLineInput(text);
  clearInput();
  isTyping=false;
}
Program: 95120
Project: 95120
Buggy source:
public void appendText(ChatLine text){
  StyledText st=textoutput.getTextWidget();
  if (text == null || textoutput == null || st == null)   return;
  int startRange=st.getText().length();
  StringBuffer sb=new StringBuffer();
  if (text.getOriginator() != null) {
    sb.append(createLineWithTimestamp(text.getOriginator().getName() + "String_Node_Str"));
    StyleRange sr=new StyleRange();
    sr.start=startRange;
    sr.length=sb.length();
    IUser lu=getLocalUser();
    if (lu != null && lu.getID().equals(text.getOriginator().getID())) {
      sr.foreground=meColor;
    }
 else {
      sr.foreground=otherColor;
    }
    st.append(sb.toString());
    st.setStyleRange(sr);
  }
  int beforeMessageIndex=st.getText().length();
  st.append(text.getText());
  if (text.getOriginator() == null) {
    StyleRange sr=new StyleRange();
    sr.start=beforeMessageIndex;
    sr.length=text.getText().length();
    sr.foreground=systemColor;
    st.setStyleRange(sr);
  }
  if (!text.isNoCRLF()) {
    st.append("String_Node_Str");
  }
  String t=st.getText();
  if (t == null)   return;
  st.setSelection(t.length());
}

Fixed version (ground truth):
public void appendText(ChatLine text){
  StyledText st=textoutput.getTextWidget();
  if (text == null || textoutput == null || st == null)   return;
  int startRange=st.getText().length();
  StringBuffer sb=new StringBuffer();
  if (text.getOriginator() != null) {
    sb.append(createLineWithTimestamp(text.getOriginator().getName() + "String_Node_Str"));
    StyleRange sr=new StyleRange();
    sr.start=startRange;
    sr.length=sb.length();
    IUser lu=getLocalUser();
    if (lu != null && lu.getID().equals(text.getOriginator().getID())) {
      sr.foreground=meColor;
    }
 else {
      sr.foreground=otherColor;
    }
    st.append(sb.toString());
    st.setStyleRange(sr);
  }
  int beforeMessageIndex=st.getText().length();
  st.append(text.getText().trim());
  if (text.getOriginator() == null) {
    StyleRange sr=new StyleRange();
    sr.start=beforeMessageIndex;
    sr.length=text.getText().length();
    sr.foreground=systemColor;
    st.setStyleRange(sr);
  }
  if (!text.isNoCRLF()) {
    st.append("String_Node_Str");
  }
  String t=st.getText();
  if (t == null)   return;
  st.setSelection(t.length());
}
Program: 95121
Project: 95121
Buggy source:
private void startConnection(ConnectionDetails details) throws Exception {
  CollabClient client=new CollabClient();
  ClientPlugin.log("String_Node_Str" + details.getContainerType() + "String_Node_Str"+ details.getTargetURI()+ "String_Node_Str"+ details.getNickname());
  client.createAndConnectClient(details.getContainerType(),details.getTargetURI(),details.getNickname(),details.getPassword(),ResourcesPlugin.getWorkspace().getRoot());
}

Fixed version (ground truth):
private void startConnection(ConnectionDetails details) throws Exception {
  CollabClient client=new CollabClient();
  client.createAndConnectClient(details.getContainerType(),details.getTargetURI(),details.getNickname(),details.getPassword(),ResourcesPlugin.getWorkspace().getRoot());
}
Program: 95122
Project: 95122
Buggy source:
protected void processDisconnect(DisconnectConnectionEvent e){
  debug("String_Node_Str" + Thread.currentThread().getName() + "String_Node_Str");
  try {
    IAsynchConnection conn=(IAsynchConnection)e.getConnection();
    if (!conn.isConnected())     return;
    ID fromID=null;
synchronized (getGroupMembershipLock()) {
      fromID=getIDForConnection(conn);
      memberLeave(fromID,conn);
    }
    if (fromID != null)     fireContainerEvent(new ContainerDisconnectedEvent(getID(),fromID,e.getException()));
  }
 catch (  Exception except) {
    logException("String_Node_Str",except);
  }
}

Fixed version (ground truth):
protected void processDisconnect(DisconnectConnectionEvent e){
  debug("String_Node_Str" + Thread.currentThread().getName() + "String_Node_Str");
  try {
    IAsynchConnection conn=(IAsynchConnection)e.getConnection();
    ID fromID=null;
synchronized (getGroupMembershipLock()) {
      fromID=getIDForConnection(conn);
      memberLeave(fromID,conn);
    }
    if (fromID != null)     fireContainerEvent(new ContainerDisconnectedEvent(getID(),fromID,e.getException()));
  }
 catch (  Exception except) {
    logException("String_Node_Str",except);
  }
}
Program: 95123
Project: 95123
Buggy source:
private void setEditorEditable(final boolean editable){
  Display.getDefault().syncExec(new Runnable(){
    public void run(){
      textControl.setEditable(editable);
    }
  }
);
}

Fixed version (ground truth):
private void setEditorEditable(final boolean editable){
  if (!textControl.isDisposed()) {
    Display.getDefault().syncExec(new Runnable(){
      public void run(){
        textControl.setEditable(editable);
      }
    }
);
  }
}
Program: 95124
Project: 95124
Buggy source:
synchronized void setListenerActive(boolean active){
  listenerActive=active;
}

Fixed version (ground truth):
synchronized public void setListenerActive(boolean active){
  listenerActive=active;
}
Program: 95125
Project: 95125
Buggy source:
public void addSession(String channelID,String sessionName){
  sessionNames.add(new SessionInstance(channelID,sessionName,getPreferenceStore().getString(ClientPreferencePage.LOCAL_NAME),Calendar.getInstance().getTime()));
  if (presenceChannel != null) {
    try {
      presenceChannel.sendMessage(PresenceChannelListener.createMessage(new SharedEditorSessionList(sessionNames)));
    }
 catch (    ECFException e) {
      e.printStackTrace();
    }
catch (    IOException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
public void addSession(String channelID,String sessionName){
  sessionNames.add(new SessionInstance(channelID,sessionName,getPreferenceStore().getString(ClientPreferencePage.LOCAL_NAME),Calendar.getInstance().getTime()));
  if (presenceChannel != null) {
    try {
      presenceChannel.sendMessage((new SharedEditorSessionList(sessionNames)).toByteArray());
    }
 catch (    ECFException e) {
      e.printStackTrace();
    }
catch (    IOException e) {
      e.printStackTrace();
    }
  }
}
Program: 95127
Project: 95127
Buggy source:
public void addSession(String sessionName){
  sessionNames.add(sessionName);
  if (presenceChannel != null) {
    try {
      presenceChannel.sendMessage(PresenceChannelListener.createMessage(new SharedEditorSessionList(sessionNames)));
    }
 catch (    ECFException e) {
      e.printStackTrace();
    }
catch (    IOException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
public void addSession(String channelID,String sessionName){
  sessionNames.add(new SessionInstance(channelID,sessionName,getPreferenceStore().getString(ClientPreferencePage.LOCAL_NAME),Calendar.getInstance().getTime()));
  if (presenceChannel != null) {
    try {
      presenceChannel.sendMessage(PresenceChannelListener.createMessage(new SharedEditorSessionList(sessionNames)));
    }
 catch (    ECFException e) {
      e.printStackTrace();
    }
catch (    IOException e) {
      e.printStackTrace();
    }
  }
}
Program: 95128
Project: 95128
Buggy source:
public IChannel intializePresenceSession(IChannelListener clistener) throws ECFException {
  presenceContainer=ContainerFactory.getDefault().createContainer(Activator.getDefault().getPreferenceStore().getString(ClientPreferencePage.CONTAINER_TYPE));
  IChannelContainer channelContainer=(IChannelContainer)presenceContainer.getAdapter(IChannelContainer.class);
  final ID channelID=IDFactory.getDefault().createID(channelContainer.getChannelNamespace(),Activator.getDefault().getPreferenceStore().getString(ClientPreferencePage.CHANNEL_ID + "String_Node_Str"));
  presenceChannel=channelContainer.createChannel(channelID,clistener,new HashMap());
  this.presenceChannelListener=clistener;
  presenceContainer.connect(IDFactory.getDefault().createID(presenceContainer.getConnectNamespace(),Activator.getDefault().getPreferenceStore().getString(ClientPreferencePage.TARGET_SERVER)),null);
  return presenceChannel;
}

Fixed version (ground truth):
public IChannel intializePresenceSession(IChannelListener clistener) throws ECFException {
  presenceContainer=ContainerFactory.getDefault().createContainer(Activator.getDefault().getPreferenceStore().getString(ClientPreferencePage.CONTAINER_TYPE));
  IChannelContainer channelContainer=(IChannelContainer)presenceContainer.getAdapter(IChannelContainer.class);
  final ID channelID=IDFactory.getDefault().createID(channelContainer.getChannelNamespace(),Activator.getDefault().getPreferenceStore().getString(ClientPreferencePage.CHANNEL_ID) + "String_Node_Str");
  presenceChannel=channelContainer.createChannel(channelID,clistener,new HashMap());
  this.presenceChannelListener=clistener;
  presenceContainer.connect(IDFactory.getDefault().createID(presenceContainer.getConnectNamespace(),Activator.getDefault().getPreferenceStore().getString(ClientPreferencePage.TARGET_SERVER)),null);
  return presenceChannel;
}
Program: 95129
Project: 95129
Buggy source:
public void handleChannelEvent(IChannelEvent event){
  if (event instanceof IChannelMessageEvent) {
    setEditorEditable(false);
    Activator.getDefault().setListenerActive(false);
    IChannelMessageEvent msg=(IChannelMessageEvent)event;
    ByteArrayInputStream bins=new ByteArrayInputStream(msg.getData());
    ObjectInputStream ois;
    try {
      ois=new ObjectInputStream(bins);
      EditorChangeMessage message=(EditorChangeMessage)ois.readObject();
      appendLocallyFromRemote(message);
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
catch (    ClassNotFoundException e) {
      e.printStackTrace();
    }
 finally {
      setEditorEditable(true);
      Activator.getDefault().setListenerActive(true);
    }
  }
}

Fixed version (ground truth):
public void handleChannelEvent(IChannelEvent event){
  if (event instanceof IChannelMessageEvent) {
    setEditorEditable(false);
    Activator.getDefault().setListenerActive(false);
    IChannelMessageEvent msg=(IChannelMessageEvent)event;
    ByteArrayInputStream bins=new ByteArrayInputStream(msg.getData());
    ObjectInputStream ois;
    try {
      ois=new ObjectInputStream(bins);
      EditorChangeMessage message=(EditorChangeMessage)ois.readObject();
      appendLocallyFromRemote(message);
    }
 catch (    IOException e) {
      Activator.getDefault().getLog().log(new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,e.getLocalizedMessage(),e));
    }
catch (    ClassNotFoundException e) {
      Activator.getDefault().getLog().log(new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,e.getLocalizedMessage(),e));
    }
 finally {
      setEditorEditable(true);
      Activator.getDefault().setListenerActive(true);
    }
  }
}
Program: 95130
Project: 95130
Buggy source:
public void documentChanged(DocumentEvent event){
  if (!Activator.getDefault().isListenerActive()) {
    return;
  }
  try {
    IDocument newDocument=event.getDocument();
    if (channel == null) {
      document.removeDocumentListener(this);
    }
    channel.sendMessage(createMessageFromEvent(event));
    this.document=newDocument;
  }
 catch (  ECFException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void documentChanged(DocumentEvent event){
  if (!Activator.getDefault().isListenerActive()) {
    return;
  }
  try {
    IDocument newDocument=event.getDocument();
    if (channel == null) {
      document.removeDocumentListener(this);
    }
    channel.sendMessage(createMessageFromEvent(event));
    this.document=newDocument;
  }
 catch (  ECFException e) {
    Activator.getDefault().getLog().log(new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,e.getLocalizedMessage(),e));
  }
catch (  IOException e) {
    Activator.getDefault().getLog().log(new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,e.getLocalizedMessage(),e));
  }
}
Program: 95131
Project: 95131
Buggy source:
public EditorListener(IDocument document,AbstractTextEditor textEditor){
  this.document=document;
  this.editor=textEditor;
  try {
    intializeEditorSession();
    if (Activator.getDefault().getPresenceChannelListener() == null) {
      Activator.getDefault().intializePresenceSession(new PresenceChannelListener());
    }
  }
 catch (  ECFException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public EditorListener(IDocument document,AbstractTextEditor textEditor){
  this.document=document;
  this.editor=textEditor;
  try {
    intializeEditorSession();
    if (Activator.getDefault().getPresenceChannelListener() == null) {
      Activator.getDefault().intializePresenceSession(new PresenceChannelListener());
    }
  }
 catch (  ECFException e) {
    Activator.getDefault().getLog().log(new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,e.getLocalizedMessage(),e));
  }
}