nus-yam/ex-repair huggingface dataset:
Program: 94211
Project: 94211
Buggy source:
public Client4(){
  super();
  setMessageReceiver(new IMessageReceiver(){
    public void handleMessage(    final IChatMessage chatMessage){
      Display.getDefault().asyncExec(new Runnable(){
        public void run(){
          MessageDialog.openInformation(null,"String_Node_Str" + chatMessage.getFromID().getName(),chatMessage.getBody());
        }
      }
);
    }
  }
);
  setPresenceListener(new IPresenceListener(){
    public void handlePresence(    ID fromID,    IPresence presence){
      System.out.println("String_Node_Str" + fromID + "String_Node_Str"+ presence+ "String_Node_Str");
    }
    public void handleRosterEntryAdd(    IRosterEntry entry){
      System.out.println("String_Node_Str" + entry + "String_Node_Str");
    }
    public void handleRosterEntryRemove(    IRosterEntry entry){
      System.out.println("String_Node_Str" + entry + "String_Node_Str");
    }
  }
);
}

Fixed version (ground truth):
public Client4(){
  super(new IMessageReceiver(){
    public void handleMessage(    final IChatMessage chatMessage){
      Display.getDefault().asyncExec(new Runnable(){
        public void run(){
          MessageDialog.openInformation(null,"String_Node_Str" + chatMessage.getFromID().getName(),chatMessage.getBody());
        }
      }
);
    }
  }
,new IPresenceListener(){
    public void handlePresence(    ID fromID,    IPresence presence){
      System.out.println("String_Node_Str" + fromID + "String_Node_Str"+ presence+ "String_Node_Str");
    }
  }
);
}
Program: 94212
Project: 94212
Buggy source:
public boolean processEvent(Event event){
  if (event instanceof IContainerConnectedEvent) {
    IContainerConnectedEvent ccevent=(IContainerConnectedEvent)event;
    if (!ccevent.getTargetID().equals(getGroupID()))     sendHelloMessage();
  }
  return false;
}

Fixed version (ground truth):
public boolean processEvent(Event event){
  if (event instanceof IContainerConnectedEvent) {
    IContainerConnectedEvent ccevent=(IContainerConnectedEvent)event;
    if (!ccevent.getTargetID().equals(getConnectedID()))     sendHelloMessage();
  }
  return false;
}
Program: 94213
Project: 94213
Buggy source:
protected void initialize() throws SharedObjectInitException {
  super.initialize();
  addEventProcessor(new IEventProcessor(){
    public boolean processEvent(    Event event){
      if (event instanceof IContainerConnectedEvent) {
        IContainerConnectedEvent ccevent=(IContainerConnectedEvent)event;
        if (!ccevent.getTargetID().equals(getGroupID()))         sendHelloMessage();
      }
      return false;
    }
  }
);
}

Fixed version (ground truth):
protected void initialize() throws SharedObjectInitException {
  super.initialize();
  addEventProcessor(new IEventProcessor(){
    public boolean processEvent(    Event event){
      if (event instanceof IContainerConnectedEvent) {
        IContainerConnectedEvent ccevent=(IContainerConnectedEvent)event;
        if (!ccevent.getTargetID().equals(getConnectedID()))         sendHelloMessage();
      }
      return false;
    }
  }
);
}
Program: 94214
Project: 94214
Buggy source:
public static Map<String,Object> copyNonECFProperties(ServiceReference serviceReference,Map<String,Object> target){
  String[] keys=serviceReference.getPropertyKeys();
  for (int i=0; i < keys.length; i++)   if (!isECFProperty(keys[i]))   target.put(keys[i],serviceReference.getProperty(keys[i]));
  return target;
}

Fixed version (ground truth):
public static Map<String,Object> copyNonECFProperties(IRemoteServiceRegistration serviceRegistration,Map<String,Object> target){
  String[] keys=serviceRegistration.getPropertyKeys();
  for (int i=0; i < keys.length; i++)   if (!isECFProperty(keys[i]))   target.put(keys[i],serviceRegistration.getProperty(keys[i]));
  return target;
}
Program: 94216
Project: 94216
Buggy source:
public static Map<String,Object> copyNonECFProperties(ServiceReference serviceReference,Map<String,Object> target){
  String[] keys=serviceReference.getPropertyKeys();
  for (int i=0; i < keys.length; i++)   if (!isECFProperty(keys[i]))   target.put(keys[i],serviceReference.getProperty(keys[i]));
  return target;
}

Fixed version (ground truth):
public static Map<String,Object> copyNonECFProperties(IRemoteServiceRegistration serviceRegistration,Map<String,Object> target){
  String[] keys=serviceRegistration.getPropertyKeys();
  for (int i=0; i < keys.length; i++)   if (!isECFProperty(keys[i]))   target.put(keys[i],serviceRegistration.getProperty(keys[i]));
  return target;
}
Program: 94218
Project: 94218
Buggy source:
public ProxyServiceFactory(Map<String,Version> interfaceVersions,IRemoteService remoteService){
  this.interfaceVersions=interfaceVersions;
  this.remoteService=remoteService;
}

Fixed version (ground truth):
public ProxyServiceFactory(Map<String,Version> interfaceVersions,IRemoteServiceContainerAdapter containerAdapter,IRemoteServiceReference rsReference,IRemoteService remoteService){
  this.containerAdapter=containerAdapter;
  this.rsReference=rsReference;
  this.interfaceVersions=interfaceVersions;
  this.remoteService=remoteService;
}
Program: 94219
Project: 94219
Buggy source:
private ImportEndpoint createAndRegisterProxy(final EndpointDescription endpointDescription,IRemoteServiceContainer rsContainer,IRemoteServiceReference selectedRsReference) throws Exception {
  final BundleContext proxyServiceFactoryContext=getProxyServiceFactoryContext(endpointDescription);
  if (proxyServiceFactoryContext == null)   throw new NullPointerException("String_Node_Str");
  IRemoteServiceContainerAdapter containerAdapter=rsContainer.getContainerAdapter();
  ID rsContainerID=rsContainer.getContainer().getID();
  final IRemoteService rs=containerAdapter.getRemoteService(selectedRsReference);
  if (rs == null)   throw new NullPointerException("String_Node_Str" + selectedRsReference + "String_Node_Str"+ rsContainerID);
  final Map proxyProperties=createProxyProperties(endpointDescription,rsContainer,selectedRsReference,rs);
  endpointDescription.setPropertiesOverrides(proxyProperties);
  final List<String> serviceTypes=endpointDescription.getInterfaces();
  ServiceRegistration proxyRegistration=AccessController.doPrivileged(new PrivilegedAction<ServiceRegistration>(){
    public ServiceRegistration run(){
      return proxyServiceFactoryContext.registerService((String[])serviceTypes.toArray(new String[serviceTypes.size()]),createProxyServiceFactory(endpointDescription,rs),(Dictionary)PropertiesUtil.createDictionaryFromMap(proxyProperties));
    }
  }
);
  return new ImportEndpoint(containerAdapter,selectedRsReference,new RemoteServiceListener(),proxyRegistration,endpointDescription);
}

