nus-yam/ex-repair huggingface dataset:
Program: 180102
Project: 180102
Buggy source:
public void run(Map<Object,Object> services){
  httpService=(HttpService)services.get(HttpService.class.getName());
  try {
    httpService.registerServlet(DRAGONFLY_WS_PATH,new DragonflyEventServlet(eventMap),null,null);
    logService.log(LogService.LOG_INFO,"String_Node_Str" + DRAGONFLY_WS_PATH);
  }
 catch (  Exception e) {
    logService.log(LogService.LOG_ERROR,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void run(Map<String,Object> services){
  httpService=(HttpService)services.get(HttpService.class.getName());
  try {
    httpService.registerServlet(DRAGONFLY_WS_PATH,new DragonflyEventServlet(eventMap),null,null);
    logService.log(LogService.LOG_INFO,"String_Node_Str" + DRAGONFLY_WS_PATH);
  }
 catch (  Exception e) {
    logService.log(LogService.LOG_ERROR,"String_Node_Str",e);
  }
}
Program: 180103
Project: 180103
Buggy source:
@Override public void run(Map<Object,Object> services){
  if (servlets != null) {
    log.log(LogService.LOG_ERROR,"String_Node_Str");
    return;
  }
  httpService=(HttpService)services.get(HttpService.class.getName());
  KnapsackInitService initService=(KnapsackInitService)services.get(KnapsackInitService.class.getName());
  configAdmin=(ConfigurationAdmin)services.get(ConfigurationAdmin.class.getName());
  servlets=new Hashtable<String,HttpServlet>();
  try {
    moduleServlet=new ModuleServlet(getExistingModules());
    context.addServiceListener(moduleServlet,FilterUtil.generateServiceFilter(IModuleControl.class.getName()));
    servlets.put(MODULE_WS_PATH,moduleServlet);
  }
 catch (  InvalidSyntaxException e) {
    log.log(LogService.LOG_ERROR,"String_Node_Str",e);
    return;
  }
  servlets.put(PACKAGE_WS_PATH,new PackageServlet(context));
  servlets.put(PROGRAM_WS_PATH,new ProgramServlet(context,initService));
  servlets.put(CONFIG_WS_PATH,new ConfigAdminServlet(context,configAdmin));
  servlets.put(SERVICE_WS_PATH,new WSServlet(context,serviceMap,configAdmin));
  servlets.put(SERVICE_HTML_PATH,new WSHtmlServlet(context,serviceMap,configAdmin));
  for (  Map.Entry<String,HttpServlet> e : servlets.entrySet())   try {
    httpService.registerServlet(e.getKey(),e.getValue(),null,null);
  }
 catch (  Exception e1) {
    log.log(LogService.LOG_ERROR,"String_Node_Str" + e.getKey(),e1);
  }
}

Fixed version (ground truth):
@Override public void run(Map<String,Object> services){
  if (servlets != null) {
    log.log(LogService.LOG_ERROR,"String_Node_Str");
    return;
  }
  httpService=(HttpService)services.get(HttpService.class.getName());
  KnapsackInitService initService=(KnapsackInitService)services.get(KnapsackInitService.class.getName());
  configAdmin=(ConfigurationAdmin)services.get(ConfigurationAdmin.class.getName());
  servlets=new Hashtable<String,HttpServlet>();
  try {
    moduleServlet=new ModuleServlet(getExistingModules());
    context.addServiceListener(moduleServlet,FilterUtil.generateServiceFilter(IModuleControl.class.getName()));
    servlets.put(MODULE_WS_PATH,moduleServlet);
  }
 catch (  InvalidSyntaxException e) {
    log.log(LogService.LOG_ERROR,"String_Node_Str",e);
    return;
  }
  servlets.put(PACKAGE_WS_PATH,new PackageServlet(context));
  servlets.put(PROGRAM_WS_PATH,new ProgramServlet(context,initService));
  servlets.put(CONFIG_WS_PATH,new ConfigAdminServlet(context,configAdmin));
  servlets.put(SERVICE_WS_PATH,new WSServlet(context,serviceMap,configAdmin));
  servlets.put(SERVICE_HTML_PATH,new WSHtmlServlet(context,serviceMap,configAdmin));
  for (  Map.Entry<String,HttpServlet> e : servlets.entrySet())   try {
    httpService.registerServlet(e.getKey(),e.getValue(),null,null);
  }
 catch (  Exception e1) {
    log.log(LogService.LOG_ERROR,"String_Node_Str" + e.getKey(),e1);
  }
}
Program: 180104
Project: 180104
Buggy source:
/** 
 * @param context BundleContext
 * @param runnable ManagedRunnable
 * @param serviceCount number of services tracked
 */
public ServiceTrackerUtil(BundleContext context,ManagedRunnable runnable,int serviceCount){
  this.bc=context;
  this.runnable=runnable;
  this.serviceCount=serviceCount;
  this.serviceMap=new Hashtable<String,Object>();
  this.runCalled=false;
  this.shutdownCalled=false;
  sc=0;
}

Fixed version (ground truth):
/** 
 * @param context BundleContext
 * @param runnable ManagedRunnable
 * @param serviceCount number of services tracked
 */
public ServiceTrackerUtil(BundleContext context,ManagedRunnable runnable,int serviceCount){
  this.bc=context;
  this.runnable=runnable;
  this.serviceCount=serviceCount;
  this.serviceMap=new HashMap<String,Object>();
  this.runCalled=false;
  this.shutdownCalled=false;
  sc=0;
}
Program: 180105
Project: 180105
Buggy source:
@Override public void run(Map<Object,Object> services){
  httpService=(HttpService)services.get(HttpService.class.getName());
  sewingRegistration=context.registerService(ISewingService.class.getName(),new SewingServiceImpl(httpService),null);
}

Fixed version (ground truth):
@Override public void run(Map<String,Object> services){
  httpService=(HttpService)services.get(HttpService.class.getName());
  sewingRegistration=context.registerService(ISewingService.class.getName(),new SewingServiceImpl(httpService),null);
}
Program: 180106
Project: 180106
Buggy source:
public void log(ServiceReference sr,int level,String message,Throwable exception){
  System.out.println(levelString(level) + message + "String_Node_Str"+ exception.toString());
  exception.printStackTrace(new PrintWriter(System.out,true));
  if (level == LogService.LOG_ERROR) {
    System.err.println(levelString(level) + message + "String_Node_Str"+ exception.toString());
    exception.printStackTrace(new PrintWriter(System.err,true));
  }
}

Fixed version (ground truth):
public void log(ServiceReference sr,int level,String message,Throwable exception){
  if (exception == null) {
    log(sr,level,message);
    return;
  }
  System.out.println(levelString(level) + message + "String_Node_Str"+ exception.toString());
  exception.printStackTrace(new PrintWriter(System.out,true));
  if (level == LogService.LOG_ERROR) {
    System.err.println(levelString(level) + message + "String_Node_Str"+ exception.toString());
    exception.printStackTrace(new PrintWriter(System.err,true));
  }
}
Program: 180108
Project: 180108
Buggy source:
/** 
 * Set the name of the tag.
 * @param tagName
 */
public XmlNode setName(String tagName){
  this.name=tagName;
  return this;
}

Fixed version (ground truth):
/** 
 * Set the name of the tag.
 * @param tagName Name of tag.
 * @return instance of node.
 */
public XmlNode setName(String tagName){
  this.name=tagName;
  return this;
}
Program: 180109
Project: 180109
Buggy source:
/** 
 * @param name
 * @return true if a node with the given name exists, false otherwise.
 */
public boolean childExists(String name){
  return hasChild(name);
}

Fixed version (ground truth):
/** 
 * @param name name of child node
 * @deprecated use hasChild()
 * @return true if a node with the given name exists, false otherwise.
 */
public boolean childExists(String name){
  return hasChild(name);
}
Program: 180110
Project: 180110
Buggy source:
/** 
 * @param name
 * @param value
 * @return
 */
public XmlNode setAttribute(String name,String value){
  attributes.put(name,value);
  return this;
}

Fixed version (ground truth):
/** 
 * @param name attribute name
 * @param value attribute value
 * @return instance of XmlNode
 */
public XmlNode setAttribute(String name,String value){
  attributes.put(name,value);
  return this;
}
Program: 180111
Project: 180111
Buggy source:
/** 
 * Get contents of attribute, or null if attribute does not exist.
 * @param name
 * @return
 */
public String getAttribute(String name){
  return (String)attributes.get(name);
}

Fixed version (ground truth):
/** 
 * Get contents of attribute, or null if attribute does not exist.
 * @param name name of attribute
 * @return value of attribute or null if does not exist.
 */
public String getAttribute(String name){
  return (String)attributes.get(name);
}
Program: 180112
Project: 180112
Buggy source:
/** 
 * @return
 * @throws XmlPullParserException
 */
private static XmlPullParser getParser(boolean isNamespaceAware) throws XmlPullParserException {
  if (parser == null) {
    if (factory == null) {
      factory=XmlPullParserFactory.newInstance("String_Node_Str",null);
    }
    factory.setNamespaceAware(isNamespaceAware);
    parser=factory.newPullParser();
  }
  parser=factory.newPullParser();
  return parser;
}

Fixed version (ground truth):
/** 
 * @param isNamespaceAware if namespaces should be parsed
 * @return An XmlNode that corresponds to the root of the parsed xmlString.
 * @throws XmlPullParserException on parse error
 */
private static XmlPullParser getParser(boolean isNamespaceAware) throws XmlPullParserException {
  if (parser == null) {
    if (factory == null) {
      factory=XmlPullParserFactory.newInstance("String_Node_Str",null);
    }
    factory.setNamespaceAware(isNamespaceAware);
    parser=factory.newPullParser();
  }
  parser=factory.newPullParser();
  return parser;
}
Program: 180113
Project: 180113
Buggy source:
/** 
 * @param parent
 * @throws SelfReferenceException
 */
public XmlNode setParent(XmlNode parent){
  if (parentNode != null) {
    parentNode.getChildren().remove(this);
  }
  parentNode=parent;
  return this;
}

Fixed version (ground truth):
/** 
 * Set the parent node.
 * @param parent parent node
 * @return instance of XmlNode
 */
public XmlNode setParent(XmlNode parent){
  if (parentNode != null) {
    parentNode.getChildren().remove(this);
  }
  parentNode=parent;
  return this;
}
Program: 180114
Project: 180114
Buggy source:
/** 
 * Create a node with a parent and a String value.
 * @param parent
 * @param tagName
 * @param value
 */
public XmlNode(XmlNode parent,String tagName,String value){
  this(parent,tagName);
  if (value.length() > 0) {
    this.value=value;
  }
}

Fixed version (ground truth):
/** 
 * Create a node with a parent and a String value.
 * @param parent Parent XmlNode.
 * @param tagName Name of tag.  RuntimeExeception will be thrown if null value is passed.
 * @param value List<XmlNode> of child nodes.
 */
public XmlNode(XmlNode parent,String tagName,String value){
  this(parent,tagName);
  if (value != null && value.length() > 0) {
    this.value=value;
  }
}
Program: 180115
Project: 180115
Buggy source:
/** 
 * @param nodeName
 * @return node with given name if exists or null otherwise.
 */
public XmlNode getChild(String nodeName){
  if (children == null) {
    return null;
  }
  for (Iterator<XmlNode> i=getChildren().iterator(); i.hasNext(); ) {
    XmlNode child=i.next();
    if (child.name.equals(nodeName)) {
      return child;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @param nodeName name of child node
 * @return node with given name if exists or null otherwise.
 */
public XmlNode getChild(String nodeName){
  if (children == null) {
    return null;
  }
  for (Iterator<XmlNode> i=getChildren().iterator(); i.hasNext(); ) {
    XmlNode child=i.next();
    if (child.name.equals(nodeName)) {
      return child;
    }
  }
  return null;
}
Program: 180116
Project: 180116
Buggy source:
public boolean hasValue(){
  return value != null;
}

Fixed version (ground truth):
/** 
 * @return true if value is not null
 */
public boolean hasValue(){
  return value != null;
}
Program: 180117
Project: 180117
Buggy source:
private static XmlNode parse(XmlPullParser parser2,XmlNode e) throws XmlPullParserException, IOException {
  while (true) {
switch (parser.next()) {
case XmlPullParser.START_TAG:
      if (e == null)       e=new XmlNode(parser.getName());
 else       e=new XmlNode(e,parser.getName());
    for (int i=0; i < parser.getAttributeCount(); ++i) {
      e.addAttribute(parser.getAttributeName(i),parser.getAttributeValue(i));
    }
  break;
case XmlPullParser.TEXT:
if (!parser.isWhitespace()) e.setValue(parser.getText());
break;
case XmlPullParser.END_TAG:
if (e.getParent() != null) e=e.getParent();
break;
case XmlPullParser.END_DOCUMENT:
return e;
default :
break;
}
}
}

Fixed version (ground truth):
/** 
 * @param pullParser parser
 * @param node XmlNode
 * @return An XmlNode that corresponds to the root of the parsed xmlString.
 * @throws XmlPullParserException on xml parse error
 * @throws IOException on I/O error
 */
private static XmlNode parse(XmlPullParser pullParser,XmlNode node) throws XmlPullParserException, IOException {
  while (true) {
switch (parser.next()) {
case XmlPullParser.START_TAG:
      if (node == null)       node=new XmlNode(parser.getName());
 else       node=new XmlNode(node,parser.getName());
    for (int i=0; i < parser.getAttributeCount(); ++i) {
      node.addAttribute(parser.getAttributeName(i),parser.getAttributeValue(i));
    }
  break;
case XmlPullParser.TEXT:
if (!parser.isWhitespace()) node.setValue(parser.getText());
break;
case XmlPullParser.END_TAG:
if (node.getParent() != null) node=node.getParent();
break;
case XmlPullParser.END_DOCUMENT:
return node;
default :
break;
}
}
}
Program: 180118
Project: 180118
Buggy source:
/** 
 * Clear the value of the XML node.
 */
public XmlNode clearValue(){
  value=null;
  return this;
}

Fixed version (ground truth):
/** 
 * Clear the value of the XML node.
 * @return instance of XmlNode
 */
public XmlNode clearValue(){
  value=null;
  return this;
}
Program: 180119
Project: 180119
Buggy source:
/** 
 * @return
 */
public String getValue(){
  return value;
}

Fixed version (ground truth):
/** 
 * @return value of tag.  Can be null.
 */
public String getValue(){
  return value;
}
Program: 180120
Project: 180120
Buggy source:
/** 
 * @param name
 * @param value
 * @return instance of self
 */
public XmlNode addAttribute(String name,String value){
  this.getAttributes().put(name,value);
  return this;
}

Fixed version (ground truth):
/** 
 * @param name name of attribute
 * @param value value of attribute
 * @return instance of self
 */
public XmlNode addAttribute(String name,String value){
  this.getAttributes().put(name,value);
  return this;
}
Program: 180121
Project: 180121
Buggy source:
public XmlNode setValue(String text){
  if (text == null) {
    clearValue();
  }
 else {
    if (hasValue())     throw new RuntimeException("String_Node_Str");
  }
  this.value=text;
  return this;
}

Fixed version (ground truth):
/** 
 * @param value Value of node.  Can only be called on nodes that do not contain children.  Runtime exception will be generated otherwise.
 * @return instance of node.
 */
public XmlNode setValue(String value){
  if (value == null) {
    clearValue();
  }
 else {
    if (hasValue())     throw new RuntimeException("String_Node_Str");
  }
  this.value=value;
  return this;
}
Program: 180122
Project: 180122
Buggy source:
/** 
 * @param name
 * @return true if a node with the given name exists, false otherwise.
 */
public boolean hasChild(String name){
  if (!hasChildren()) {
    return false;
  }
  if (getChild(name) != null) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @param name name of child node
 * @return true if a node with the given name exists, false otherwise.
 */
public boolean hasChild(String name){
  if (!hasChildren()) {
    return false;
  }
  if (getChild(name) != null) {
    return true;
  }
  return false;
}
Program: 180123
Project: 180123
Buggy source:
public String toString(){
  try {
    return serialize(this);
  }
 catch (  XmlPullParserException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
  return super.toString();
}

Fixed version (ground truth):
public String toString(){
  try {
    return serialize(this);
  }
 catch (  Exception e) {
  }
  return super.toString();
}
Program: 180124
Project: 180124
Buggy source:
/** 
 * Retrieve a node from this element using xpath-like notation. Ex. for <root><leaf1><leaf1><leaf2></root> call with "root/leaf1" to return first occurrence leaf1 node.
 * @param path
 * @return
 */
public XmlNode getFirstElement(String path){
  String[] elems=path.split("String_Node_Str");
  XmlNode root=this;
  for (int i=0; i < elems.length; ++i) {
    root=(XmlNode)root.getChild(elems[i]);
    if (root == null) {
      break;
    }
  }
  return root;
}

Fixed version (ground truth):
/** 
 * Retrieve a node from this element using xpath-like notation. Example: for "<root><leaf1></leaf1><leaf2/></root>" call with "root/leaf1" to return first occurrence leaf1 node.
 * @param path tree path expressed as node names delimited with '/' character.
 * @return The node or null if not found.
 */
public XmlNode getFirstElement(String path){
  String[] elems=path.split("String_Node_Str");
  XmlNode root=this;
  for (int i=0; i < elems.length; ++i) {
    root=(XmlNode)root.getChild(elems[i]);
    if (root == null) {
      break;
    }
  }
  return root;
}
Program: 180125
Project: 180125
Buggy source:
/** 
 * Equivalent to addChildElement except that unchecked exception is thrown on self referencing call.
 * @param element
 * @return
 */
public XmlNode addChild(XmlNode element){
  if (element == this) {
    throw new RuntimeException("String_Node_Str");
  }
  if (this.value != null) {
    throw new RuntimeException("String_Node_Str");
  }
  getChildren().add(element);
  element.setParent(this);
  return element;
}

Fixed version (ground truth):
/** 
 * Add a child XmlNode to the current node.  Runtime exception will be thrown if a node is added to itself. Runtime exception will also be generated if parent node already contains a value.
 * @param element Child XmlNode
 * @return instance of XmlNode
 */
public XmlNode addChild(XmlNode element){
  if (element == this) {
    throw new RuntimeException("String_Node_Str");
  }
  if (this.value != null) {
    throw new RuntimeException("String_Node_Str");
  }
  getChildren().add(element);
  element.setParent(this);
  return element;
}
Program: 180126
Project: 180126
Buggy source:
/** 
 * @param val Set's the intensity of the backlight 0-7.
 */
public int setBackLight(int val) throws IOException ;

Fixed version (ground truth):
/** 
 * Set's the intensity of the backlight.
 * @param val (0 - 100)
 * @return 0 if successful, 1 on failure.
 */
public int setBackLight(int val) throws IOException ;
Program: 180127
Project: 180127
Buggy source:
/** 
 * TODO: replace this with sysfs API.
 * @param sysfsEntry
 * @param value
 * @return
 * @throws IOException
 */
private int writeToSysfs(File sysfsEntry,String value) throws IOException {
  BufferedWriter out;
  out=new BufferedWriter(new FileWriter(sysfsEntry));
  out.write(String.valueOf(value));
  out.close();
  return 1;
}

Fixed version (ground truth):
/** 
 * TODO: replace this with sysfs API.
 * @param sysfsEntry file of sysfs entry
 * @param value value to write to file
 * @return 0
 * @throws IOException on File I/O error
 */
private int writeToSysfs(File sysfsEntry,String value) throws IOException {
  BufferedWriter out;
  out=new BufferedWriter(new FileWriter(sysfsEntry));
  out.write(String.valueOf(value));
  out.close();
  return 0;
}
Program: 180128
Project: 180128
Buggy source:
public int setBackLight(int val) throws IOException {
  if (val < 0 || val > 100) {
    throw new IllegalArgumentException();
  }
  return writeToSysfs(new File(BRIGHTNESS_SYSFS),String.valueOf(val));
}

Fixed version (ground truth):
public int setBackLight(int val) throws IOException {
  if (val < 0 || val > 100) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return writeToSysfs(new File(BRIGHTNESS_SYSFS),String.valueOf(val));
}
Program: 180129
Project: 180129
Buggy source:
/** 
 * servicesMap is SortedMap<String, Map<String, String>> where the key is the service name and the map is a map of service properties. (| (& (objectClass=com.buglabs.bug.module.bugbee.pub.IBUGBeeControl) (& (Provider=com.buglabs.bug.module.bugbee.BUGBeeModlet)(Slot=2))) (| (& (objectClass=com.buglabs.module.IModuleControl)) (& (objectClass=org.osgi.service.http.HttpService)(port=8082))))
 * @param servicesMap Map of services to generate filter with.
 * @return Filter as a string.
 */
public static String generateServiceFilter(SortedMap<String,Map<String,String>> servicesMap){
  if (servicesMap.size() == 1) {
    return "String_Node_Str" + Constants.OBJECTCLASS + "String_Node_Str"+ ((String)servicesMap.firstKey())+ "String_Node_Str"+ generatePropertiesFilter(new TreeMap((Map)servicesMap.get(servicesMap.firstKey())))+ "String_Node_Str";
  }
 else   if (servicesMap.size() > 1) {
    return "String_Node_Str" + generateServiceFilter(servicesMap.subMap(servicesMap.firstKey(),servicesMap.firstKey() + "String_Node_Str")) + generateServiceFilter(servicesMap.tailMap(servicesMap.firstKey() + "String_Node_Str"))+ "String_Node_Str";
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * servicesMap is SortedMap<String, Map<String, String>> where the key is the service name and the map is a map of service properties. (| (& (objectClass=com.buglabs.bug.module.bugbee.pub.IBUGBeeControl) (& (Provider=com.buglabs.bug.module.bugbee.BUGBeeModlet)(Slot=2))) (| (& (objectClass=com.buglabs.module.IModuleControl)) (& (objectClass=org.osgi.service.http.HttpService)(port=8082))))
 * @param servicesMap Map of services to generate filter with.
 * @return Filter as a string.
 */
public static String generateServiceFilter(SortedMap<String,Map<String,String>> servicesMap){
  if (servicesMap.size() == 1) {
    return "String_Node_Str" + Constants.OBJECTCLASS + "String_Node_Str"+ servicesMap.firstKey()+ "String_Node_Str"+ generatePropertiesFilter(new TreeMap(servicesMap.get(servicesMap.firstKey())))+ "String_Node_Str";
  }
 else   if (servicesMap.size() > 1) {
    return "String_Node_Str" + generateServiceFilter(servicesMap.subMap(servicesMap.firstKey(),servicesMap.firstKey() + "String_Node_Str")) + generateServiceFilter(servicesMap.tailMap(servicesMap.firstKey() + "String_Node_Str"))+ "String_Node_Str";
  }
  return "String_Node_Str";
}
Program: 180130
Project: 180130
Buggy source:
/** 
 * Generate a Filter as a String given a Map of property/value pairs. (& (prop1=value1) (& (prop2=value1)))
 * @param propertiesMap
 * @return Filter as a String
 */
public static String generatePropertiesFilter(SortedMap<String,String> propertiesMap){
  if (propertiesMap.size() == 1) {
    return "String_Node_Str" + propertiesMap.firstKey() + "String_Node_Str"+ propertiesMap.get(propertiesMap.firstKey())+ "String_Node_Str";
  }
 else   if (propertiesMap.size() > 1) {
    return "String_Node_Str" + generatePropertiesFilter(propertiesMap.subMap(propertiesMap.firstKey(),propertiesMap.firstKey() + "String_Node_Str")) + generatePropertiesFilter(propertiesMap.tailMap(propertiesMap.firstKey() + "String_Node_Str"))+ "String_Node_Str";
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Generate a Filter as a String given a Map of property/value pairs. (& (prop1=value1) (& (prop2=value1)))
 * @param propertiesMap Map of properties
 * @return Filter as a String
 */
public static String generatePropertiesFilter(SortedMap<String,String> propertiesMap){
  if (propertiesMap.size() == 1) {
    return "String_Node_Str" + propertiesMap.firstKey() + "String_Node_Str"+ propertiesMap.get(propertiesMap.firstKey())+ "String_Node_Str";
  }
 else   if (propertiesMap.size() > 1) {
    return "String_Node_Str" + generatePropertiesFilter(propertiesMap.subMap(propertiesMap.firstKey(),propertiesMap.firstKey() + "String_Node_Str")) + generatePropertiesFilter(propertiesMap.tailMap(propertiesMap.firstKey() + "String_Node_Str"))+ "String_Node_Str";
  }
  return "String_Node_Str";
}
Program: 180131
Project: 180131
Buggy source:
/** 
 * servicesMap is SortedMap<String, Map<String, String>> where the key is the service name and the map is a map of service properties (| (& (objectClass=com.buglabs.bug.module.bugbee.pub.IBUGBeeControl) (& (Provider=com.buglabs.bug.module.bugbee.BUGBeeModlet)(Slot=2))) (| (& (objectClass=com.buglabs.module.IModuleControl)) (& (objectClass=org.osgi.service.http.HttpService)(port=8082))))
 */
public static String generateServiceFilter(SortedMap<String,Map<String,String>> servicesMap){
  if (servicesMap.size() == 1) {
    return "String_Node_Str" + Constants.OBJECTCLASS + "String_Node_Str"+ ((String)servicesMap.firstKey())+ "String_Node_Str"+ generatePropertiesFilter(new TreeMap((Map)servicesMap.get(servicesMap.firstKey())))+ "String_Node_Str";
  }
 else   if (servicesMap.size() > 1) {
    return "String_Node_Str" + generateServiceFilter(servicesMap.subMap(servicesMap.firstKey(),servicesMap.firstKey() + "String_Node_Str")) + generateServiceFilter(servicesMap.tailMap(servicesMap.firstKey() + "String_Node_Str"))+ "String_Node_Str";
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * servicesMap is SortedMap<String, Map<String, String>> where the key is the service name and the map is a map of service properties. (| (& (objectClass=com.buglabs.bug.module.bugbee.pub.IBUGBeeControl) (& (Provider=com.buglabs.bug.module.bugbee.BUGBeeModlet)(Slot=2))) (| (& (objectClass=com.buglabs.module.IModuleControl)) (& (objectClass=org.osgi.service.http.HttpService)(port=8082))))
 * @param servicesMap Map of services to generate filter with.
 * @return Filter as a string.
 */
public static String generateServiceFilter(SortedMap<String,Map<String,String>> servicesMap){
  if (servicesMap.size() == 1) {
    return "String_Node_Str" + Constants.OBJECTCLASS + "String_Node_Str"+ ((String)servicesMap.firstKey())+ "String_Node_Str"+ generatePropertiesFilter(new TreeMap((Map)servicesMap.get(servicesMap.firstKey())))+ "String_Node_Str";
  }
 else   if (servicesMap.size() > 1) {
    return "String_Node_Str" + generateServiceFilter(servicesMap.subMap(servicesMap.firstKey(),servicesMap.firstKey() + "String_Node_Str")) + generateServiceFilter(servicesMap.tailMap(servicesMap.firstKey() + "String_Node_Str"))+ "String_Node_Str";
  }
  return "String_Node_Str";
}
Program: 180132
Project: 180132
Buggy source:
public void removedService(ServiceReference arg0,Object arg1){
  if (shutdownCalled)   return;
  String key=((String[])arg0.getProperty(Constants.OBJECTCLASS))[0];
  if (serviceMap.containsKey(key)) {
    serviceMap.remove(key);
    sc--;
  }
  if (!(thread == null) && !thread.isInterrupted()) {
    try {
      runnable.shutdown();
    }
 catch (    Exception e) {
      if (arg0 != null && arg0.getBundle() != null && arg0.getBundle().getBundleContext() != null) {
        LogService ls=LogServiceUtil.getLogService(arg0.getBundle().getBundleContext());
        if (ls != null) {
          ls.log(LogService.LOG_ERROR,"String_Node_Str",e);
        }
      }
    }
    thread.interrupt();
    thread=null;
    shutdownCalled=true;
    runCalled=false;
    return;
  }
  if (runnable instanceof ManagedInlineRunnable) {
    ((ManagedInlineRunnable)runnable).shutdown();
    shutdownCalled=true;
    runCalled=false;
  }
}

Fixed version (ground truth):
public void removedService(ServiceReference reference,Object arg1){
  if (shutdownCalled)   return;
  String key=((String[])reference.getProperty(Constants.OBJECTCLASS))[0];
  if (serviceMap.containsKey(key)) {
    serviceMap.remove(key);
    sc--;
  }
  if (!(thread == null) && !thread.isInterrupted()) {
    try {
      runnable.shutdown();
    }
 catch (    Exception e) {
      if (reference != null && reference.getBundle() != null && reference.getBundle().getBundleContext() != null) {
        LogService ls=LogServiceUtil.getLogService(reference.getBundle().getBundleContext());
        if (ls != null) {
          ls.log(LogService.LOG_ERROR,"String_Node_Str",e);
        }
      }
    }
    thread.interrupt();
    thread=null;
    shutdownCalled=true;
    runCalled=false;
    return;
  }
  if (runnable instanceof ManagedInlineRunnable) {
    ((ManagedInlineRunnable)runnable).shutdown();
    shutdownCalled=true;
    runCalled=false;
  }
}
Program: 180133
Project: 180133
Buggy source:
public void modifiedService(ServiceReference arg0,Object arg1){
  String key=((String[])arg0.getProperty(Constants.OBJECTCLASS))[0];
  serviceMap.put(key,arg1);
}

Fixed version (ground truth):
public void modifiedService(ServiceReference reference,Object arg1){
  String key=((String[])reference.getProperty(Constants.OBJECTCLASS))[0];
  serviceMap.put(key,arg1);
}
Program: 180134
Project: 180134
Buggy source:
public void start(BundleContext context) throws Exception {
  Activator.context=context;
  modules=new IModuleControl[BUGBundleConstants.BUG_TOTAL_BMI_SLOTS];
  checkSetting();
  batteryProvider=new BatteryInfoProvider();
  batteryReg=context.registerService(IBatteryInfoProvider.class.getName(),batteryProvider,null);
  stc=ServiceTrackerUtil.openServiceTracker(context,new DashApplication(context),services);
  new BUGwebAdminServiceTracker(context);
  appReg=context.registerService(IDesktopApp.class.getName(),this,null);
}

Fixed version (ground truth):
public void start(BundleContext context) throws Exception {
  Activator.context=context;
  modules=new IModuleControl[BUGBundleConstants.BUG_TOTAL_BMI_SLOTS];
  checkSetting();
  batteryProvider=new BatteryInfoProvider();
  batteryReg=context.registerService(IBatteryInfoProvider.class.getName(),batteryProvider,null);
  stc=ServiceTrackerUtil.openServiceTracker(context,new DashApplication(context),services);
  new BUGwebAdminServiceTracker(context);
  appReg=context.registerService(IDesktopApp.class.getName(),this,null);
  context.addServiceListener(this,FilterUtil.generateServiceFilter(IModuleControl.class.getName()));
}
Program: 180135
Project: 180135
Buggy source:
public void stop(BundleContext context) throws Exception {
  appReg.unregister();
  ShellUtil.destroySession();
  stc.close();
  if (batteryReg != null)   batteryReg.unregister();
}

Fixed version (ground truth):
public void stop(BundleContext context) throws Exception {
  context.removeServiceListener(this);
  appReg.unregister();
  ShellUtil.destroySession();
  stc.close();
  if (batteryReg != null)   batteryReg.unregister();
}
Program: 180136
Project: 180136
Buggy source:
@Override public void run(Map<String,Object> services){
  LogManager.logInfo("String_Node_Str");
  service=(ISewingService)services.get(ISewingService.class.getName());
  mainServlet=new BUGwebAdminServlet();
  hardwareServlet=new BUGwebAdminHardwareServlet();
  systemServlet=new BUGwebAdminSystemServlet();
  softwareServlet=new BUGwebAdminSoftwareServlet();
  bugnetServlet=new BUGwebAdminBUGnetServlet();
  utilsServlet=new BUGwebAdminUtilsServlet();
  imageServlet=new BUGwebFileServlet();
  service.register(context,"String_Node_Str",mainServlet);
  service.register(context,"String_Node_Str",hardwareServlet);
  service.register(context,"String_Node_Str",systemServlet);
  service.register(context,"String_Node_Str",softwareServlet);
  service.register(context,"String_Node_Str",bugnetServlet);
  service.register(context,"String_Node_Str",utilsServlet);
  service.register(context,"String_Node_Str",imageServlet);
  try {
    moduleTracker=new ServiceTracker(context,FilterUtil.generateServiceFilter(context,new String[]{IModuleControl.class.getName()}),new BUGwebAdminModuleControlServiceTracker(context));
    moduleTracker.open();
  }
 catch (  InvalidSyntaxException e) {
  }
}

Fixed version (ground truth):
@Override public void run(Map<String,Object> services){
  LogManager.logInfo("String_Node_Str");
  sewingService=(ISewingService)services.get(ISewingService.class.getName());
  mainServlet=new BUGwebAdminServlet();
  hardwareServlet=new BUGwebAdminHardwareServlet();
  systemServlet=new BUGwebAdminSystemServlet();
  softwareServlet=new BUGwebAdminSoftwareServlet();
  bugnetServlet=new BUGwebAdminBUGnetServlet();
  utilsServlet=new BUGwebAdminUtilsServlet();
  imageServlet=new BUGwebFileServlet();
  sewingService.register(context,"String_Node_Str",mainServlet);
  sewingService.register(context,"String_Node_Str",hardwareServlet);
  sewingService.register(context,"String_Node_Str",systemServlet);
  sewingService.register(context,"String_Node_Str",softwareServlet);
  sewingService.register(context,"String_Node_Str",bugnetServlet);
  sewingService.register(context,"String_Node_Str",utilsServlet);
  sewingService.register(context,"String_Node_Str",imageServlet);
}
Program: 180137
Project: 180137
Buggy source:
@Override public void shutdown(){
  LogManager.logInfo("String_Node_Str");
  service.unregister(mainServlet);
  service.unregister(hardwareServlet);
  service.unregister(systemServlet);
  service.unregister(softwareServlet);
  service.unregister(bugnetServlet);
  service.unregister(utilsServlet);
  service.unregister(imageServlet);
  ShellUtil.destroySession();
  if (moduleTracker != null)   moduleTracker.close();
}

Fixed version (ground truth):
@Override public void shutdown(){
  LogManager.logInfo("String_Node_Str");
  sewingService.unregister(mainServlet);
  sewingService.unregister(hardwareServlet);
  sewingService.unregister(systemServlet);
  sewingService.unregister(softwareServlet);
  sewingService.unregister(bugnetServlet);
  sewingService.unregister(utilsServlet);
  sewingService.unregister(imageServlet);
  ShellUtil.destroySession();
}
Program: 180138
Project: 180138
Buggy source:
public URL getResource(String name){
  return context.getBundle().getResource(name);
}

Fixed version (ground truth):
public URL getResource(String name){
  if (name.equals(root))   name=name + "String_Node_Str";
  return context.getBundle().getResource(name);
}
Program: 180139
Project: 180139
Buggy source:
@Override public void run(Map<Object,Object> services){
  this.httpService=(HttpService)services.get(HttpService.class.getName());
  try {
    logService.log(LogService.LOG_INFO,"String_Node_Str");
    httpService.registerServlet(INFO_SERVLET_PATH,new SupportServlet(new BUGSupportInfo(context),new SupportInfoXMLFormatter()),null,null);
    httpService.registerServlet(INFO_SERVLET_HTML_PATH,new SupportServlet(new BUGSupportInfo(context),new SupportInfoTextFormatter()),null,null);
    httpService.registerResources(ROOT_ALIAS,"String_Node_Str",new StaticResourceContext());
  }
 catch (  ServletException e) {
    logService.log(LogService.LOG_ERROR,"String_Node_Str" + e.getMessage());
  }
catch (  NamespaceException e) {
    logService.log(LogService.LOG_ERROR,"String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
@Override public void run(Map<Object,Object> services){
  this.httpService=(HttpService)services.get(HttpService.class.getName());
  try {
    logService.log(LogService.LOG_INFO,"String_Node_Str");
    httpService.registerServlet(INFO_SERVLET_PATH,new SupportServlet(new BUGSupportInfo(context),new SupportInfoXMLFormatter()),null,null);
    httpService.registerServlet(INFO_SERVLET_HTML_PATH,new SupportServlet(new BUGSupportInfo(context),new SupportInfoTextFormatter()),null,null);
    httpService.registerResources(ROOT_ALIAS,"String_Node_Str",new StaticResourceContext("String_Node_Str" + ROOT_ALIAS));
  }
 catch (  ServletException e) {
    logService.log(LogService.LOG_ERROR,"String_Node_Str" + e.getMessage());
  }
catch (  NamespaceException e) {
    logService.log(LogService.LOG_ERROR,"String_Node_Str" + e.getMessage());
  }
}
Program: 180140
Project: 180140
Buggy source:
/** 
 * System - File Browser
 */
public SewingController getFileBrowserController(){
  return new fileBrowserController();
}

Fixed version (ground truth):
/** 
 * System - File Browser
 */
public SewingController getFileBrowserController(){
  return new FileBrowserController();
}
Program: 180141
Project: 180141
Buggy source:
public SewingController getFileNavigatorController(){
  return new fileNavigatorController();
}

Fixed version (ground truth):
public SewingController getFileNavigatorController(){
  return new FileNavigatorController();
}
Program: 180142
Project: 180142
Buggy source:
public SewingController getFileDownloadController(){
  return new fileDownloadController();
}

Fixed version (ground truth):
public SewingController getFileDownloadController(){
  return new FileDownloadController();
}
Program: 180143
Project: 180143
Buggy source:
/** 
 * Login/Logout - Secure Login/Logout for BUG
 */
public SewingController getBugLoginController(){
  return new BugLoginController();
}

Fixed version (ground truth):
/** 
 * Login/Logout - Secure Login/Logout for BUG
 */
public SewingController getBugLoginController(){
  return new BUGLoginController();
}
Program: 180144
Project: 180144
Buggy source:
public SewingController getFileViewerController(){
  return new fileViewerController();
}

Fixed version (ground truth):
public SewingController getFileViewerController(){
  return new FileViewerController();
}
Program: 180145
Project: 180145
Buggy source:
public void buttonEvent(ButtonEvent event);

Fixed version (ground truth):
/** 
 * Method called when a button event has occurred.
 * @param event information of event
 */
void buttonEvent(ButtonEvent event);
Program: 180146
Project: 180146
Buggy source:
public void removeListener(IButtonEventListener listener);

Fixed version (ground truth):
/** 
 * Remove a listener for button events.
 * @param listener IButtonEventListener
 */
void removeListener(IButtonEventListener listener);
Program: 180147
Project: 180147
Buggy source:
public void addListener(IButtonEventListener listener);

Fixed version (ground truth):
/** 
 * Add a listener for button events.
 * @param listener IButtonEventListener
 */
void addListener(IButtonEventListener listener);
Program: 180148
Project: 180148
Buggy source:
/** 
 * Return true if the repsonse is an error. If the response is an error, mimeType and Content are ignored.
 * @return
 */
public boolean isError();

Fixed version (ground truth):
/** 
 * Return true if the repsonse is an error. If the response is an error, mimeType and Content are ignored.
 * @return true on error
 */
boolean isError();
Program: 180149
Project: 180149
Buggy source:
/** 
 * Return an appropriate mime-type for content being passed.
 * @return
 */
public String getMimeType();

Fixed version (ground truth):
/** 
 * Return an appropriate mime-type for content being passed.
 * @return mime type
 */
String getMimeType();
Program: 180150
Project: 180150
Buggy source:
/** 
 * Return error code if the response is an error.
 * @return
 */
public int getErrorCode();

Fixed version (ground truth):
/** 
 * Return error code if the response is an error.
 * @return HTTP error code
 */
int getErrorCode();
Program: 180151
Project: 180151
Buggy source:
/** 
 * Get content of response.
 * @return
 */
public Object getContent();

Fixed version (ground truth):
/** 
 * Get content of response.
 * @return content, could be a Stream or a String.
 */
Object getContent();
Program: 180152
Project: 180152
Buggy source:
/** 
 * Return error message if the response is an error.
 * @return
 */
public String getErrorMessage();

Fixed version (ground truth):
/** 
 * Return error message if the response is an error.
 * @return Error String
 */
String getErrorMessage();
Program: 180153
Project: 180153
Buggy source:
/** 
 * Register a service to be exposed as a public web service.
 * @param provider
 */
void registerService(PublicWSProvider provider);

Fixed version (ground truth):
/** 
 * Register a service to be exposed as a public web service.
 * @param provider PublicWSProvider
 */
void registerService(PublicWSProvider provider);
Program: 180154
Project: 180154
Buggy source:
/** 
 * Unregister an existing service.
 * @param provider
 */
void unregisterService(PublicWSProvider provider);

Fixed version (ground truth):
/** 
 * Unregister an existing service.
 * @param provider PublicWSProvider
 */
void unregisterService(PublicWSProvider provider);
Program: 180155
Project: 180155
Buggy source:
/** 
 * @return The mime-type of the returned data (if any).
 */
public String getReturnType();

Fixed version (ground truth):
/** 
 * @return The mime-type of the returned data (if any).
 */
String getReturnType();
Program: 180156
Project: 180156
Buggy source:
/** 
 * @return A list of <code>String</code> that define parameter names.
 */
public List<String> getParameters();

Fixed version (ground truth):
/** 
 * @return A list of <code>String</code> that define parameter names.
 */
List<String> getParameters();
Program: 180158
Project: 180158
Buggy source:
public void run(){
  logService.log(LogService.LOG_INFO,"String_Node_Str" + pipeFilename);
  while (!Thread.currentThread().isInterrupted()) {
    try {
      BufferedReader reader=new BufferedReader(new FileReader(pipeFilename));
      String line=null;
      while ((line=reader.readLine()) != null) {
        if (line.equals(POISON_PILL)) {
          return;
        }
        if (logService != null) {
          logService.log(LogService.LOG_DEBUG,"String_Node_Str" + line);
        }
        try {
          BMIModuleEvent m=new BMIModuleEvent(line);
          eventHandler.handleEvent(m);
        }
 catch (        IOException e) {
          logService.log(LogService.LOG_ERROR,"String_Node_Str" + line);
        }
      }
    }
 catch (    FileNotFoundException e) {
      logService.log(LogService.LOG_ERROR,e.getMessage());
    }
catch (    IOException e) {
      logService.log(LogService.LOG_ERROR,e.getMessage());
    }
 finally {
      IOUtils.closeQuietly(stream);
    }
  }
}

Fixed version (ground truth):
public void run(){
  logService.log(LogService.LOG_INFO,"String_Node_Str" + pipeFilename);
  while (!Thread.currentThread().isInterrupted()) {
    try {
      BufferedReader reader=new BufferedReader(new FileReader(pipeFilename));
      String line=null;
      String lastEvent="String_Node_Str";
      while ((line=reader.readLine()) != null) {
        if (line.equals(POISON_PILL)) {
          return;
        }
        if (line.equals(lastEvent)) {
          logService.log(LogService.LOG_DEBUG,"String_Node_Str");
          continue;
        }
        if (logService != null) {
          logService.log(LogService.LOG_DEBUG,"String_Node_Str" + line);
        }
        try {
          BMIModuleEvent m=new BMIModuleEvent(line);
          eventHandler.handleEvent(m);
        }
 catch (        IOException e) {
          logService.log(LogService.LOG_ERROR,"String_Node_Str" + line);
        }
        lastEvent=line;
      }
    }
 catch (    FileNotFoundException e) {
      logService.log(LogService.LOG_ERROR,e.getMessage());
    }
catch (    IOException e) {
      logService.log(LogService.LOG_ERROR,e.getMessage());
    }
 finally {
      IOUtils.closeQuietly(stream);
    }
  }
}
Program: 180159
Project: 180159
Buggy source:
public TemplateModelRoot get(RequestParameters params,HttpServletRequest req,HttpServletResponse resp){
  Configuration[] configs=null;
  try {
    configs=AdminConfigManager.getConfigurations();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
catch (  InvalidSyntaxException e) {
    e.printStackTrace();
  }
  SimpleHash root=new SimpleHash();
  SimpleList config_list=new SimpleList();
  SimpleHash item;
  String pid;
  for (int i=0; i < configs.length; i++) {
    pid=configs[i].getPid();
    item=new SimpleHash();
    item.put("String_Node_Str",pid);
    item.put("String_Node_Str",pid.replace('.','_'));
    config_list.add(item);
  }
  root.put("String_Node_Str",config_list);
  root.put("String_Node_Str",params.get("String_Node_Str"));
  return root;
}

Fixed version (ground truth):
public TemplateModelRoot get(RequestParameters params,HttpServletRequest req,HttpServletResponse resp){
  Configuration[] configs=null;
  try {
    configs=AdminConfigManager.getConfigurations();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
catch (  InvalidSyntaxException e) {
    e.printStackTrace();
  }
  SimpleHash root=new SimpleHash();
  SimpleList config_list=new SimpleList();
  SimpleHash item;
  String pid;
  if (configs != null) {
    for (int i=0; i < configs.length; i++) {
      pid=configs[i].getPid();
      item=new SimpleHash();
      item.put("String_Node_Str",pid);
      item.put("String_Node_Str",pid.replace('.','_'));
      config_list.add(item);
    }
  }
  root.put("String_Node_Str",config_list);
  root.put("String_Node_Str",params.get("String_Node_Str"));
  return root;
}
Program: 180161
Project: 180161
Buggy source:
@Override public void run(Map<Object,Object> services){
  LogManager.logInfo("String_Node_Str");
  service=(ISewingService)services.get(ISewingService.class);
  mainServlet=new BUGwebAdminServlet();
  hardwareServlet=new BUGwebAdminHardwareServlet();
  systemServlet=new BUGwebAdminSystemServlet();
  softwareServlet=new BUGwebAdminSoftwareServlet();
  bugnetServlet=new BUGwebAdminBUGnetServlet();
  utilsServlet=new BUGwebAdminUtilsServlet();
  imageServlet=new BUGwebFileServlet();
  service.register(context,"String_Node_Str",mainServlet);
  service.register(context,"String_Node_Str",hardwareServlet);
  service.register(context,"String_Node_Str",systemServlet);
  service.register(context,"String_Node_Str",softwareServlet);
  service.register(context,"String_Node_Str",bugnetServlet);
  service.register(context,"String_Node_Str",utilsServlet);
  service.register(context,"String_Node_Str",imageServlet);
  try {
    moduleTracker=new ServiceTracker(context,FilterUtil.generateServiceFilter(context,new String[]{IModuleControl.class.getName()}),new BUGwebAdminModuleControlServiceTracker(context));
    moduleTracker.open();
  }
 catch (  InvalidSyntaxException e) {
  }
}

Fixed version (ground truth):
@Override public void run(Map<Object,Object> services){
  LogManager.logInfo("String_Node_Str");
  service=(ISewingService)services.get(ISewingService.class.getName());
  mainServlet=new BUGwebAdminServlet();
  hardwareServlet=new BUGwebAdminHardwareServlet();
  systemServlet=new BUGwebAdminSystemServlet();
  softwareServlet=new BUGwebAdminSoftwareServlet();
  bugnetServlet=new BUGwebAdminBUGnetServlet();
  utilsServlet=new BUGwebAdminUtilsServlet();
  imageServlet=new BUGwebFileServlet();
  service.register(context,"String_Node_Str",mainServlet);
  service.register(context,"String_Node_Str",hardwareServlet);
  service.register(context,"String_Node_Str",systemServlet);
  service.register(context,"String_Node_Str",softwareServlet);
  service.register(context,"String_Node_Str",bugnetServlet);
  service.register(context,"String_Node_Str",utilsServlet);
  service.register(context,"String_Node_Str",imageServlet);
  try {
    moduleTracker=new ServiceTracker(context,FilterUtil.generateServiceFilter(context,new String[]{IModuleControl.class.getName()}),new BUGwebAdminModuleControlServiceTracker(context));
    moduleTracker.open();
  }
 catch (  InvalidSyntaxException e) {
  }
}
Program: 180162
Project: 180162
Buggy source:
public URL getResource(String path){
  int slash=path.indexOf('/',1);
  String file=path;
  if (slash > -1) {
    file=path.substring(slash);
  }
  return context.getBundle().getResource(getResourcePath() + file);
}

Fixed version (ground truth):
public URL getResource(String path){
  int slash=path.indexOf('/',1);
  String file=path;
  if (slash > -1) {
    file=path.substring(slash);
  }
  return context.getBundle().getResource(getResourcePath() + "String_Node_Str" + file);
}
Program: 180164
Project: 180164
Buggy source:
/** 
 * Parses out the full file path from the url
 * @param path - the full url
 * @return - the filepath
 */
private String parseFilePath(String path){
  int index=path.indexOf("String_Node_Str");
  String result=path.substring(index + "String_Node_Str".length());
  if (result.compareTo("String_Node_Str") == 0) {
    return result;
  }
 else {
    result=result.substring(1);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Parses out the full file path from the url
 * @param path - the full url
 * @return - the filepath
 */
private String parseFilePath(String path){
  if (path.length() == 0)   return path;
  int index=path.indexOf("String_Node_Str");
  String result=path.substring(index + "String_Node_Str".length());
  if (result.compareTo("String_Node_Str") == 0) {
    return result;
  }
 else {
    result=result.substring(1);
  }
  return result;
}
Program: 180165
Project: 180165
Buggy source:
public static LogService getLog(){
  return log;
}

Fixed version (ground truth):
/** 
 * @return Log Service
 */
public static LogService getLog(){
  return log;
}
Program: 180166
Project: 180166
Buggy source:
public void start(BundleContext bundleContext) throws Exception {
  Activator.context=bundleContext;
  log=LogServiceUtil.getLogService(bundleContext);
  st=ServiceTrackerUtil.openServiceTracker(bundleContext,this,services);
  serviceMap=new Hashtable();
}

Fixed version (ground truth):
public void start(BundleContext bundleContext) throws Exception {
  Activator.context=bundleContext;
  log=LogServiceUtil.getLogService(bundleContext);
  serviceMap=new Hashtable<String,PublicWSProvider>();
  st=ServiceTrackerUtil.openServiceTracker(bundleContext,this,services);
}