nus-yam/ex-repair huggingface dataset:
Program: 180216
Project: 180216
Buggy source:
/** 
 * Return a file represented the root directory of a BMI module given it's slot #.
 * @param slot
 * @return
 */
private File sysDirectory(int slot){
}

Fixed version (ground truth):
/** 
 * Return a file represented the root directory of a BMI module given it's slot #.
 * @param slot
 * @return
 */
private File sysDirectory(int slot){
  return new File("String_Node_Str" + slot + "String_Node_Str"+ slot);
}
Program: 180217
Project: 180217
Buggy source:
@Override public boolean accept(File dir,String name){
  return name.endsWith("String_Node_Str");
}

Fixed version (ground truth):
public boolean accept(File dir,String name){
  return name.endsWith("String_Node_Str");
}
Program: 180218
Project: 180218
Buggy source:
/** 
 * Log an exception and print nested exception if it exists.
 * @param logService
 * @param message
 * @param exception
 */
public static void logBundleException(LogService logService,String message,Exception exception){
  logService.log(LogService.LOG_ERROR,message + "String_Node_Str" + exception.getMessage());
  stackTraceToString(exception);
}

Fixed version (ground truth):
/** 
 * Log an exception and print nested exception if it exists.
 * @param logService
 * @param message
 * @param exception
 */
public static void logBundleException(LogService logService,String message,Exception exception){
  logService.log(LogService.LOG_ERROR,message + "String_Node_Str" + exception.getMessage()+ "String_Node_Str"+ stackTraceToString(exception));
}
Program: 180219
Project: 180219
Buggy source:
public BUGBaseControl() throws FileNotFoundException {
  batteryFH=new FileOutputStream[3];
  batteryFH[COLOR_BLUE]=new FileOutputStream(BATTERY_BLUE_CONTROL_FILE);
  batteryFH[COLOR_RED]=new FileOutputStream(BATTERY_RED_CONTROL_FILE);
  batteryFH[COLOR_GREEN]=new FileOutputStream(BATTERY_GREEN_CONTROL_FILE);
  powerFH=new FileOutputStream[1];
  powerFH[COLOR_BLUE]=new FileOutputStream(POWER_BLUE_CONTROL_FILE);
  wlanFH=new FileOutputStream[3];
  wlanFH[COLOR_BLUE]=new FileOutputStream(WLAN_BLUE_CONTROL_FILE);
  wlanFH[COLOR_RED]=new FileOutputStream(WLAN_RED_CONTROL_FILE);
  wlanFH[COLOR_GREEN]=new FileOutputStream(WLAN_GREEN_CONTROL_FILE);
  btFH=new FileOutputStream[0];
  btFH[COLOR_BLUE]=new FileOutputStream(BT_BLUE_CONTROL_FILE);
}

Fixed version (ground truth):
public BUGBaseControl() throws FileNotFoundException {
  batteryFH=new FileOutputStream[3];
  batteryFH[COLOR_BLUE]=new FileOutputStream(BATTERY_BLUE_CONTROL_FILE);
  batteryFH[COLOR_RED]=new FileOutputStream(BATTERY_RED_CONTROL_FILE);
  batteryFH[COLOR_GREEN]=new FileOutputStream(BATTERY_GREEN_CONTROL_FILE);
  powerFH=new FileOutputStream[1];
  powerFH[COLOR_BLUE]=new FileOutputStream(POWER_BLUE_CONTROL_FILE);
  wlanFH=new FileOutputStream[3];
  wlanFH[COLOR_BLUE]=new FileOutputStream(WLAN_BLUE_CONTROL_FILE);
  wlanFH[COLOR_RED]=new FileOutputStream(WLAN_RED_CONTROL_FILE);
  wlanFH[COLOR_GREEN]=new FileOutputStream(WLAN_GREEN_CONTROL_FILE);
  btFH=new FileOutputStream[1];
  btFH[COLOR_BLUE]=new FileOutputStream(BT_BLUE_CONTROL_FILE);
}
Program: 180220
Project: 180220
Buggy source:
/** 
 * @return Seconds part of DMS value
 */
public double getSeconds(){
  int i=dms.indexOf("String_Node_Str");
  String seconds=dms.substring(i);
  return Double.parseDouble(seconds) * 60;
}

Fixed version (ground truth):
/** 
 * @return Seconds part of DMS value
 */
public double getSeconds(){
  int i=dms.indexOf("String_Node_Str");
  if (i == -1) {
    return 0;
  }
  String seconds=dms.substring(i);
  return Double.parseDouble(seconds) * 60;
}
Program: 180221
Project: 180221
Buggy source:
public AbstractNMEASentence(String sentence){
  initialize();
  String[] fields=StringUtil.split(parseChecksum(sentence),FIELD_SEPARATOR);
  name=fields[0];
  for (int i=1; i < fields.length; ++i) {
    if (isEmpty(fields[i])) {
      continue;
    }
    parseField(i,fields[i],fields);
  }
  validate();
}

Fixed version (ground truth):
public AbstractNMEASentence(String sentence){
  initialize();
  String[] fields=StringUtil.split(parseChecksum(sentence),FIELD_SEPARATOR);
  name=fields[0];
  for (int i=1; i < fields.length; ++i) {
    if (isEmpty(fields[i])) {
      continue;
    }
    try {
      parseField(i,fields[i],fields);
    }
 catch (    RuntimeException e) {
      throw new NMEAParserException(e.getMessage());
    }
  }
  validate();
}
Program: 180222
Project: 180222
Buggy source:
/** 
 * Get a list of BMIMessage strings for existing modules based on entries in the /sys filesystem.
 * @return
 * @throws IOException
 */
private List getSysFSModules() throws IOException {
  List slots=null;
  for (int i=0; i < 4; ++i) {
    File prodFile=new File("String_Node_Str" + i + "String_Node_Str"+ i+ "String_Node_Str"+ i+ "String_Node_Str");
    System.out.println("String_Node_Str" + prodFile.getAbsolutePath());
    if (!prodFile.exists()) {
      logService.log(LogService.LOG_DEBUG,"String_Node_Str" + i);
      continue;
    }
    if (slots == null) {
      slots=new ArrayList();
    }
    BMIModuleProperties props=BMIModuleProperties.createFromSYSDirectory(prodFile.getParentFile());
    BMIMessage m=new BMIMessage(props,i);
    slots.add(m);
  }
  return slots;
}

Fixed version (ground truth):
/** 
 * Get a list of BMIMessage strings for existing modules based on entries in the /sys filesystem.
 * @return
 * @throws IOException
 */