Fixed version (ground truth):
private ImportEndpoint createAndRegisterProxy(final EndpointDescription endpointDescription,final IRemoteServiceContainer rsContainer,final IRemoteServiceReference selectedRsReference) throws Exception {
  final BundleContext proxyServiceFactoryContext=getProxyServiceFactoryContext(endpointDescription);
  if (proxyServiceFactoryContext == null)   throw new NullPointerException("String_Node_Str");
  final IRemoteServiceContainerAdapter containerAdapter=rsContainer.getContainerAdapter();
  ID rsContainerID=rsContainer.getContainer().getID();
  final IRemoteService rs=containerAdapter.getRemoteService(selectedRsReference);
  if (rs == null)   throw new NullPointerException("String_Node_Str" + selectedRsReference + "String_Node_Str"+ rsContainerID);
  final Map proxyProperties=createProxyProperties(endpointDescription,rsContainer,selectedRsReference,rs);
  endpointDescription.setPropertiesOverrides(proxyProperties);
  final List<String> serviceTypes=endpointDescription.getInterfaces();
  ServiceRegistration proxyRegistration=AccessController.doPrivileged(new PrivilegedAction<ServiceRegistration>(){
    public ServiceRegistration run(){
      return proxyServiceFactoryContext.registerService((String[])serviceTypes.toArray(new String[serviceTypes.size()]),createProxyServiceFactory(endpointDescription,containerAdapter,selectedRsReference,rs),(Dictionary)PropertiesUtil.createDictionaryFromMap(proxyProperties));
    }
  }
);
  return new ImportEndpoint(containerAdapter,selectedRsReference,new RemoteServiceListener(),proxyRegistration,endpointDescription);
}
Program: 94220
Project: 94220
Buggy source:
public void ungetService(Bundle bundle,ServiceRegistration registration,Object service){
  ungetProxyClassLoader(bundle);
}

Fixed version (ground truth):
public void ungetService(Bundle bundle,ServiceRegistration registration,Object service){
  if (remoteProxyCount == 1L)   containerAdapter.ungetRemoteService(rsReference);
  remoteProxyCount--;
  ungetProxyClassLoader(bundle);
}
Program: 94221
Project: 94221
Buggy source:
private ServiceFactory createProxyServiceFactory(EndpointDescription endpointDescription,IRemoteService remoteService){
  return new ProxyServiceFactory(endpointDescription.getInterfaceVersions(),remoteService);
}

Fixed version (ground truth):
private ServiceFactory createProxyServiceFactory(EndpointDescription endpointDescription,IRemoteServiceContainerAdapter containerAdapter,IRemoteServiceReference selectedRsReference,IRemoteService remoteService){
  return new ProxyServiceFactory(endpointDescription.getInterfaceVersions(),containerAdapter,selectedRsReference,remoteService);
}
Program: 94222
Project: 94222
Buggy source:
public Object getService(Bundle bundle,ServiceRegistration registration){
  return createProxy(bundle,registration.getReference(),remoteService,interfaceVersions);
}

Fixed version (ground truth):
public Object getService(Bundle bundle,ServiceRegistration registration){
  Object proxy=createProxy(bundle,registration.getReference(),remoteService,interfaceVersions);
  remoteProxyCount++;
  return proxy;
}
Program: 94223
Project: 94223
Buggy source:
private Dictionary<String,Object> createRemoteServiceProperties(){
  Dictionary<String,Object> props=new Hashtable<String,Object>();
  props.put("String_Node_Str","String_Node_Str");
  String serviceExportedConfig=System.getProperty("String_Node_Str",GENERIC_SERVER_CONFIG);
  props.put("String_Node_Str",serviceExportedConfig);
  String propName=null;
  String propValue=null;
  if (GENERIC_SERVER_CONFIG.equals(serviceExportedConfig)) {
    propName=GENERIC_SERVER_PORTPROP_NAME;
    propValue=GENERIC_SERVER_PORTPROP_VALUE;
  }
 else   if (REST_SERVER_CONFIG.equals(serviceExportedConfig)) {
    propName=REST_SERVER_IDPROP_NAME;
    propValue=REST_SERVER_IDPROP_VALUE;
  }
 else   if (R_OSGI_SERVER_CONFIG.equals(serviceExportedConfig)) {
    return props;
  }
 else   throw new NullPointerException("String_Node_Str" + serviceExportedConfig);
  props.put(propName,propValue);
  return props;
}

Fixed version (ground truth):
private Dictionary<String,Object> createRemoteServiceProperties(){
  Dictionary<String,Object> props=new Hashtable<String,Object>();
  props.put("String_Node_Str","String_Node_Str");
  String serviceExportedConfig=System.getProperty("String_Node_Str",GENERIC_SERVER_CONFIG);
  props.put("String_Node_Str",serviceExportedConfig);
  String propName=null;
  String propValue=null;
  if (GENERIC_SERVER_CONFIG.equals(serviceExportedConfig)) {
    propName=GENERIC_SERVER_PORTPROP_NAME;
    propValue=GENERIC_SERVER_PORTPROP_VALUE;
    props.put(GENERIC_SERVER_HOSTPROP_NAME,GENERIC_SERVER_HOSTPROP_VALUE);
  }
 else   if (REST_SERVER_CONFIG.equals(serviceExportedConfig)) {
    propName=REST_SERVER_IDPROP_NAME;
    propValue=REST_SERVER_IDPROP_VALUE;
  }
 else   if (R_OSGI_SERVER_CONFIG.equals(serviceExportedConfig)) {
    return props;
  }
 else   throw new NullPointerException("String_Node_Str" + serviceExportedConfig);
  props.put(propName,propValue);
  return props;
}
Program: 94224
Project: 94224
Buggy source:
public void testServerCreateMapParam3() throws Exception {
  String serverId=getServerIdentity();
  Map map=new HashMap();
  map.put("String_Node_Str",serverId);
  map.put("String_Node_Str",InetAddress.getLoopbackAddress());
  container=containerFactory.createContainer(getServerContainerName(),map);
  assertNotNull(container);
}