private List getSysFSModules() throws IOException {
  List slots=null;
  for (int i=0; i < 4; ++i) {
    File prodFile=new File("String_Node_Str" + i + "String_Node_Str"+ i+ "String_Node_Str"+ i+ "String_Node_Str");
    if (!prodFile.exists()) {
      logService.log(LogService.LOG_DEBUG,"String_Node_Str" + i);
      continue;
    }
    if (slots == null) {
      slots=new ArrayList();
    }
    BMIModuleProperties props=BMIModuleProperties.createFromSYSDirectory(prodFile.getParentFile());
    BMIMessage m=new BMIMessage(props,i);
    slots.add(m);
  }
  return slots;
}
Program: 180223
Project: 180223
Buggy source:
public void run(){
  while (!Thread.currentThread().isInterrupted()) {
    try {
      ifs=new FileInputStream(pipeFilename);
      int c=0;
      StringBuffer sb=new StringBuffer();
      while ((c=ifs.read()) != -1) {
        sb.append((char)c);
        if (c == '\n' || c == '\r') {
          if (sb.toString().equals(POISON_PILL)) {
            return;
          }
          if (logService != null) {
            logService.log(LogService.LOG_DEBUG,"String_Node_Str" + sb.toString());
          }
          BMIMessage m=new BMIMessage(sb.toString());
          if (m.parse()) {
            if (m.getEvent() == BMIMessage.EVENT_INSERT) {
              m.setBMIModuleProperties(BMIModuleProperties.createFromSYSDirectory(sysDirectory(m.getSlot() + 1)));
            }
            manager.processMessage(m);
          }
 else {
            logService.log(LogService.LOG_ERROR,"String_Node_Str" + sb.toString());
          }
          break;
        }
      }
    }
 catch (    FileNotFoundException e) {
      logService.log(LogService.LOG_ERROR,e.getMessage());
    }
catch (    IOException e) {
      logService.log(LogService.LOG_ERROR,e.getMessage());
    }
 finally {
      try {
        if (ifs != null) {
          ifs.close();
        }
      }
 catch (      IOException e) {
      }
    }
  }
}

Fixed version (ground truth):
public void run(){
  while (!Thread.currentThread().isInterrupted()) {
    try {
      ifs=new FileInputStream(pipeFilename);
      int c=0;
      StringBuffer sb=new StringBuffer();
      while ((c=ifs.read()) != -1) {
        sb.append((char)c);
        if (c == '\n' || c == '\r') {
          if (sb.toString().equals(POISON_PILL)) {
            return;
          }
          if (logService != null) {
            logService.log(LogService.LOG_DEBUG,"String_Node_Str" + sb.toString());
          }
          BMIMessage m=new BMIMessage(sb.toString());
          if (m.parse()) {
            if (m.getEvent() == BMIMessage.EVENT_INSERT) {
              m.setBMIModuleProperties(BMIModuleProperties.createFromSYSDirectory(sysDirectory(m.getSlot())));
            }
            manager.processMessage(m);
          }
 else {
            logService.log(LogService.LOG_ERROR,"String_Node_Str" + sb.toString());
          }
          break;
        }
      }
    }
 catch (    FileNotFoundException e) {
      logService.log(LogService.LOG_ERROR,e.getMessage());
    }
catch (    IOException e) {
      logService.log(LogService.LOG_ERROR,e.getMessage());
    }
 finally {
      try {
        if (ifs != null) {
          ifs.close();
        }
      }
 catch (      IOException e) {
      }
    }
  }
}
Program: 180224
Project: 180224
Buggy source:
/** 
 * A BMIMessage for inserted module with parsed properties.
 * @param props
 * @param slot
 */
public BMIMessage(BMIModuleProperties props,int slot){
  this.props=props;
  this.moduleId=df.format(props.getProduct_id());
  this.version="String_Node_Str" + props.getRevision();
  this.slot=slot;
  this.event=EVENT_INSERT;
}

Fixed version (ground truth):
/** 
 * A BMIMessage for inserted module with parsed properties.
 * @param props
 * @param slot
 */
public BMIMessage(BMIModuleProperties props,int slot){
  this.props=props;
  this.moduleId=props.getProduct_id();
  this.version="String_Node_Str" + props.getRevision();
  this.slot=slot;
  this.event=EVENT_INSERT;
}
Program: 180225
Project: 180225
Buggy source:
public PublicWSDefinition discover(int operation){
  if (operation == PublicWSProvider.GET) {
    return new PublicWSDefinition(){
      public List getParameters(){
        return null;
      }
      public String getReturnType(){
        return "String_Node_Str";
      }
    }
;
  }
  return null;
}

Fixed version (ground truth):
public PublicWSDefinition discover(int operation){
  if (operation == PublicWSProvider2.GET) {
    return new PublicWSDefinition(){
      public List getParameters(){
        return null;
      }
      public String getReturnType(){
        return "String_Node_Str";
      }
    }
;
  }
  return null;
}
Program: 180226
Project: 180226
Buggy source:
public String getPublicName(){
  return "String_Node_Str";
}