Fixed version (ground truth):
public void testServerCreateMapParam3() throws Exception {
  String serverId=getServerIdentity();
  Map map=new HashMap();
  map.put("String_Node_Str",serverId);
  map.put("String_Node_Str",new InetSocketAddress((InetAddress)null,0).getAddress());
  container=containerFactory.createContainer(getServerContainerName(),map);
  assertNotNull(container);
}
Program: 94225
Project: 94225
Buggy source:
protected Property getProperty(String propertyName){
  if (propertyName == null)   throw new NullPointerException("String_Node_Str");
synchronized (properties) {
    return properties.get(propertyName);
  }
}

Fixed version (ground truth):
public Property getProperty(){
  return SharedModel.Property.this;
}
Program: 94226
Project: 94226
Buggy source:
protected Property addProperty(Property property){
  if (property == null)   throw new NullPointerException("String_Node_Str");
synchronized (properties) {
    return properties.put(property.getName(),property);
  }
}

Fixed version (ground truth):
protected Property addProperty(final Property property){
  if (property == null)   throw new NullPointerException("String_Node_Str");
  Property oldProperty=null;
synchronized (properties) {
    oldProperty=properties.put(property.getName(),property);
  }
  final Property op=oldProperty;
  fireListeners(new ISharedModelPropertyAddEvent(){
    public SharedModel getSource(){
      return SharedModel.this;
    }
    public Property getAddedProperty(){
      return property;
    }
    public Property getPreAddedProperty(){
      return op;
    }
  }
);
  return op;
}
Program: 94227
Project: 94227
Buggy source:
public Object getValue(){
  return value;
}

Fixed version (ground truth):
public Object getValue(){
  return SharedModel.Property.this.getValue();
}
Program: 94228
Project: 94228
Buggy source:
public Object setValue(Object newValue){
  Object oldValue=this.value;
  this.value=newValue;
  return oldValue;
}

Fixed version (ground truth):
public Object setValue(Object newValue){
  final Object previousValue=this.value;
  this.value=newValue;
  getModel().fireListeners(new ISharedModelPropertyValueChangeEvent(){
    public SharedModel getSource(){
      return getModel();
    }
    public Property getProperty(){
      return SharedModel.Property.this;
    }
    public Object getPreviousValue(){
      return previousValue;
    }
    public Object getValue(){
      return SharedModel.Property.this.getValue();
    }
  }
);
  return previousValue;
}
Program: 94229
Project: 94229
Buggy source:
protected Property removeProperty(String propertyName){
  if (propertyName == null)   throw new NullPointerException("String_Node_Str");
synchronized (properties) {
    return properties.remove(propertyName);
  }
}

Fixed version (ground truth):
protected Property removeProperty(String propertyName){
  if (propertyName == null)   throw new NullPointerException("String_Node_Str");
  Property oldProperty=null;
synchronized (properties) {
    oldProperty=properties.remove(propertyName);
  }
  final Property op=oldProperty;
  fireListeners(new ISharedModelPropertyRemoveEvent(){
    public SharedModel getSource(){
      return SharedModel.this;
    }
    public Property getRemovedProperty(){
      return op;
    }
  }
);
  return op;
}
Program: 94230
Project: 94230
Buggy source:
/** 
 * @return Map any properties associated with this shared object via the ISharedObjectConfig providedupon  {@link #init(ISharedObjectConfig)}.
 */
protected final Map getProperties(){
  return getConfig().getProperties();
}

Fixed version (ground truth):
/** 
 * @return Map any properties associated with this shared object via the ISharedObjectConfig providedupon  {@link #init(ISharedObjectConfig)}.
 */
protected final Map<String,?> getProperties(){
  return getConfig().getProperties();
}
Program: 94231
Project: 94231
Buggy source:
/** 
 * Get properties associated with with this ISharedObject
 * @return Map with properties associated with this ISharedObject instance.Will not be null.
 */
public Map getProperties();

Fixed version (ground truth):
/** 
 * Get properties associated with with this ISharedObject
 * @return Map with properties associated with this ISharedObject instance.Will not be null.
 */
public Map<String,?> getProperties();
Program: 94232
Project: 94232
Buggy source:
/** 
 * The properties associated with the owner ISharedObjectContainer
 * @return Map the properties associated with owner ISharedObjectContainer
 */
public Map getProperties();

Fixed version (ground truth):
/** 
 * The properties associated with the owner ISharedObjectContainer
 * @return Map the properties associated with owner ISharedObjectContainer
 */
public Map<String,?> getProperties();
Program: 94233
Project: 94233
Buggy source:
/** 
 * Get local container properties that it wishes to expose to shared object access
 * @return Map of properties available to calling shared object. Mapreturned must not be null.
 */
public Map getLocalContainerProperties();

Fixed version (ground truth):
/** 
 * Get local container properties that it wishes to expose to shared object access
 * @return Map of properties available to calling shared object. Mapreturned must not be null.
 */
public Map<String,?> getLocalContainerProperties();
Program: 94234
Project: 94234
Buggy source:
public SharedObjectDescription(Class clazz,ID id,Map properties){
  this.typeDescription=new SharedObjectTypeDescription(clazz.getName(),null);
  this.id=id;
  this.properties=(properties == null) ? new HashMap() : properties;
}

Fixed version (ground truth):
public SharedObjectDescription(Class clazz,ID id,Map<String,?> properties){
  this.typeDescription=new SharedObjectTypeDescription(clazz.getName(),null);
  this.id=id;
  this.properties=(properties == null) ? new HashMap<String,Object>() : properties;
}
Program: 94235
Project: 94235
Buggy source:
public Map getProperties(){
  return properties;
}

Fixed version (ground truth):
public Map<String,?> getProperties(){
  return properties;
}
Program: 94236
Project: 94236
Buggy source:
/** 
 * @return Map any properties associated with this shared object via the ISharedObjectConfig providedupon  {@link #init(ISharedObjectConfig)}.
 */
protected final Map getProperties(){
  return getConfig().getProperties();
}

Fixed version (ground truth):
/** 
 * @return Map any properties associated with this shared object via the ISharedObjectConfig providedupon  {@link #init(ISharedObjectConfig)}.
 */
protected final Map<String,?> getProperties(){
  return getConfig().getProperties();
}
Program: 94237
Project: 94237
Buggy source:
/** 
 * Get properties associated with with this ISharedObject
 * @return Map with properties associated with this ISharedObject instance.Will not be null.
 */
public Map getProperties();

Fixed version (ground truth):
/** 
 * Get properties associated with with this ISharedObject
 * @return Map with properties associated with this ISharedObject instance.Will not be null.
 */
public Map<String,?> getProperties();
Program: 94238
Project: 94238
Buggy source:
/** 
 * The properties associated with the owner ISharedObjectContainer
 * @return Map the properties associated with owner ISharedObjectContainer
 */
public Map getProperties();

Fixed version (ground truth):
/** 
 * The properties associated with the owner ISharedObjectContainer
 * @return Map the properties associated with owner ISharedObjectContainer
 */
public Map<String,?> getProperties();
Program: 94239
Project: 94239
Buggy source:
/** 
 * Get local container properties that it wishes to expose to shared object access
 * @return Map of properties available to calling shared object. Mapreturned must not be null.
 */
public Map getLocalContainerProperties();

Fixed version (ground truth):
/** 
 * Get local container properties that it wishes to expose to shared object access
 * @return Map of properties available to calling shared object. Mapreturned must not be null.
 */
public Map<String,?> getLocalContainerProperties();
Program: 94240
Project: 94240
Buggy source:
public SharedObjectDescription(Class clazz,ID id,Map properties){
  this.typeDescription=new SharedObjectTypeDescription(clazz.getName(),null);
  this.id=id;
  this.properties=(properties == null) ? new HashMap() : properties;
}

Fixed version (ground truth):
public SharedObjectDescription(Class clazz,ID id,Map<String,?> properties){
  this.typeDescription=new SharedObjectTypeDescription(clazz.getName(),null);
  this.id=id;
  this.properties=(properties == null) ? new HashMap<String,Object>() : properties;
}
Program: 94241
Project: 94241
Buggy source:
public Map getProperties(){
  return properties;
}