Fixed version (ground truth):
public String getPublicName(){
  return serviceName;
}
Program: 180227
Project: 180227
Buggy source:
public IWSResponse execute(int operation,String input){
  if (operation == PublicWSProvider.GET) {
    return new WSResponse(getTimeXml(),"String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
public IWSResponse execute(int operation,String input){
  if (operation == PublicWSProvider2.GET) {
    return new WSResponse(getTimeXml(),"String_Node_Str");
  }
  return null;
}
Program: 180228
Project: 180228
Buggy source:
public PublicWSDefinition discover(int operation){
  if (operation == PublicWSProvider.GET) {
    return new PublicWSDefinition(){
      public List getParameters(){
        return null;
      }
      public String getReturnType(){
        return "String_Node_Str";
      }
    }
;
  }
  return null;
}

Fixed version (ground truth):
public PublicWSDefinition discover(int operation){
  if (operation == PublicWSProvider2.GET) {
    return new PublicWSDefinition(){
      public List getParameters(){
        return null;
      }
      public String getReturnType(){
        return "String_Node_Str";
      }
    }
;
  }
  return null;
}
Program: 180229
Project: 180229
Buggy source:
public String getPublicName(){
  return "String_Node_Str";
}

Fixed version (ground truth):
public String getPublicName(){
  return serviceName;
}
Program: 180230
Project: 180230
Buggy source:
public IWSResponse execute(int operation,String input){
  if (operation == PublicWSProvider.GET) {
    return new WSResponse(getAccelerationXml(),"String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
public IWSResponse execute(int operation,String input){
  if (operation == PublicWSProvider2.GET) {
    return new WSResponse(getAccelerationXml(),"String_Node_Str");
  }
  return null;
}
Program: 180231
Project: 180231
Buggy source:
public PublicWSDefinition discover(int operation){
  if (operation == PublicWSProvider.GET) {
    return new PublicWSDefinition(){
      public List getParameters(){
        return null;
      }
      public String getReturnType(){
        return "String_Node_Str";
      }
    }
;
  }
  return null;
}

Fixed version (ground truth):
public PublicWSDefinition discover(int operation){
  if (operation == PublicWSProvider2.GET) {
    return new PublicWSDefinition(){
      public List getParameters(){
        return null;
      }
      public String getReturnType(){
        return "String_Node_Str";
      }
    }
;
  }
  return null;
}
Program: 180232
Project: 180232
Buggy source:
public String getPublicName(){
  return "String_Node_Str";
}

Fixed version (ground truth):
public String getPublicName(){
  return serviceName;
}
Program: 180233
Project: 180233
Buggy source:
public IWSResponse execute(int operation,String input){
  if (operation == PublicWSProvider.GET) {
    return new WSResponse(getAccelerationXml(),"String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
public IWSResponse execute(int operation,String input){
  if (operation == PublicWSProvider2.GET) {
    return new WSResponse(getAccelerationXml(),"String_Node_Str");
  }
  return null;
}
Program: 180234
Project: 180234
Buggy source:
private long getReadDelay(){
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
  ServiceReference sr=context.getServiceReference(ConfigurationAdmin.class.getName());
  long read_delay=100;
  if (sr != null) {
    ConfigurationAdmin ca=(ConfigurationAdmin)context.getService(sr);
    log.log(LogService.LOG_DEBUG,"String_Node_Str");
    if (ca != null) {
      Configuration c;
      try {
        c=ca.getConfiguration(getModuleName());
        log.log(LogService.LOG_DEBUG,"String_Node_Str");
        String key="String_Node_Str";
        String factoryPid=c.getPid();
        Dictionary properties=c.getProperties();
        Object obj=c.getProperties().get(key);
        if (obj != null) {
          read_delay=Long.parseLong(obj.toString());
          log.log(LogService.LOG_DEBUG,"String_Node_Str" + read_delay);
        }
 else {
          c.getProperties().put(key,Long.toString(read_delay));
          c.update(c.getProperties());
          log.log(LogService.LOG_DEBUG,"String_Node_Str");
          Object object=c.getProperties().get(key);
          log.log(LogService.LOG_INFO,"String_Node_Str" + object.toString());
        }
      }
 catch (      IOException e) {
        log.log(LogService.LOG_ERROR,"String_Node_Str",e);
      }
    }
  }
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
  return read_delay;
}

Fixed version (ground truth):
private long getReadDelay(){
  ServiceReference sr=context.getServiceReference(ConfigurationAdmin.class.getName());
  long read_delay=100;
  if (sr != null) {
    ConfigurationAdmin ca=(ConfigurationAdmin)context.getService(sr);
    log.log(LogService.LOG_DEBUG,"String_Node_Str");
    if (ca != null) {
      Configuration c;
      try {
        c=ca.getConfiguration(getModuleName());
        log.log(LogService.LOG_DEBUG,"String_Node_Str");
        String key="String_Node_Str";
        String factoryPid=c.getPid();
        Dictionary properties=c.getProperties();
        Object obj=c.getProperties().get(key);
        if (obj != null) {
          read_delay=Long.parseLong(obj.toString());
          log.log(LogService.LOG_DEBUG,"String_Node_Str" + read_delay);
        }
 else {
          c.getProperties().put(key,Long.toString(read_delay));
          c.update(c.getProperties());
          log.log(LogService.LOG_DEBUG,"String_Node_Str");
          Object object=c.getProperties().get(key);
          log.log(LogService.LOG_INFO,"String_Node_Str" + object.toString());
        }
      }
 catch (      IOException e) {
        log.log(LogService.LOG_ERROR,"String_Node_Str",e);
      }
    }
  }
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
  return read_delay;
}
Program: 180235
Project: 180235
Buggy source:
public void start() throws Exception {
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
  gpsd.start();
  nmeaProvider.start();
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
  setPassiveAntenna();
  moduleRef=context.registerService(IModuleControl.class.getName(),this,null);
  ledRef=context.registerService(IModuleLEDController.class.getName(),this,createRemotableProperties(null));
  gpsControlRef=context.registerService(IGPSModuleControl.class.getName(),this,createRemotableProperties(null));
  nmeaRef=context.registerService(INMEARawFeed.class.getName(),gpsd,createRemotableProperties(null));
  nmeaProviderRef=context.registerService(INMEASentenceProvider.class.getName(),nmeaProvider,createRemotableProperties(null));
  wsTracker=PublicWSAdminTracker.createTracker(context,this);
  regionKey=StatusBarUtils.displayImage(context,icon,this.getModuleName());
  timer=new Timer();
  timer.schedule(new GPSFIXLEDStatusTask(this,log),500,5000);
  positionRef=context.registerService(IPositionProvider.class.getName(),this,createRemotableProperties(null));
  context.addServiceListener(nmeaProvider,"String_Node_Str" + Constants.OBJECTCLASS + "String_Node_Str"+ INMEASentenceSubscriber.class.getName()+ "String_Node_Str"+ Constants.OBJECTCLASS+ "String_Node_Str"+ IPositionSubscriber.class.getName()+ "String_Node_Str");
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
}

Fixed version (ground truth):
public void start() throws Exception {
  gpsd.start();
  nmeaProvider.start();
  log.log(LogService.LOG_INFO,"String_Node_Str");
  setPassiveAntenna();
  moduleRef=context.registerService(IModuleControl.class.getName(),this,null);
  ledRef=context.registerService(IModuleLEDController.class.getName(),this,createRemotableProperties(null));
  gpsControlRef=context.registerService(IGPSModuleControl.class.getName(),this,createRemotableProperties(null));
  nmeaRef=context.registerService(INMEARawFeed.class.getName(),gpsd,createRemotableProperties(null));
  nmeaProviderRef=context.registerService(INMEASentenceProvider.class.getName(),nmeaProvider,createRemotableProperties(null));
  wsTracker=PublicWSAdminTracker.createTracker(context,this);
  regionKey=StatusBarUtils.displayImage(context,icon,this.getModuleName());
  timer=new Timer();
  timer.schedule(new GPSFIXLEDStatusTask(this,log),500,5000);
  positionRef=context.registerService(IPositionProvider.class.getName(),this,createRemotableProperties(null));
  context.addServiceListener(nmeaProvider,"String_Node_Str" + Constants.OBJECTCLASS + "String_Node_Str"+ INMEASentenceSubscriber.class.getName()+ "String_Node_Str"+ Constants.OBJECTCLASS+ "String_Node_Str"+ IPositionSubscriber.class.getName()+ "String_Node_Str");
}
Program: 180236
Project: 180236
Buggy source:
public Position getPosition(){
  RMC rmc=nmeaProvider.getLastRMC();
  log.log(LogService.LOG_DEBUG,"String_Node_Str" + rmc.getLatitude() + "String_Node_Str"+ rmc.getLongitude());
  if (rmc != null) {
    try {
      Position pos=new Position(new Measurement(rmc.getLatitudeAsDMS().toDecimalDegrees() * Math.PI / 180.0,Unit.rad),new Measurement(rmc.getLongitudeAsDMS().toDecimalDegrees() * Math.PI / 180.0,Unit.rad),new Measurement(0.0d,Unit.m),null,null);
      return pos;
    }
 catch (    NumberFormatException e) {
      log.log(LogService.LOG_ERROR,"String_Node_Str",e);
      return null;
    }
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public Position getPosition(){
  RMC rmc=nmeaProvider.getLastRMC();
  if (rmc != null) {
    try {
      Position pos=new Position(new Measurement(rmc.getLatitudeAsDMS().toDecimalDegrees() * Math.PI / 180.0,Unit.rad),new Measurement(rmc.getLongitudeAsDMS().toDecimalDegrees() * Math.PI / 180.0,Unit.rad),new Measurement(0.0d,Unit.m),null,null);
      return pos;
    }
 catch (    NumberFormatException e) {
      log.log(LogService.LOG_ERROR,"String_Node_Str",e);
      return null;
    }
  }
 else {
    return null;
  }
}
Program: 180237
Project: 180237
Buggy source:
public void setup() throws Exception {
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
  String devnode_gps="String_Node_Str" + Integer.toString(slotId);
  String devnode_gpscontrol="String_Node_Str" + Integer.toString(slotId + 1);
  GPS gps=new GPS();
  CharDeviceUtils.openDeviceWithRetry(gps,devnode_gps,FCNTL_H.O_RDWR | FCNTL_H.O_NONBLOCK,2);
  int result=gps.init();
  if (result < 0) {
    throw new RuntimeException("String_Node_Str" + devnode_gpscontrol);
  }
  gpsis=new CharDeviceInputStream(gps);
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
  long delay=getReadDelay();
  log.log(LogService.LOG_DEBUG,"String_Node_Str" + delay);
  gpsd=new NMEARawFeed(gpsis,delay);
  nmeaProvider=new NMEASentenceProvider(gpsd.getInputStream(),context);
  gpscontrol=new GPSControl();
  CharDeviceUtils.openDeviceWithRetry(gpscontrol,devnode_gpscontrol,2);
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
}

Fixed version (ground truth):
public void setup() throws Exception {
  String devnode_gps="String_Node_Str" + Integer.toString(slotId);
  String devnode_gpscontrol="String_Node_Str" + Integer.toString(slotId + 1);
  GPS gps=new GPS();
  CharDeviceUtils.openDeviceWithRetry(gps,devnode_gps,FCNTL_H.O_RDWR | FCNTL_H.O_NONBLOCK,2);
  int result=gps.init();
  if (result < 0) {
    throw new RuntimeException("String_Node_Str" + devnode_gpscontrol);
  }
  gpsis=new CharDeviceInputStream(gps);
  long delay=getReadDelay();
  gpsd=new NMEARawFeed(gpsis,delay);
  nmeaProvider=new NMEASentenceProvider(gpsd.getInputStream(),context);
  gpscontrol=new GPSControl();
  CharDeviceUtils.openDeviceWithRetry(gpscontrol,devnode_gpscontrol,2);
}
Program: 180238
Project: 180238
Buggy source:
public com.buglabs.nmea.sentences.RMC getRMC(){
  if (cachedRMC == null) {
    return null;
  }
  return new com.buglabs.nmea.sentences.RMC(cachedRMC);
}

Fixed version (ground truth):
public com.buglabs.nmea.sentences.RMC getRMC(){
  if (cachedRMC == null || cachedRMC.getLatitude() == null || cachedRMC.getLongitude() == null) {
    return null;
  }
  return new com.buglabs.nmea.sentences.RMC(cachedRMC);
}
Program: 180239
Project: 180239
Buggy source:
/** 
 * bit 0: GPS FIX Active Low. bit 1: Overcurrent condition caused by the active antenna path. Active Low. bit 2: Output to wake up device from sleep after push_to_fix. Active High. bit 3: Input to download firmware to flash. bit 4: Unused bit 5: Unused bit 7, 6: 0, 1 Passtive Antenna (External Antenna) 1, 0 Active Antenna (Internal Antenna)
 * @return the value of the IOX register
 */
public int getStatus() throws IOException ;

Fixed version (ground truth):
/** 
 * bit 0: GPS FIX Active Low.  bit 1: Overcurrent condition caused by the active antenna path. Active Low.  bit 2: Output to wake up device from sleep after push_to_fix. Active High.  bit 3: Input to download firmware to flash.  bit 4: Unused  bit 5: Unused  bit 7, 6: 0, 1 Passtive Antenna (External Antenna) 1, 0 Active Antenna (Internal Antenna)
 * @return the value of the IOX register
 */
public int getStatus() throws IOException ;
Program: 180240
Project: 180240
Buggy source:
public void setup() throws Exception {
  String devnode_control=DEV_NODE_CONTROL;
  lcdcontrol=new LCDControl();
  if (lcdcontrol.open(devnode_control,FCNTL_H.O_RDWR) < 0) {
    throw new RuntimeException("String_Node_Str" + devnode_control);
  }
  String lcd_accel_devnode="String_Node_Str" + (slotId + 1);
  accel=new CharDevice();
  int result=accel.open(lcd_accel_devnode,FCNTL_H.O_RDWR);
  if (result >= 0) {
    accIs=new CharDeviceInputStream(accel);
    lcd_acc_is_prov=new LCDAccelerometerInputStreamProvider(accIs);
  }
 else {
    log.log(LogService.LOG_ERROR,"String_Node_Str" + lcd_accel_devnode + "String_Node_Str"+ result);
  }
}

Fixed version (ground truth):
public void setup() throws Exception {
  String devnode_control=DEV_NODE_CONTROL;
  lcdcontrol=new LCDControl();
  if (lcdcontrol.open(devnode_control,FCNTL_H.O_RDWR) < 0) {
    throw new RuntimeException("String_Node_Str" + devnode_control);
  }
  String lcd_accel_devnode="String_Node_Str" + (slotId + 1);
  accel=new CharDevice();
  try {
    CharDeviceUtils.openDeviceWithRetry(accel,lcd_accel_devnode,2);
    accIs=new CharDeviceInputStream(accel);
    lcd_acc_is_prov=new LCDAccelerometerInputStreamProvider(accIs);
  }
 catch (  IOException e) {
    log.log(LogService.LOG_ERROR,e.getMessage());
  }
}
Program: 180241
Project: 180241
Buggy source:
public com.buglabs.nmea.sentences.RMC getRMC(){
  return new com.buglabs.nmea.sentences.RMC(cachedRMC);
}

Fixed version (ground truth):
public com.buglabs.nmea.sentences.RMC getRMC(){
  if (cachedRMC == null) {
    return null;
  }
  return new com.buglabs.nmea.sentences.RMC(cachedRMC);
}
Program: 180242
Project: 180242
Buggy source:
/** 
 * For a given string, return true if is null or empy, false otherwise.
 * @param val
 * @return
 */
private boolean isEmpty(String val){
  return val == null || val.length() == 0;
}

Fixed version (ground truth):
/** 
 * For a given string, return true if is null or empty, false otherwise.
 * @param val
 * @return
 */
private boolean isEmpty(String val){
  return val == null || val.length() == 0;
}
Program: 180243
Project: 180243
Buggy source:
public RMC(com.buglabs.nmea2.RMC newRMC){
  super("String_Node_Str");
  this.timeOfFix=newRMC.getTimeOfFix();
  this.dataStatus=newRMC.getDataStatus();
  this.groundSpeed=newRMC.getGroundSpeed();
  this.dateStamp=newRMC.getDateStamp();
  this.magneticVariation=newRMC.getMagneticVariation();
  this.trackMadeGood=newRMC.getTrackMadeGood();
}

Fixed version (ground truth):
public RMC(com.buglabs.nmea2.RMC newRMC){
  super("String_Node_Str");
  this.timeOfFix=newRMC.getTimeOfFix();
  this.dataStatus=newRMC.getDataStatus();
  this.groundSpeed=newRMC.getGroundSpeed();
  this.dateStamp=newRMC.getDateStamp();
  this.magneticVariation=newRMC.getMagneticVariation();
  this.trackMadeGood=newRMC.getTrackMadeGood();
  this.setLatitude(newRMC.getLatitude());
  this.setLongitude(newRMC.getLongitude());
}
Program: 180244
Project: 180244
Buggy source:
public String getPublicName(){
  return "String_Node_Str";
}

Fixed version (ground truth):
public String getPublicName(){
  return serviceName;
}
Program: 180245
Project: 180245
Buggy source:
public PublicWSDefinition discover(int operation){
  if (operation == PublicWSProvider.GET) {
    return new PublicWSDefinition(){
      public List getParameters(){
        return null;
      }
      public String getReturnType(){
        return "String_Node_Str";
      }
    }
;
  }
  return null;
}

Fixed version (ground truth):
public PublicWSDefinition discover(int operation){
  if (operation == PublicWSProvider2.GET) {
    return new PublicWSDefinition(){
      public List getParameters(){
        return null;
      }
      public String getReturnType(){
        return "String_Node_Str";
      }
    }
;
  }
  return null;
}
Program: 180246
Project: 180246
Buggy source:
public IWSResponse execute(int operation,String input){
  if (operation == PublicWSProvider.GET) {
    return new WSResponse(getPositionXml(),"String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
public IWSResponse execute(int operation,String input){
  if (operation == PublicWSProvider2.GET) {
    return new WSResponse(getPositionXml(),"String_Node_Str");
  }
  return null;
}
Program: 180247
Project: 180247
Buggy source:
public PublicWSDefinition discover(int operation){
  if (operation == PublicWSProvider.GET) {
    return new PublicWSDefinition(){
      public List getParameters(){
        return null;
      }
      public String getReturnType(){
        return IMAGE_MIME_TYPE;
      }
    }
;
  }
  return null;
}

Fixed version (ground truth):
public PublicWSDefinition discover(int operation){
  if (operation == PublicWSProvider2.GET) {
    return new PublicWSDefinition(){
      public List getParameters(){
        return null;
      }
      public String getReturnType(){
        return IMAGE_MIME_TYPE;
      }
    }
;
  }
  return null;
}
Program: 180248
Project: 180248
Buggy source:
public String getPublicName(){
  return "String_Node_Str";
}

Fixed version (ground truth):
public String getPublicName(){
  return serviceName;
}
Program: 180249
Project: 180249
Buggy source:
public IWSResponse execute(int operation,String input){
  if (operation == PublicWSProvider.GET) {
    return new WSResponse(getImageInputStream(),IMAGE_MIME_TYPE);
  }
  return null;
}

Fixed version (ground truth):
public IWSResponse execute(int operation,String input){
  if (operation == PublicWSProvider2.GET) {
    return new WSResponse(getImageInputStream(),IMAGE_MIME_TYPE);
  }
  return null;
}
Program: 180250
Project: 180250
Buggy source:
/** 
 * Will throw NMEAParserException if parsing error occurs.
 * @param dms
 */
public DegreesMinutesSeconds(String dms){
  if (dms == null || dms.length() == 0 || dms.indexOf(',') == -1 || dms.indexOf('.') == -1) {
    throw new NMEAParserException("String_Node_Str" + dms);
  }
  int i=dms.indexOf("String_Node_Str");
  this.dms=dms.substring(0,i);
}

Fixed version (ground truth):
/** 
 * Will throw NMEAParserException if parsing error occurs.
 * @param dms
 */
public DegreesMinutesSeconds(String dms){
  if (dms == null || dms.length() == 0 || dms.indexOf(',') == -1 || dms.indexOf('.') == -1) {
    throw new NMEAParserException("String_Node_Str" + dms);
  }
  int i=dms.indexOf("String_Node_Str");
  this.dms=dms.substring(0,i);
  if (dms.length() > i + 1) {
    direction=dms.charAt(i + 1);
  }
}
Program: 180251
Project: 180251
Buggy source:
/** 
 * @return Degrees part of DMS
 */
public double getDegrees(){
  int i=dms.indexOf("String_Node_Str");
  if (i < 2) {
    throw new NMEAParserException("String_Node_Str" + dms);
  }
  if (dms.charAt(0) == '0') {
    return Double.parseDouble("String_Node_Str" + dms.substring(1,i - 2));
  }
  return Double.parseDouble(dms.substring(0,i - 2));
}

Fixed version (ground truth):
/** 
 * @return Degrees part of DMS
 */
public double getDegrees(){
  int i=dms.indexOf("String_Node_Str");
  if (i < 2) {
    throw new NMEAParserException("String_Node_Str" + dms);
  }
  double rawVal=Double.parseDouble(dms.substring(0,i - 2));
  if (direction == 'S' || direction == 'W') {
    rawVal=rawVal * -1;
  }
  return rawVal;
}
Program: 180252
Project: 180252
Buggy source:
public void stop() throws Exception {
  StatusBarUtils.releaseRegion(context,regionKey);
  if (wsMotionTracker != null) {
    wsMotionTracker.close();
  }
  if (wsAccTracker != null) {
    wsAccTracker.close();
  }
  if (moduleRef != null) {
    moduleRef.unregister();
  }
  if (vhModuleRef != null) {
    vhModuleRef.unregister();
  }
  if (ledref != null) {
    ledref.unregister();
  }
  if (cc != null) {
    cc.close();
  }
}

Fixed version (ground truth):
public void stop() throws Exception {
  StatusBarUtils.releaseRegion(context,regionKey);
  if (vhc != null) {
    vhc.dispose();
  }
  if (wsMotionTracker != null) {
    wsMotionTracker.close();
  }
  if (vhLedRef != null) {
    vhLedRef.unregister();
  }
  if (wsAccTracker != null) {
    wsAccTracker.close();
  }
  if (moduleRef != null) {
    moduleRef.unregister();
  }
  if (vhModuleRef != null) {
    vhModuleRef.unregister();
  }
  if (vhSerialRef != null) {
    vhSerialRef.unregister();
  }
  if (ledref != null) {
    ledref.unregister();
  }
  if (cc != null) {
    cc.close();
  }
}
Program: 180253
Project: 180253
Buggy source:
public void start() throws Exception {
  moduleRef=context.registerService(IModuleControl.class.getName(),this,createBasicServiceProperties());
  vhModuleRef=context.registerService(IVonHippelModuleControl.class.getName(),vhc,createBasicServiceProperties());
  ledref=context.registerService(IModuleLEDController.class.getName(),vhc,createBasicServiceProperties());
  VonHippelWS vhWS=new VonHippelWS(vhDevice);
  wsMotionTracker=PublicWSAdminTracker.createTracker(context,vhWS);
  regionKey=StatusBarUtils.displayImage(context,icon,this.getModuleName());
}

Fixed version (ground truth):
public void start() throws Exception {
  moduleRef=context.registerService(IModuleControl.class.getName(),this,createBasicServiceProperties());
  vhModuleRef=context.registerService(IVonHippelModuleControl.class.getName(),vhc,createBasicServiceProperties());
  vhSerialRef=context.registerService(IVonHippelSerialPort.class.getName(),vhc,createBasicServiceProperties());
  vhLedRef=context.registerService(IModuleLEDController.class.getName(),vhc,createBasicServiceProperties());
  ledref=context.registerService(IModuleLEDController.class.getName(),vhc,createBasicServiceProperties());
  VonHippelWS vhWS=new VonHippelWS(vhDevice);
  wsMotionTracker=PublicWSAdminTracker.createTracker(context,vhWS);
  regionKey=StatusBarUtils.displayImage(context,icon,this.getModuleName());
}
Program: 180254
Project: 180254
Buggy source:
public InputStream getRS232InputStream(){
  try {
    return (cc.openInputStream());
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
public InputStream getRS232InputStream(){
  try {
    if (cc == null) {
      cc=(CommConnection)Connector.open(getCommString(),Connector.READ_WRITE,true);
    }
    if (inputStream == null) {
      inputStream=cc.openInputStream();
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return inputStream;
}
Program: 180255
Project: 180255
Buggy source:
public OutputStream getRS232OutputStream(){
  try {
    return (cc.openOutputStream());
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
public OutputStream getRS232OutputStream(){
  try {
    if (cc == null) {
      cc=(CommConnection)Connector.open(getCommString(),Connector.READ_WRITE,true);
    }
    if (outputStream == null) {
      outputStream=cc.openOutputStream();
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return outputStream;
}
Program: 180256
Project: 180256
Buggy source:
public VonHippelModuleControl(VonHippel vh,int slotId){
  vhDevice=vh;
  try {
    cc=(CommConnection)Connector.open("String_Node_Str" + slotId + "String_Node_Str",Connector.READ_WRITE,true);
  }
 catch (  IOException e) {
    System.err.println("String_Node_Str");
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public VonHippelModuleControl(VonHippel vh,int slotId){
  vhDevice=vh;
  this.slotId=slotId;
  baudrate="String_Node_Str";
  bitsPerChar=8;
  stopBits="String_Node_Str";
  parity="String_Node_Str";
  autoCTS=false;
  autoRTS=false;
  blocking=false;
}
Program: 180257
Project: 180257
Buggy source:
/** 
 * Gets the input stream associated with the RS232 port on Von Hippel module. This implementation is based on the javax.microedition.commports API. The port is set up with the following parameters in VonHippelModuleControl: baudrate=9600 bitsperchar=8 stopbits=1 parity=none autocts=off autorts=off blocking=off
 * @return stream associated with RS232 input (reading)
 */
public InputStream getRS232InputStream();

Fixed version (ground truth):
/** 
 * Gets the input stream associated with the RS232 port on Von Hippel module. This implementation is based on the javax.microedition.commports API. The port is set up with the following parameters in VonHippelModuleControl: baudrate=9600 bitsperchar=8 stopbits=1 parity=none autocts=off autorts=off blocking=off
 * @deprecated
 * @return stream associated with RS232 input (reading)
 */
public InputStream getRS232InputStream();
Program: 180258
Project: 180258
Buggy source:
/** 
 * Gets the output stream associated with the RS232 port on Von Hippel module. This implementation is based on the javax.microedition.commports API. The port is set up with the following parameters in VonHippelModuleControl: baudrate=9600 bitsperchar=8 stopbits=1 parity=none autocts=off autorts=off blocking=off
 * @return stream associated with RS232 output (writing)
 */
public OutputStream getRS232OutputStream();

Fixed version (ground truth):
/** 
 * Gets the output stream associated with the RS232 port on Von Hippel module. This implementation is based on the javax.microedition.commports API. The port is set up with the following parameters in VonHippelModuleControl: baudrate=9600 bitsperchar=8 stopbits=1 parity=none autocts=off autorts=off blocking=off
 * @deprecated
 * @return stream associated with RS232 output (writing)
 */
public OutputStream getRS232OutputStream();
Program: 180259
Project: 180259
Buggy source:
public RMC getLastRMC(){
  return cachedRMC;
}

Fixed version (ground truth):
public RMC getLastRMC(){
  if (cachedRMC == null || cachedRMC.getLatitude() == null || cachedRMC.getLongitude() == null) {
    return null;
  }
  return cachedRMC;
}
Program: 180260
Project: 180260
Buggy source:
/** 
 * @return Last parsed RMC NMEA sentence, or null if no sentence has been received.
 */
public com.buglabs.nmea2.RMC getLastRMC();

Fixed version (ground truth):
/** 
 * @return Last parsed RMC NMEA sentence, or null if no sentence with location information has been received.
 */
public com.buglabs.nmea2.RMC getLastRMC();
Program: 180261
Project: 180261
Buggy source:
public void start() throws Exception {
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
  gpsd.start();
  nmeaProvider.start();
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
  setPassiveAntenna();
  moduleRef=context.registerService(IModuleControl.class.getName(),this,null);
  ledRef=context.registerService(IModuleLEDController.class.getName(),this,createRemotableProperties(null));
  gpsControlRef=context.registerService(IGPSModuleControl.class.getName(),this,createRemotableProperties(null));
  nmeaRef=context.registerService(INMEARawFeed.class.getName(),gpsd,createRemotableProperties(null));
  nmeaProviderRef=context.registerService(INMEASentenceProvider.class.getName(),nmeaProvider,createRemotableProperties(null));
  wsTracker=PublicWSAdminTracker.createTracker(context,this);
  regionKey=StatusBarUtils.displayImage(context,icon,this.getModuleName());
  timer=new Timer();
  timer.schedule(new GPSFIXLEDStatusTask(this,log),500,5000);
  positionRef=context.registerService(IPositionProvider.class.getName(),this,createRemotableProperties(null));
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
}

Fixed version (ground truth):
public void start() throws Exception {
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
  gpsd.start();
  nmeaProvider.start();
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
  setPassiveAntenna();
  moduleRef=context.registerService(IModuleControl.class.getName(),this,null);
  ledRef=context.registerService(IModuleLEDController.class.getName(),this,createRemotableProperties(null));
  gpsControlRef=context.registerService(IGPSModuleControl.class.getName(),this,createRemotableProperties(null));
  nmeaRef=context.registerService(INMEARawFeed.class.getName(),gpsd,createRemotableProperties(null));
  nmeaProviderRef=context.registerService(INMEASentenceProvider.class.getName(),nmeaProvider,createRemotableProperties(null));
  wsTracker=PublicWSAdminTracker.createTracker(context,this);
  regionKey=StatusBarUtils.displayImage(context,icon,this.getModuleName());
  timer=new Timer();
  timer.schedule(new GPSFIXLEDStatusTask(this,log),500,5000);
  positionRef=context.registerService(IPositionProvider.class.getName(),this,createRemotableProperties(null));
  context.addServiceListener(nmeaProvider,"String_Node_Str" + Constants.OBJECTCLASS + "String_Node_Str"+ INMEASentenceSubscriber.class.getName()+ "String_Node_Str");
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
}
Program: 180262
Project: 180262
Buggy source:
public void stop() throws Exception {
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
  timer.cancel();
  StatusBarUtils.releaseRegion(context,regionKey);
  if (wsTracker != null) {
    wsTracker.close();
  }
  moduleRef.unregister();
  gpsControlRef.unregister();
  nmeaRef.unregister();
  ledRef.unregister();
  positionRef.unregister();
  nmeaProviderRef.unregister();
  nmeaProvider.interrupt();
  gpsd.interrupt();
  gpsis.close();
  gpscontrol.close();
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
}

Fixed version (ground truth):
public void stop() throws Exception {
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
  timer.cancel();
  StatusBarUtils.releaseRegion(context,regionKey);
  if (wsTracker != null) {
    wsTracker.close();
  }
  context.removeServiceListener(nmeaProvider);
  moduleRef.unregister();
  gpsControlRef.unregister();
  nmeaRef.unregister();
  ledRef.unregister();
  positionRef.unregister();
  nmeaProviderRef.unregister();
  nmeaProvider.interrupt();
  gpsd.interrupt();
  gpsis.close();
  gpscontrol.close();
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
}
Program: 180263
Project: 180263
Buggy source:
public void setup() throws Exception {
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
  String devnode_gps="String_Node_Str" + Integer.toString(slotId);
  String devnode_gpscontrol="String_Node_Str" + Integer.toString(slotId + 1);
  GPS gps=new GPS();
  CharDeviceUtils.openDeviceWithRetry(gps,devnode_gps,FCNTL_H.O_RDWR | FCNTL_H.O_NONBLOCK,2);
  int result=gps.init();
  if (result < 0) {
    throw new RuntimeException("String_Node_Str" + devnode_gpscontrol);
  }
  gpsis=new CharDeviceInputStream(gps);
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
  long delay=getReadDelay();
  log.log(LogService.LOG_DEBUG,"String_Node_Str" + delay);
  gpsd=new NMEARawFeed(gpsis,delay);
  nmeaProvider=new NMEASentenceProvider(gpsd.getInputStream(),log);
  gpscontrol=new GPSControl();
  CharDeviceUtils.openDeviceWithRetry(gpscontrol,devnode_gpscontrol,2);
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
}

Fixed version (ground truth):
public void setup() throws Exception {
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
  String devnode_gps="String_Node_Str" + Integer.toString(slotId);
  String devnode_gpscontrol="String_Node_Str" + Integer.toString(slotId + 1);
  GPS gps=new GPS();
  CharDeviceUtils.openDeviceWithRetry(gps,devnode_gps,FCNTL_H.O_RDWR | FCNTL_H.O_NONBLOCK,2);
  int result=gps.init();
  if (result < 0) {
    throw new RuntimeException("String_Node_Str" + devnode_gpscontrol);
  }
  gpsis=new CharDeviceInputStream(gps);
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
  long delay=getReadDelay();
  log.log(LogService.LOG_DEBUG,"String_Node_Str" + delay);
  gpsd=new NMEARawFeed(gpsis,delay);
  nmeaProvider=new NMEASentenceProvider(gpsd.getInputStream(),context);
  gpscontrol=new GPSControl();
  CharDeviceUtils.openDeviceWithRetry(gpscontrol,devnode_gpscontrol,2);
  log.log(LogService.LOG_DEBUG,"String_Node_Str");
}
Program: 180264
Project: 180264
Buggy source:
public NMEASentenceProvider(InputStream nmeaStream,LogService log){
  this.nmeaStream=nmeaStream;
  this.log=log;
}

Fixed version (ground truth):
public NMEASentenceProvider(InputStream nmeaStream,BundleContext context){
  this.nmeaStream=nmeaStream;
  this.context=context;
  this.log=LogServiceUtil.getLogService(context);
}
Program: 180265
Project: 180265
Buggy source:
public RMC getRMC(){
  return cachedRMC;
}

Fixed version (ground truth):
public com.buglabs.nmea.sentences.RMC getRMC(){
  return new com.buglabs.nmea.sentences.RMC(cachedRMC);
}
Program: 180266
Project: 180266
Buggy source:
public void run(){
  BufferedReader br=null;
  try {
    br=new BufferedReader(new InputStreamReader(nmeaStream));
    String sentence;
    NMEAParser parser=new NMEAParser();
    do {
      try {
        sentence=br.readLine();
      }
 catch (      CharConversionException e) {
        sentence="String_Node_Str";
        continue;
      }
      try {
        log.log(LogService.LOG_DEBUG,"String_Node_Str" + sentence);
        Object objSentence=parser.parse(sentence);
        if (objSentence != null && objSentence instanceof RMC) {
          cachedRMC=(RMC)objSentence;
        }
      }
 catch (      NMEAParserException e) {
        log.log(LogService.LOG_ERROR,"String_Node_Str",e);
      }
    }
 while (!Thread.currentThread().isInterrupted() && (sentence != null));
  }
 catch (  IOException e) {
    log.log(LogService.LOG_ERROR,"String_Node_Str",e);
  }
 finally {
    try {
      if (br != null) {
        br.close();
      }
 else {
        if (nmeaStream != null) {
          nmeaStream.close();
        }
      }
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
public void run(){
  BufferedReader br=null;
  try {
    br=new BufferedReader(new InputStreamReader(nmeaStream));
    String sentence;
    do {
      try {
        sentence=br.readLine();
      }
 catch (      CharConversionException e) {
        sentence="String_Node_Str";
        continue;
      }
      try {
        log.log(LogService.LOG_DEBUG,"String_Node_Str" + sentence);
        AbstractNMEASentence objSentence=NMEASentenceFactory.getSentence(sentence);
        if (objSentence != null && objSentence instanceof RMC) {
          cachedRMC=(RMC)objSentence;
          index++;
        }
        if (objSentence == null) {
          log.log(LogService.LOG_DEBUG,"String_Node_Str" + sentence);
        }
 else {
          notifySubscribers(objSentence);
        }
      }
 catch (      NMEAParserException e) {
        log.log(LogService.LOG_ERROR,"String_Node_Str",e);
      }
    }
 while (!Thread.currentThread().isInterrupted() && (sentence != null));
  }
 catch (  IOException e) {
    log.log(LogService.LOG_ERROR,"String_Node_Str",e);
  }
 finally {
    try {
      if (br != null) {
        br.close();
      }
 else {
        if (nmeaStream != null) {
          nmeaStream.close();
        }
      }
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
}
Program: 180267
Project: 180267
Buggy source:
/** 
 * Provides the latest RMC sentence read from the GPS Device, or null if no information is available.
 * @return RMC sentence object
 */
public RMC getRMC();

Fixed version (ground truth):
/** 
 * Provides the latest RMC sentence read from the GPS Device, or null if no information is available.
 * @deprecated
 * @return RMC sentence object
 */
public RMC getRMC();
Program: 180268
Project: 180268
Buggy source:
protected void validate(){
  if (msg == null || code == null) {
    throw new NMEAParserException("String_Node_Str",null);
  }
}

Fixed version (ground truth):
protected void validate(){
  if (msg == null) {
    throw new NMEAParserException("String_Node_Str");
  }
}
Program: 180269
Project: 180269
Buggy source:
public GPSModlet(BundleContext context,int slotId,String moduleId,String moduleName){
  this.context=context;
  this.slotId=slotId;
  this.moduleName=moduleName;
  this.moduleId=moduleId;
  this.log=LogServiceUtil.getLogService(context);
}

Fixed version (ground truth):
/** 
 * @param context
 * @param slotId
 * @param moduleId
 * @param moduleName
 */
public GPSModlet(BundleContext context,int slotId,String moduleId,String moduleName){
  this.context=context;
  this.slotId=slotId;
  this.moduleName=moduleName;
  this.moduleId=moduleId;
  this.log=LogServiceUtil.getLogService(context);
}
Program: 180270
Project: 180270
Buggy source:
public Position getPosition(){
  RMC rmc=nmeaProvider.getRMC();
  if (rmc != null) {
    try {
      Position pos=new Position(new Measurement(rmc.getLatitudeAsDMS().toDecimalDegrees() * Math.PI / 180.0,Unit.rad),new Measurement(rmc.getLongitudeAsDMS().toDecimalDegrees() * Math.PI / 180.0,Unit.rad),new Measurement(0.0d,Unit.m),null,null);
      return pos;
    }
 catch (    NumberFormatException e) {
      log.log(LogService.LOG_ERROR,"String_Node_Str",e);
      return null;
    }
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public Position getPosition(){
  RMC rmc=nmeaProvider.getRMC();
  if (rmc != null && !rmc.isEmpty()) {
    try {
      Position pos=new Position(new Measurement(rmc.getLatitudeAsDMS().toDecimalDegrees() * Math.PI / 180.0,Unit.rad),new Measurement(rmc.getLongitudeAsDMS().toDecimalDegrees() * Math.PI / 180.0,Unit.rad),new Measurement(0.0d,Unit.m),null,null);
      return pos;
    }
 catch (    NumberFormatException e) {
      log.log(LogService.LOG_ERROR,"String_Node_Str",e);
      return null;
    }
  }
 else {
    return null;
  }
}
Program: 180271
Project: 180271
Buggy source:
public InputStream getInputStream() throws IOException ;

Fixed version (ground truth):
/** 
 * @return NMEA data as a stream
 * @throws IOException
 */
public InputStream getInputStream() throws IOException ;
Program: 180272
Project: 180272
Buggy source:
/** 
 * @return current position as Position object.
 */
public Position getPosition();

Fixed version (ground truth):
/** 
 * @return current position as Position object or null if unable to determine position.
 */
public Position getPosition();