Fixed version (ground truth):
public Map<String,?> getProperties(){
  return properties;
}
Program: 94242
Project: 94242
Buggy source:
private String getInitFromExternalForm(Object[] args){
  if (args == null || args.length < 1 || args[0] == null)   return null;
  if (args[0] instanceof String) {
    final String arg=(String)args[0];
    if (arg.startsWith(getScheme() + Namespace.SCHEME_SEPARATOR)) {
      final int index=arg.indexOf(Namespace.SCHEME_SEPARATOR);
      if (index >= arg.length())       return null;
      return arg.substring(index + 1);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @since 2.2.300
 */
protected String getInitFromExternalForm(Object[] args){
  if (args == null || args.length < 1 || args[0] == null)   return null;
  if (args[0] instanceof String) {
    final String arg=(String)args[0];
    if (arg.startsWith(getScheme() + Namespace.SCHEME_SEPARATOR)) {
      final int index=arg.indexOf(Namespace.SCHEME_SEPARATOR);
      if (index >= arg.length())       return null;
      return arg.substring(index + 1);
    }
  }
  return null;
}
Program: 94244
Project: 94244
Buggy source:
protected Long decodeLong(IServiceProperties props,String name){
  Object o=props.getProperty(name);
  if (o == null)   return DEFAULT_LONG;
  if (o instanceof Long)   return (Long)o;
  if (o instanceof Integer)   return new Long(((Integer)o).longValue());
  if (o instanceof String)   try {
    return new Long((String)o);
  }
 catch (  NumberFormatException e) {
    LogUtility.logError("String_Node_Str",DebugOptions.METADATA_FACTORY,this.getClass(),"String_Node_Str" + name + "String_Node_Str"+ o);
  }
  return DEFAULT_LONG;
}

Fixed version (ground truth):
protected Long decodeLong(IServiceProperties props,String name){
  Object o=props.getPropertyString(name);
  if (o == null)   return DEFAULT_LONG;
  if (o instanceof Long)   return (Long)o;
  if (o instanceof Integer)   return new Long(((Integer)o).longValue());
  if (o instanceof String)   try {
    return new Long((String)o);
  }
 catch (  NumberFormatException e) {
    LogUtility.logError("String_Node_Str",DebugOptions.METADATA_FACTORY,this.getClass(),"String_Node_Str" + name + "String_Node_Str"+ o);
  }
  return DEFAULT_LONG;
}
Program: 94245
Project: 94245
Buggy source:
protected Long decodeLong(IServiceProperties props,String name){
  String longAsString=props.getPropertyString(name);
  if (longAsString == null)   return new Long(0);
  return new Long(longAsString);
}

Fixed version (ground truth):
protected Long decodeLong(IServiceProperties props,String name){
  Object o=props.getPropertyString(name);
  if (o == null)   return DEFAULT_LONG;
  if (o instanceof Long)   return (Long)o;
  if (o instanceof Integer)   return new Long(((Integer)o).longValue());
  if (o instanceof String)   try {
    return new Long((String)o);
  }
 catch (  NumberFormatException e) {
    LogUtility.logError("String_Node_Str",DebugOptions.METADATA_FACTORY,this.getClass(),"String_Node_Str" + name + "String_Node_Str"+ o);
  }
  return DEFAULT_LONG;
}
Program: 94246
Project: 94246
Buggy source:
protected Long decodeLong(IServiceProperties props,String name){
  Object o=props.getPropertyString(name);
  if (o == null)   return DEFAULT_LONG;
  if (o instanceof Long)   return (Long)o;
  if (o instanceof Integer)   return new Long(((Integer)o).longValue());
  if (o instanceof String)   try {
    return new Long((String)o);
  }
 catch (  NumberFormatException e) {
    LogUtility.logError("String_Node_Str",DebugOptions.METADATA_FACTORY,this.getClass(),"String_Node_Str" + name + "String_Node_Str"+ o);
  }
  return DEFAULT_LONG;
}

Fixed version (ground truth):
protected Long decodeLong(IServiceProperties props,String name){
  String longAsString=props.getPropertyString(name);
  if (longAsString == null)   return new Long(0);
  return new Long(longAsString);
}
Program: 94247
Project: 94247
Buggy source:
public void endpointRemoved(org.osgi.service.remoteserviceadmin.EndpointDescription endpoint,String matchedFilter){
  if (matchedFilter.equals(endpointListenerScope))   if (endpoint instanceof EndpointDescription)   handleECFEndpointRemoved((EndpointDescription)endpoint);
 else   handleNonECFEndpointRemoved(this,endpoint);
 else   if (matchedFilter.equals(ALL_SCOPE))   if (endpoint instanceof EndpointDescription)   handleECFEndpointRemoved((EndpointDescription)endpoint);
 else   unadvertiseEndpointDescription(endpoint);
}

Fixed version (ground truth):
public void endpointRemoved(org.osgi.service.remoteserviceadmin.EndpointDescription endpoint,String matchedFilter){
  if (matchedFilter.equals(endpointListenerScope))   if (endpoint instanceof EndpointDescription)   handleECFEndpointRemoved((EndpointDescription)endpoint);
 else   handleNonECFEndpointRemoved(this,endpoint);
 else   if (matchedFilter.equals(NO_ECF_SCOPE))   if (endpoint instanceof EndpointDescription)   handleECFEndpointRemoved((EndpointDescription)endpoint);
 else   unadvertiseEndpointDescription(endpoint);
}
Program: 94248
Project: 94248
Buggy source:
public void endpointAdded(org.osgi.service.remoteserviceadmin.EndpointDescription endpoint,String matchedFilter){
  if (matchedFilter.equals(endpointListenerScope))   if (endpoint instanceof EndpointDescription)   handleECFEndpointAdded((EndpointDescription)endpoint);
 else   handleNonECFEndpointAdded(this,endpoint);
 else   if (matchedFilter.equals(ALL_SCOPE))   if (endpoint instanceof EndpointDescription)   handleECFEndpointAdded((EndpointDescription)endpoint);
 else   advertiseEndpointDescription(endpoint);
}

Fixed version (ground truth):
public void endpointAdded(org.osgi.service.remoteserviceadmin.EndpointDescription endpoint,String matchedFilter){
  if (matchedFilter.equals(endpointListenerScope))   if (endpoint instanceof EndpointDescription)   handleECFEndpointAdded((EndpointDescription)endpoint);
 else   handleNonECFEndpointAdded(this,endpoint);
 else   if (matchedFilter.equals(NO_ECF_SCOPE))   if (endpoint instanceof EndpointDescription)   handleECFEndpointAdded((EndpointDescription)endpoint);
 else   advertiseEndpointDescription(endpoint);
}
Program: 94249
Project: 94249
Buggy source:
BasicTopologyManagerImpl(BundleContext context){
  super(context);
  if (defaultScope != null)   this.endpointListenerScope=defaultScope;
 else   if (allowLoopbackReference)   endpointListenerScope=ALL_SCOPE;
 else {
    StringBuffer elScope=new StringBuffer("String_Node_Str");
    elScope.append("String_Node_Str");
    elScope.append(org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_FRAMEWORK_UUID);
    elScope.append("String_Node_Str");
    elScope.append(getFrameworkUUID());
    elScope.append("String_Node_Str");
    elScope.append("String_Node_Str");
    endpointListenerScope=elScope.toString();
  }
}

Fixed version (ground truth):
BasicTopologyManagerImpl(BundleContext context){
  super(context);
  if (defaultScope != null)   this.endpointListenerScope=defaultScope;
  if (allowLoopbackReference)   endpointListenerScope=ONLY_ECF_SCOPE;
 else {
    StringBuffer elScope=new StringBuffer("String_Node_Str");
    elScope.append("String_Node_Str");
    elScope.append("String_Node_Str").append(org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_FRAMEWORK_UUID).append("String_Node_Str").append(getFrameworkUUID()).append("String_Node_Str");
    elScope.append(ONLY_ECF_SCOPE);
    elScope.append("String_Node_Str");
    endpointListenerScope=elScope.toString();
  }
}
Program: 94250
Project: 94250
Buggy source:
String[] getScope(){
  return (ALL_SCOPE.equals(endpointListenerScope)) ? new String[]{endpointListenerScope} : new String[]{endpointListenerScope,ALL_SCOPE};
}

Fixed version (ground truth):
String[] getScope(){
  return new String[]{endpointListenerScope,NO_ECF_SCOPE};
}
Program: 94251
Project: 94251
Buggy source:
protected Long decodeLong(IServiceProperties props,String name){
  Object o=props.getPropertyString(name);
  if (o == null)   return DEFAULT_LONG;
  if (o instanceof Long)   return (Long)o;
  if (o instanceof Integer)   return new Long(((Integer)o).longValue());
  if (o instanceof String)   try {
    return new Long((String)o);
  }
 catch (  NumberFormatException e) {
    LogUtility.logError("String_Node_Str",DebugOptions.METADATA_FACTORY,this.getClass(),"String_Node_Str" + name + "String_Node_Str"+ o);
  }
  return DEFAULT_LONG;
}

Fixed version (ground truth):
protected Long decodeLong(IServiceProperties props,String name){
  Object o=props.getProperty(name);
  if (o == null)   return DEFAULT_LONG;
  if (o instanceof Long)   return (Long)o;
  if (o instanceof Integer)   return new Long(((Integer)o).longValue());
  if (o instanceof String)   try {
    return new Long((String)o);
  }
 catch (  NumberFormatException e) {
    LogUtility.logError("String_Node_Str",DebugOptions.METADATA_FACTORY,this.getClass(),"String_Node_Str" + name + "String_Node_Str"+ o);
  }
  return DEFAULT_LONG;
}
Program: 94252
Project: 94252
Buggy source:
public IRemoteServiceContainer selectConsumerContainer(EndpointDescription endpointDescription) throws SelectContainerException {
  trace("String_Node_Str","String_Node_Str" + endpointDescription);
  List<String> sic=PropertiesUtil.getStringPlusProperty(endpointDescription.getProperties(),org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED_CONFIGS);
  String[] serviceImportedConfigs=sic.toArray(new String[sic.size()]);
  ID endpointContainerID=endpointDescription.getContainerID();
  ID connectTargetID=endpointDescription.getConnectTargetID();
  IRemoteServiceContainer rsContainer=selectExistingConsumerContainer(endpointContainerID,serviceImportedConfigs,connectTargetID);
  if (rsContainer == null && autoCreateContainer)   rsContainer=createAndConfigureConsumerContainer(serviceImportedConfigs,endpointDescription.getProperties());
  connectContainerToTarget(rsContainer,connectTargetID);
  return rsContainer;
}

Fixed version (ground truth):
public IRemoteServiceContainer selectConsumerContainer(EndpointDescription endpointDescription) throws SelectContainerException {
  trace("String_Node_Str","String_Node_Str" + endpointDescription);
  List<String> sic=PropertiesUtil.getStringPlusProperty(endpointDescription.getProperties(),org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED_CONFIGS);
  String[] serviceImportedConfigs=sic.toArray(new String[sic.size()]);
  ID endpointContainerID=endpointDescription.getContainerID();
  ID connectTargetID=endpointDescription.getConnectTargetID();
  IRemoteServiceContainer rsContainer=(reuseExistingContainers) ? selectExistingConsumerContainer(endpointContainerID,serviceImportedConfigs,connectTargetID) : null;
  if (rsContainer == null && autoCreateContainer)   rsContainer=createAndConfigureConsumerContainer(serviceImportedConfigs,endpointDescription.getProperties());
  connectContainerToTarget(rsContainer,connectTargetID);
  return rsContainer;
}
Program: 94253
Project: 94253
Buggy source:
/** 
 * @see org.eclipse.ecf.osgi.services.remoteserviceadmin.IHostContainerSelector#selectHostContainers(org.osgi.framework.ServiceReference,java.util.Map,java.lang.String[],java.lang.String[],java.lang.String[])
 * @since 2.0
 */
public synchronized IRemoteServiceContainer[] selectHostContainers(ServiceReference serviceReference,Map<String,Object> overridingProperties,String[] serviceExportedInterfaces,String[] serviceExportedConfigs,String[] serviceIntents) throws SelectContainerException {
  Collection rsContainers=selectExistingHostContainers(serviceReference,overridingProperties,serviceExportedInterfaces,serviceExportedConfigs,serviceIntents);
  if (rsContainers.size() == 0 && autoCreateContainer) {
    rsContainers=createAndConfigureHostContainers(serviceReference,overridingProperties,serviceExportedInterfaces,serviceExportedConfigs,serviceIntents);
    Object target=overridingProperties.get(RemoteConstants.ENDPOINT_CONNECTTARGET_ID);
    if (target != null) {
      for (Iterator i=rsContainers.iterator(); i.hasNext(); ) {
        IContainer container=((IRemoteServiceContainer)i.next()).getContainer();
        try {
          connectHostContainer(serviceReference,overridingProperties,container,target);
        }
 catch (        Exception e) {
          logException("String_Node_Str" + container.getID() + "String_Node_Str"+ target,e);
        }
      }
    }
  }
  return (IRemoteServiceContainer[])rsContainers.toArray(new IRemoteServiceContainer[]{});
}

Fixed version (ground truth):
/** 
 * @see org.eclipse.ecf.osgi.services.remoteserviceadmin.IHostContainerSelector#selectHostContainers(org.osgi.framework.ServiceReference,java.util.Map,java.lang.String[],java.lang.String[],java.lang.String[])
 * @since 2.0
 */
public synchronized IRemoteServiceContainer[] selectHostContainers(ServiceReference serviceReference,Map<String,Object> overridingProperties,String[] serviceExportedInterfaces,String[] serviceExportedConfigs,String[] serviceIntents) throws SelectContainerException {
  Collection rsContainers=(reuseExistingContainers) ? selectExistingHostContainers(serviceReference,overridingProperties,serviceExportedInterfaces,serviceExportedConfigs,serviceIntents) : Collections.EMPTY_LIST;
  if (rsContainers.size() == 0 && autoCreateContainer) {
    rsContainers=createAndConfigureHostContainers(serviceReference,overridingProperties,serviceExportedInterfaces,serviceExportedConfigs,serviceIntents);
    Object target=overridingProperties.get(RemoteConstants.ENDPOINT_CONNECTTARGET_ID);
    if (target != null) {
      for (Iterator i=rsContainers.iterator(); i.hasNext(); ) {
        IContainer container=((IRemoteServiceContainer)i.next()).getContainer();
        try {
          connectHostContainer(serviceReference,overridingProperties,container,target);
        }
 catch (        Exception e) {
          logException("String_Node_Str" + container.getID() + "String_Node_Str"+ target,e);
        }
      }
    }
  }
  return (IRemoteServiceContainer[])rsContainers.toArray(new IRemoteServiceContainer[]{});
}
Program: 94254
Project: 94254
Buggy source:
private Version getPackageVersionViaRequestingBundle(String packageName,Bundle requestingBundle){
  Version result=null;
  BundleRevision requestingBundleRevision=(BundleRevision)requestingBundle.adapt(BundleRevision.class);
  if (requestingBundleRevision != null) {
    List<BundleCapability> requestingBundleCapabilities=requestingBundleRevision.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE);
    for (    BundleCapability requestingBundleCapability : requestingBundleCapabilities) {
      Version version=getVersionForMatchingCapability(packageName,requestingBundleCapability);
      if (version != null)       result=version;
    }
  }
  if (result == null) {
    BundleWiring requestingBundleWiring=requestingBundle.adapt(BundleWiring.class);
    if (requestingBundleWiring != null) {
      result=getPackageVersionForMatchingWire(packageName,requestingBundleWiring.getRequiredWires(BundleRevision.PACKAGE_NAMESPACE),BundleRevision.PACKAGE_NAMESPACE);
      if (result == null)       result=getPackageVersionForMatchingWire(packageName,requestingBundleWiring.getRequiredWires(BundleRevision.BUNDLE_NAMESPACE),BundleRevision.BUNDLE_NAMESPACE);
    }
  }
  return result;
}

Fixed version (ground truth):
private Version getPackageVersionViaRequestingBundle(String packageName,Bundle requestingBundle,Version remoteVersion){
  Version result=null;
  BundleRevision requestingBundleRevision=(BundleRevision)requestingBundle.adapt(BundleRevision.class);
  if (requestingBundleRevision != null) {
    List<BundleCapability> requestingBundleCapabilities=requestingBundleRevision.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE);
    for (    BundleCapability requestingBundleCapability : requestingBundleCapabilities) {
      Version candidate=getVersionForMatchingCapability(packageName,requestingBundleCapability);
      if (candidate != null) {
        if (remoteVersion != null && candidate.equals(remoteVersion))         return candidate;
        result=candidate;
      }
    }
  }
  if (result == null) {
    BundleWiring requestingBundleWiring=requestingBundle.adapt(BundleWiring.class);
    if (requestingBundleWiring != null) {
      result=getPackageVersionForMatchingWire(packageName,requestingBundleWiring.getRequiredWires(BundleRevision.PACKAGE_NAMESPACE),BundleRevision.PACKAGE_NAMESPACE);
      if (result == null)       result=getPackageVersionForMatchingWire(packageName,requestingBundleWiring.getRequiredWires(BundleRevision.BUNDLE_NAMESPACE),BundleRevision.BUNDLE_NAMESPACE);
    }
  }
  return result;
}
Program: 94255
Project: 94255
Buggy source:
private boolean verifyServiceInterfaceVersionsForProxy(Bundle bundle,Collection<Class> classes,Map<String,Version> interfaceVersions){
  boolean result=true;
  for (  Class clazz : classes) {
    String className=clazz.getName();
    String packageName=getPackageName(className);
    Version remoteVersion=interfaceVersions.get(className);
    Version localVersion=getPackageVersionViaRequestingBundle(packageName,bundle);
    if (comparePackageVersions(packageName,remoteVersion,localVersion)) {
      logError("String_Node_Str","String_Node_Str" + clientBundle + "String_Node_Str"+ className+ "String_Node_Str"+ remoteVersion+ "String_Node_Str"+ localVersion);
      result=false;
    }
  }
  return result;
}

Fixed version (ground truth):
private boolean verifyServiceInterfaceVersionsForProxy(Bundle bundle,Collection<Class> classes,Map<String,Version> interfaceVersions){
  boolean result=true;
  for (  Class clazz : classes) {
    String className=clazz.getName();
    String packageName=getPackageName(className);
    Version remoteVersion=interfaceVersions.get(className);
    Version localVersion=getPackageVersionViaRequestingBundle(packageName,bundle,remoteVersion);
    if (comparePackageVersions(packageName,remoteVersion,localVersion)) {
      logError("String_Node_Str","String_Node_Str" + clientBundle + "String_Node_Str"+ className+ "String_Node_Str"+ remoteVersion+ "String_Node_Str"+ localVersion);
      result=false;
    }
  }
  return result;
}
Program: 94256
Project: 94256
Buggy source:
private String[][] getSupportedConfigsAndIntents(){
  IContainerManager containerManager=getContainerManager();
  Assert.isNotNull(containerManager,"String_Node_Str");
  ContainerTypeDescription[] remoteServiceDescriptions=containerManager.getContainerFactory().getDescriptionsForContainerAdapter(IRemoteServiceContainerAdapter.class);
  List<String> supportedConfigs=new ArrayList<String>();
  List<String> supportedIntents=new ArrayList<String>();
  for (int i=0; i < remoteServiceDescriptions.length; i++) {
    String[] descSupportedConfigs=remoteServiceDescriptions[i].getSupportedConfigs();
    for (int j=0; j < descSupportedConfigs.length; j++)     supportedConfigs.add(descSupportedConfigs[j]);
    String[] descSupportedIntents=remoteServiceDescriptions[i].getSupportedIntents();
    for (int j=0; j < descSupportedIntents.length; j++)     supportedIntents.add(descSupportedIntents[j]);
  }
  String[][] result=new String[2][];
  result[0]=supportedConfigs.toArray(new String[supportedConfigs.size()]);
  result[1]=supportedIntents.toArray(new String[supportedIntents.size()]);
  return result;
}

Fixed version (ground truth):
private String[][] getSupportedConfigsAndIntents(){
  IContainerManager containerManager=getContainerManager();
  Assert.isNotNull(containerManager,"String_Node_Str");
  ContainerTypeDescription[] remoteServiceDescriptions=containerManager.getContainerFactory().getDescriptionsForContainerAdapter(IRemoteServiceContainerAdapter.class);
  List<String> supportedConfigs=new ArrayList<String>();
  List<String> supportedIntents=new ArrayList<String>();
  for (int i=0; i < remoteServiceDescriptions.length; i++) {
    String[] descSupportedConfigs=remoteServiceDescriptions[i].getSupportedConfigs();
    if (descSupportedConfigs != null) {
      for (int j=0; j < descSupportedConfigs.length; j++)       supportedConfigs.add(descSupportedConfigs[j]);
      String[] descSupportedIntents=remoteServiceDescriptions[i].getSupportedIntents();
      for (int j=0; j < descSupportedIntents.length; j++)       supportedIntents.add(descSupportedIntents[j]);
    }
  }
  String[][] result=new String[2][];
  result[0]=supportedConfigs.toArray(new String[supportedConfigs.size()]);
  result[1]=supportedIntents.toArray(new String[supportedIntents.size()]);
  return result;
}
Program: 94258
Project: 94258
Buggy source:
/** 
 * @param properties The map from which to create the Endpoint Description. The keys in the map must be type <code>String</code> and, since the keys are case insensitive, there must be no duplicates with case variation.
 * @throws IllegalArgumentException When the properties are not proper for an Endpoint Description.
 * @see org.osgi.service.remoteserviceadmin.EndpointDescription#EndpointDescription(Map)
 */
public EndpointDescription(Map<String,Object> properties){
  super(properties);
  verifyECFProperties();
  computeHashCode();
}

Fixed version (ground truth):
/** 
 * @param properties The map from which to create the Endpoint Description. The keys in the map must be type <code>String</code> and, since the keys are case insensitive, there must be no duplicates with case variation.
 * @throws IllegalArgumentException When the properties are not proper for an Endpoint Description.
 * @see org.osgi.service.remoteserviceadmin.EndpointDescription#EndpointDescription(Map)
 */
public EndpointDescription(Map<String,Object> properties){
  super(properties);
  verifyECFProperties();
}
Program: 94259
Project: 94259
Buggy source:
public org.osgi.service.remoteserviceadmin.ImportReference getImportReference(){
  Throwable t=getException();
  if (t != null)   throw new IllegalStateException("String_Node_Str",t);
  return importReference;
}

Fixed version (ground truth):
public org.osgi.service.remoteserviceadmin.ImportReference getImportReference(){
  Throwable t=getException();
  if (t != null)   return null;
  return importReference;
}
Program: 94260
Project: 94260
Buggy source:
public org.osgi.service.remoteserviceadmin.ExportReference getExportReference(){
  Throwable t=getException();
  if (t != null)   throw new IllegalStateException("String_Node_Str",t);
  return exportReference;
}

Fixed version (ground truth):
public org.osgi.service.remoteserviceadmin.ExportReference getExportReference(){
  Throwable t=getException();
  if (t != null)   return null;
  return exportReference;
}
Program: 94261
Project: 94261
Buggy source:
public IIncomingFileTransfer accept(OutputStream outputStream,IFileTransferListener listener) throws IncomingFileTransferException {
  if (requestAccepted)   throw new IncomingFileTransferException("String_Node_Str");
  if (outputStream == null)   throw new IncomingFileTransferException("String_Node_Str");
  incoming=request.accept();
  try {
    return new XMPPIncomingFileTransfer(IDFactory.getDefault().createStringID(request.getStreamID()),request.getFileName(),incoming.recieveFile(),outputStream,request.getFileSize(),listener);
  }
 catch (  final Exception e) {
    throw new IncomingFileTransferException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public IIncomingFileTransfer accept(OutputStream outputStream,IFileTransferListener listener) throws IncomingFileTransferException {
  if (requestAccepted)   throw new IncomingFileTransferException("String_Node_Str");
  if (outputStream == null)   throw new IncomingFileTransferException("String_Node_Str");
  incoming=request.accept();
  requestAccepted=true;
  try {
    return new XMPPIncomingFileTransfer(IDFactory.getDefault().createStringID(request.getStreamID()),request.getFileName(),incoming.recieveFile(),outputStream,request.getFileSize(),listener);
  }
 catch (  final Exception e) {
    throw new IncomingFileTransferException("String_Node_Str",e);
  }
}
Program: 94263
Project: 94263
Buggy source:
public void stop(BundleContext c) throws Exception {
  dispose();
  PrettyPrinter.prompt(PrettyPrinter.DEACTIVATED,null);
}

Fixed version (ground truth):
public void stop(BundleContext c) throws Exception {
  dispose();
  Logger.log(LogService.LOG_INFO,PrettyPrinter.prompt(PrettyPrinter.DEACTIVATED,null),null);
}
Program: 94264
Project: 94264
Buggy source:
public void start(final BundleContext ctxt){
  context=ctxt;
  final Properties props=new Properties();
  props.put(IDiscoveryLocator.CONTAINER_NAME,ZooDiscoveryContainerInstantiator.NAME);
  props.put(IDiscoveryAdvertiser.CONTAINER_NAME,ZooDiscoveryContainerInstantiator.NAME);
  discoveryRegistration=ctxt.registerService(new String[]{IDiscoveryLocator.class.getName(),IDiscoveryAdvertiser.class.getName()},new ServiceFactory(){
    private volatile ZooDiscoveryContainer zdc;
    public Object getService(    Bundle bundle,    ServiceRegistration registration){
      if (zdc == null) {
        zdc=ZooDiscoveryContainer.getSingleton();
        zdc.setDiscoveryProperties(props);
      }
      return zdc;
    }
    public void ungetService(    Bundle bundle,    ServiceRegistration registration,    Object service){
    }
  }
,(Dictionary)props);
  logServiceTracker=new ServiceTracker(ctxt,org.osgi.service.log.LogService.class.getName(),null){
    public Object addingService(    ServiceReference reference){
      Logger.bindLogService((LogService)context.getService(reference));
      return super.addingService(reference);
    }
    public void removedService(    ServiceReference reference,    Object service){
      Logger.unbindLogService((LogService)service);
      super.removedService(reference,service);
    }
  }
;
  logServiceTracker.open(true);
}

Fixed version (ground truth):
public void start(final BundleContext ctxt){
  context=ctxt;
  final Properties props=new Properties();
  props.put(IDiscoveryLocator.CONTAINER_NAME,ZooDiscoveryContainerInstantiator.NAME);
  props.put(IDiscoveryAdvertiser.CONTAINER_NAME,ZooDiscoveryContainerInstantiator.NAME);
  discoveryRegistration=ctxt.registerService(new String[]{IDiscoveryLocator.class.getName(),IDiscoveryAdvertiser.class.getName()},new ServiceFactory(){
    private volatile ZooDiscoveryContainer zdc;
    public Object getService(    Bundle bundle,    ServiceRegistration registration){
      if (zdc == null) {
        zdc=ZooDiscoveryContainer.getSingleton();
        zdc.setDiscoveryProperties(props);
      }
      return zdc;
    }
    public void ungetService(    Bundle bundle,    ServiceRegistration registration,    Object service){
    }
  }
,(Dictionary)props);
  logServiceTracker=new ServiceTracker(ctxt,org.osgi.service.log.LogService.class.getName(),null){
    public Object addingService(    ServiceReference reference){
      Logger.bindLogService((LogService)context.getService(reference));
      return super.addingService(reference);
    }
    public void removedService(    ServiceReference reference,    Object service){
      Logger.unbindLogService((LogService)service);
      super.removedService(reference,service);
    }
  }
;
  logServiceTracker.open(true);
  if (ZooDiscoveryContainer.autoStart()) {
    ctxt.getService(discoveryRegistration.getReference());
  }
}
Program: 94265
Project: 94265
Buggy source:
public void dispose(){
  PrettyPrinter.prompt(PrettyPrinter.REMOTE_UNAVAILABLE,this);
  Localizer.getSingleton().localize(new Notification(this,Notification.UNAVAILABLE));
}

Fixed version (ground truth):
public void dispose(){
  Logger.log(SystemLogService.LOG_DEBUG,PrettyPrinter.prompt(PrettyPrinter.REMOTE_UNAVAILABLE,this),null);
  Localizer.getSingleton().localize(new Notification(this,Notification.UNAVAILABLE));
}