nus-yam/ex-repair huggingface dataset:
Program: 40811
Project: 40811
Buggy source:
/** 
 * wait for tunnel to be up
 * @param waitForMessage
 * @throws IOException
 * @throws InterruptedException
 */
private void waitforTunnelTobeUp(String waitForMessage) throws IOException, InterruptedException {
  is=tunnelProcess.getInputStream();
  br=new BufferedReader(new InputStreamReader(is));
  String t="String_Node_Str";
  while (!t.equalsIgnoreCase(waitForMessage) && t != null)   try {
    t=br.readLine();
    LOGGER.info("String_Node_Str" + t);
  }
 catch (  IOException e) {
    LOGGER.error(e);
  }
}

Fixed version (ground truth):
/** 
 * wait for tunnel to be up
 * @param waitForMessage
 * @throws IOException
 * @throws InterruptedException
 */
private void waitforTunnelTobeUp(String waitForMessage) throws IOException, InterruptedException {
  is=tunnelProcess.getInputStream();
  br=new BufferedReader(new InputStreamReader(is));
  String t="String_Node_Str";
  while (!waitForMessage.equalsIgnoreCase(t) && t != null)   try {
    t=br.readLine();
    LOGGER.info("String_Node_Str" + t);
  }
 catch (  IOException e) {
    LOGGER.error(e);
  }
}
Program: 40812
Project: 40812
Buggy source:
/** 
 * Set ups the tunnel for the Keys
 * @param browserStackKey
 * @param browserStackURLS
 */
public void createTunnel(String browserStackKey,List<String> browserStackURLS){
  if (!activeTunnels.contains(browserStackKey)) {
synchronized (browserStackTunnel) {
      if (!activeTunnels.contains(browserStackKey)) {
        LOGGER.info("String_Node_Str" + browserStackKey);
        pb=new ProcessBuilder();
        pb.command(getSetUpCommand(browserStackKey,browserStackURLS));
        try {
          tunnelProcess=pb.start();
          waitforTunnelTobeUp("String_Node_Str");
          activeTunnels.add(browserStackKey);
        }
 catch (        IOException e) {
          LOGGER.error(e);
        }
catch (        InterruptedException e) {
          LOGGER.error(e);
        }
      }
 else {
        LOGGER.info("String_Node_Str" + browserStackKey);
      }
    }
  }
 else {
    LOGGER.info("String_Node_Str" + browserStackKey);
  }
}

Fixed version (ground truth):
/** 
 * Set ups the tunnel for the Keys
 * @param browserStackKey
 * @param browserStackURLS
 */
public void createTunnel(String browserStackKey,List<String> browserStackURLS){
  this.browserStackKey=browserStackKey;
  this.browserStackURLS=browserStackURLS;
  if (!activeTunnels.contains(browserStackKey)) {
synchronized (browserStackTunnel) {
      if (!activeTunnels.contains(browserStackKey)) {
        LOGGER.info("String_Node_Str" + browserStackKey);
        pb=new ProcessBuilder();
        pb.command(getSetUpCommand(browserStackKey,browserStackURLS));
        try {
          tunnelProcess=pb.start();
          waitforTunnelTobeUp("String_Node_Str");
          activeTunnels.add(browserStackKey);
        }
 catch (        IOException e) {
          LOGGER.error(e);
        }
catch (        InterruptedException e) {
          LOGGER.error(e);
        }
      }
 else {
        LOGGER.info("String_Node_Str" + browserStackKey);
      }
    }
  }
 else {
    LOGGER.info("String_Node_Str" + browserStackKey);
  }
}
Program: 40813
Project: 40813
Buggy source:
private String defaultBrowserVersion(){
  if ("String_Node_Str".equals(browserConfMapValues.get(BrowserConstant.remoteFlag)) && "String_Node_Str".equals(browserConfMapValues.get(BrowserConstant.bsSwitch))) {
    throw new FrameworkException("String_Node_Str");
  }
  return browserVersion;
}

Fixed version (ground truth):
private String defaultBrowserVersion(){
  if ("String_Node_Str".equals(browserConfMapValues.get(BrowserConstant.remoteFlag)) && "String_Node_Str".equals(browserConfMapValues.get(BrowserConstant.bsSwitch)) && "String_Node_Str".equals(browserConfMapValues.get(BrowserConstant.mobileTest))) {
    throw new FrameworkException("String_Node_Str");
  }
  return browserVersion;
}
Program: 40814
Project: 40814
Buggy source:
public Zhihu(String url){
  question="String_Node_Str";
  questionDescription="String_Node_Str";
  zhihuUrl="String_Node_Str";
  answers=new ArrayList<String>();
  if (getRealUrl(url)) {
    String content=Spider.SendGet(zhihuUrl);
    if (content != null) {
      Document doc=Jsoup.parse(content);
      question=doc.title();
      Element despElement=doc.getElementById("String_Node_Str");
      if (despElement != null) {
        questionDescription=despElement.text();
      }
      Elements ansItems=doc.getElementsByClass("String_Node_Str");
      for (      Element ansItem : ansItems) {
        if (ansItem.hasClass("String_Node_Str")) {
          Element textElement=ansItem.getElementsByClass("String_Node_Str").first();
          if (despElement != null) {
            answers.add(textElement.text());
          }
        }
      }
    }
 else {
      System.out.println("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public Zhihu(String url){
  question="String_Node_Str";
  questionDescription="String_Node_Str";
  zhihuUrl="String_Node_Str";
  answers=new ArrayList<String>();
  if (getRealUrl(url)) {
    String content=Spider.SendGet(zhihuUrl);
    if (content != null) {
      Document doc=Jsoup.parse(content);
      question=doc.title();
      Element despElement=doc.getElementById("String_Node_Str");
      if (despElement != null) {
        questionDescription=despElement.text();
      }
      Elements ansItems=doc.getElementsByClass("String_Node_Str");
      for (      Element ansItem : ansItems) {
        Element textElement=ansItem.getElementsByClass("String_Node_Str").first();
        if (despElement != null) {
          answers.add(textElement.text());
        }
      }
    }
 else {
      System.out.println("String_Node_Str");
    }
  }
}
Program: 40815
Project: 40815
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  if (mBlaubotKingdom != null) {
    IBlaubotChannel chan=mBlaubotKingdom.getChannelManager().createOrGetChannel(channelId);
    chan.unsubscribe();
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  if (mBlaubotChannelManager != null) {
    IBlaubotChannel chan=mBlaubotChannelManager.createOrGetChannel(channelId);
    chan.unsubscribe();
  }
}
Program: 40816
Project: 40816
Buggy source:
@Override public void unregisterBlaubotInstance(){
  if (this.mBlaubot != null) {
    this.mBlaubot.getChannelManager().removeAdminMessageListener(mChannelSubscriptionListener);
    this.mBlaubot.removeLifecycleListener(mChannelSubscriptionListener);
  }
  this.mBlaubot=null;
}

Fixed version (ground truth):
@Override public void unregisterBlaubotInstance(){
  if (this.mBlaubot != null) {
    this.mBlaubot.getChannelManager().removeAdminMessageListener(mChannelSubscriptionListener);
    this.mBlaubot.removeLifecycleListener(mChannelSubscriptionListener);
  }
  this.mBlaubot=null;
  this.mBlaubotChannelManager=null;
}
Program: 40817
Project: 40817
Buggy source:
@Override public void unregisterBlaubotKingdomInstance(){
  if (this.mBlaubotKingdom != null) {
    mBlaubotKingdom.getChannelManager().removeAdminMessageListener(mChannelSubscriptionListener);
    mBlaubotKingdom.removeLifecycleListener(mChannelSubscriptionListener);
  }
  this.mBlaubotKingdom=null;
}

Fixed version (ground truth):
@Override public void unregisterBlaubotKingdomInstance(){
  if (this.mBlaubotKingdom != null) {
    mBlaubotKingdom.getChannelManager().removeAdminMessageListener(mChannelSubscriptionListener);
    mBlaubotKingdom.removeLifecycleListener(mChannelSubscriptionListener);
  }
  this.mBlaubotKingdom=null;
  this.mBlaubotChannelManager=null;
}
Program: 40818
Project: 40818
Buggy source:
@Override public void registerBlaubotKingdomInstance(BlaubotKingdom blaubotKingdom){
  if (this.mBlaubotKingdom != null) {
    unregisterBlaubotKingdomInstance();
  }
  this.mBlaubotKingdom=blaubotKingdom;
  blaubotKingdom.getChannelManager().addAdminMessageListener(mChannelSubscriptionListener);
  blaubotKingdom.addLifecycleListener(mChannelSubscriptionListener);
}

Fixed version (ground truth):
@Override public void registerBlaubotKingdomInstance(BlaubotKingdom blaubotKingdom){
  if (this.mBlaubotKingdom != null) {
    unregisterBlaubotKingdomInstance();
  }
  this.mBlaubotKingdom=blaubotKingdom;
  this.mBlaubotChannelManager=blaubotKingdom.getChannelManager();
  blaubotKingdom.getChannelManager().addAdminMessageListener(mChannelSubscriptionListener);
  blaubotKingdom.addLifecycleListener(mChannelSubscriptionListener);
}
Program: 40819
Project: 40819
Buggy source:
@Override public void registerBlaubotInstance(Blaubot blaubot){
  if (this.mBlaubot != null) {
    unregisterBlaubotInstance();
  }
  this.mBlaubot=blaubot;
  blaubot.getChannelManager().addAdminMessageListener(mChannelSubscriptionListener);
  blaubot.addLifecycleListener(mChannelSubscriptionListener);
}

Fixed version (ground truth):
@Override public void registerBlaubotInstance(Blaubot blaubot){
  if (this.mBlaubot != null) {
    unregisterBlaubotInstance();
  }
  this.mBlaubot=blaubot;
  this.mBlaubotChannelManager=blaubot.getChannelManager();
  this.mBlaubotChannelManager.addAdminMessageListener(mChannelSubscriptionListener);
  blaubot.addLifecycleListener(mChannelSubscriptionListener);
}
Program: 40822
Project: 40822
Buggy source:
public RotationData(long timestamp,float x,float y,float z,float cos,float headingAccuracy){
  super(timestamp);
  this.x=x;
  this.y=y;
  this.z=z;
  this.cos=cos;
  this.headingAccuracy=headingAccuracy;
}

Fixed version (ground truth):
public RotationData(long timestamp,float x,float y,float z){
  this(timestamp,x,y,z,0,0);
}
Program: 40823
Project: 40823
Buggy source:
@Override protected AbstractData buildData(SensorEvent event){
  return new RotationData(System.currentTimeMillis(),event.values[0],event.values[1],event.values[2],event.values[3],event.values[4]);
}

Fixed version (ground truth):
@Override protected AbstractData buildData(SensorEvent event){
  if (event.values.length >= 6) {
    return new RotationData(System.currentTimeMillis(),event.values[0],event.values[1],event.values[2],event.values[3],event.values[4]);
  }
 else {
    return new RotationData(System.currentTimeMillis(),event.values[0],event.values[1],event.values[2]);
  }
}
Program: 40826
Project: 40826
Buggy source:
/** 
 * @param squitter extended squitter which contains this TCAS resolution advisory msg
 * @throws BadFormatException if message has wrong format
 */
public TCASResolutionAdvisoryMsg(ExtendedSquitter squitter) throws BadFormatException {
  super(squitter);
  setType(subtype.ADSB_TCAS);
  if (this.getFormatTypeCode() != 28)   throw new BadFormatException("String_Node_Str");
  byte[] msg=this.getMessage();
  msg_subtype=(byte)(msg[0] & 0x7);
  if (msg_subtype != 2)   throw new BadFormatException("String_Node_Str");
  active_ra=(short)(((msg[2] >>> 2) | (msg[1] << 6)) & 0x3FFF);
  racs_record=(byte)((((msg[2] & 0x3) << 2) | (msg[3] >>> 6)) & 0xF);
  ra_terminated=(msg[3] & 0x20) > 0;
  multi_threat_encounter=(msg[3] & 0x10) > 0;
  threat_type=(byte)((msg[3] >>> 2) & 0x3);
  threat_identity=(msg[6] | (msg[5] << 8) | (msg[4] << 16)| ((msg[4] & 0x3) << 24)) & 0x3FFFFFF;
}

Fixed version (ground truth):
/** 
 * @param squitter extended squitter which contains this TCAS resolution advisory msg
 * @throws BadFormatException if message has wrong format
 */
public TCASResolutionAdvisoryMsg(ExtendedSquitter squitter) throws BadFormatException {
  super(squitter);
  setType(subtype.ADSB_TCAS);
  if (this.getFormatTypeCode() != 28)   throw new BadFormatException("String_Node_Str");
  byte[] msg=this.getMessage();
  msg_subtype=(byte)(msg[0] & 0x7);
  if (msg_subtype != 2)   throw new BadFormatException("String_Node_Str");
  active_ra=(short)(((msg[2] >>> 2) & 0x3f | (msg[1] << 6)) & 0x3FFF);
  racs_record=(byte)((((msg[2] & 0x3) << 2) | (msg[3] >>> 6) & 0x3) & 0xF);
  ra_terminated=(msg[3] & 0x20) > 0;
  multi_threat_encounter=(msg[3] & 0x10) > 0;
  threat_type=(byte)((msg[3] >>> 2) & 0x3);
  threat_identity=(msg[6] | (msg[5] << 8) | (msg[4] << 16)| ((msg[4] & 0x3) << 24)) & 0x3FFFFFF;
}
Program: 40828
Project: 40828
Buggy source:
/** 
 * @param reply Mode S reply which contains this comm-b identify reply
 * @throws BadFormatException if message is not comm-b identify reply or contains wrong values.
 */
public CommBIdentifyReply(ModeSReply reply) throws BadFormatException {
  super(reply);
  setType(subtype.COMM_B_IDENTIFY_REPLY);
  if (getDownlinkFormat() != 21) {
    throw new BadFormatException("String_Node_Str");
  }
  byte[] payload=getPayload();
  flight_status=getFirstField();
  downlink_request=(byte)((payload[0] >>> 3) & 0x1F);
  utility_msg=(byte)((payload[0] & 0x7) << 3 | (payload[1] >>> 5) & 0x7);
  identity=(short)((payload[1] << 8 | payload[2]) & 0x1FFF);
  message=new byte[7];
  for (int i=0; i < 7; i++)   message[i]=payload[i + 3];
}

Fixed version (ground truth):
/** 
 * @param reply Mode S reply which contains this comm-b identify reply
 * @throws BadFormatException if message is not comm-b identify reply or contains wrong values.
 */
public CommBIdentifyReply(ModeSReply reply) throws BadFormatException {
  super(reply);
  setType(subtype.COMM_B_IDENTIFY_REPLY);
  if (getDownlinkFormat() != 21) {
    throw new BadFormatException("String_Node_Str");
  }
  byte[] payload=getPayload();
  flight_status=getFirstField();
  downlink_request=(byte)((payload[0] >>> 3) & 0x1F);
  utility_msg=(byte)((payload[0] & 0x7) << 3 | (payload[1] >>> 5) & 0x7);
  identity=(short)((payload[1] << 8 | (payload[2] & 0xFF)) & 0x1FFF);
  message=new byte[7];
  for (int i=0; i < 7; i++)   message[i]=payload[i + 3];
}
Program: 40829
Project: 40829
Buggy source:
/** 
 * @param reply Mode S reply which contains this identify reply
 * @throws BadFormatException if message is not identify reply or contains wrong values.
 */
public IdentifyReply(ModeSReply reply) throws BadFormatException {
  super(reply);
  setType(subtype.IDENTIFY_REPLY);
  if (getDownlinkFormat() != 5) {
    throw new BadFormatException("String_Node_Str");
  }
  byte[] payload=getPayload();
  flight_status=getFirstField();
  downlink_request=(byte)((payload[0] >>> 3) & 0x1F);
  utility_msg=(byte)((payload[0] & 0x7) << 3 | (payload[1] >>> 5) & 0x7);
  identity=(short)((payload[1] << 8 | payload[2]) & 0x1FFF);
}

Fixed version (ground truth):
/** 
 * @param reply Mode S reply which contains this identify reply
 * @throws BadFormatException if message is not identify reply or contains wrong values.
 */
public IdentifyReply(ModeSReply reply) throws BadFormatException {
  super(reply);
  setType(subtype.IDENTIFY_REPLY);
  if (getDownlinkFormat() != 5) {
    throw new BadFormatException("String_Node_Str");
  }
  byte[] payload=getPayload();
  flight_status=getFirstField();
  downlink_request=(byte)((payload[0] >>> 3) & 0x1F);
  utility_msg=(byte)((payload[0] & 0x7) << 3 | (payload[1] >>> 5) & 0x7);
  identity=(short)((payload[1] << 8 | (payload[2] & 0xFF)) & 0x1FFF);
}
Program: 40830
Project: 40830
Buggy source:
/** 
 * @param squitter extended squitter containing the airspeed and heading msg
 * @throws BadFormatException if message has wrong format
 */
public AirspeedHeadingMsg(ExtendedSquitter squitter) throws BadFormatException {
  super(squitter);
  setType(subtype.ADSB_AIRSPEED);
  if (this.getFormatTypeCode() != 19) {
    throw new BadFormatException("String_Node_Str");
  }
  byte[] msg=this.getMessage();
  msg_subtype=(byte)(msg[0] & 0x7);
  if (msg_subtype != 3 && msg_subtype != 4) {
    throw new BadFormatException("String_Node_Str");
  }
  intent_change=(msg[1] & 0x80) > 0;
  ifr_capability=(msg[1] & 0x40) > 0;
  navigation_accuracy_category=(byte)((msg[1] >>> 3) & 0x7);
  vertical_rate_info_available=true;
  geo_minus_baro_available=true;
  heading_available=(msg[1] & 0x4) > 0;
  heading=((msg[1] & 0x3) << 8 | msg[2] & 0xFF) * 360 / 1024;
  true_airspeed=(msg[3] & 0x80) > 0;
  airspeed=(short)(((msg[3] & 0x7F) << 3 | msg[4] >>> 5 & 0x07) - 1);
  if (airspeed == -1)   airspeed_available=false;
  if (msg_subtype == 2)   airspeed<<=2;
  vertical_source=(msg[4] & 0x10) > 0;
  vertical_rate_down=(msg[4] & 0x08) > 0;
  vertical_rate=(short)((((msg[4] & 0x07) << 6 | msg[5] >>> 2 & 0x3F) - 1) << 6);
  if (vertical_rate == -1)   vertical_rate_info_available=false;
  geo_minus_baro=(short)(((msg[6] & 0x7F) - 1) * 25);
  if (geo_minus_baro == -1)   geo_minus_baro_available=false;
  if ((msg[6] & 0x80) > 0)   geo_minus_baro*=-1;
}

Fixed version (ground truth):
/** 
 * @param squitter extended squitter containing the airspeed and heading msg
 * @throws BadFormatException if message has wrong format
 */
public AirspeedHeadingMsg(ExtendedSquitter squitter) throws BadFormatException {
  super(squitter);
  setType(subtype.ADSB_AIRSPEED);
  if (this.getFormatTypeCode() != 19) {
    throw new BadFormatException("String_Node_Str");
  }
  byte[] msg=this.getMessage();
  msg_subtype=(byte)(msg[0] & 0x7);
  if (msg_subtype != 3 && msg_subtype != 4) {
    throw new BadFormatException("String_Node_Str");
  }
  intent_change=(msg[1] & 0x80) > 0;
  ifr_capability=(msg[1] & 0x40) > 0;
  navigation_accuracy_category=(byte)((msg[1] >>> 3) & 0x7);
  vertical_rate_info_available=true;
  geo_minus_baro_available=true;
  heading_available=(msg[1] & 0x4) > 0;
  heading=((msg[1] & 0x3) << 8 | msg[2] & 0xFF) * 360 / 1024;
  true_airspeed=(msg[3] & 0x80) > 0;
  airspeed=(short)(((msg[3] & 0x7F) << 3 | msg[4] >>> 5 & 0x07) - 1);
  if (airspeed == -1)   airspeed_available=false;
  if (msg_subtype == 4)   airspeed<<=2;
  vertical_source=(msg[4] & 0x10) > 0;
  vertical_rate_down=(msg[4] & 0x08) > 0;
  vertical_rate=(short)((((msg[4] & 0x07) << 6 | msg[5] >>> 2 & 0x3F) - 1) << 6);
  if (vertical_rate == -1)   vertical_rate_info_available=false;
  geo_minus_baro=(short)(((msg[6] & 0x7F) - 1) * 25);
  if (geo_minus_baro == -1)   geo_minus_baro_available=false;
  if ((msg[6] & 0x80) > 0)   geo_minus_baro*=-1;
}
Program: 40831
Project: 40831
Buggy source:
/** 
 * @param squitter extended squitter which contains this message
 * @throws BadFormatException  if message has the wrong typecode
 * @throws UnspecifiedFormatError if message has the wrong subtype
 */
public OperationalStatusMsg(ExtendedSquitter squitter) throws BadFormatException, UnspecifiedFormatError {
  super(squitter);
  setType(subtype.ADSB_STATUS);
  if (getFormatTypeCode() != 31) {
    throw new BadFormatException("String_Node_Str");
  }
  byte[] msg=this.getMessage();
  byte subtype_code=(byte)(msg[0] & 0x7);
  if (subtype_code > 1)   throw new UnspecifiedFormatError("String_Node_Str" + subtype_code + "String_Node_Str");
  if (subtype_code == 0) {
    capability_class_code=(msg[1] << 8) | msg[2];
  }
 else {
    capability_class_code=(msg[1] << 4) | (msg[2] & 0xF0);
    airplane_len_width=(byte)(msg[2] & 0xF);
  }
  operational_mode_code=(msg[3] << 8) | msg[4];
  version=(byte)(msg[5] >>> 5);
  nic_suppl=((msg[5] & 0x10) != 0);
  nac_pos=(byte)(msg[5] & 0xF);
  geometric_vertical_accuracy=(byte)(msg[6] >>> 6);
  sil=(byte)((msg[6] >>> 4) & 0x3);
  nic_trk_hdg=((msg[6] & 0x8) != 0);
  hrd=((msg[6] & 0x4) != 0);
}

Fixed version (ground truth):
/** 
 * @param squitter extended squitter which contains this message
 * @throws BadFormatException  if message has the wrong typecode
 * @throws UnspecifiedFormatError if message has the wrong subtype
 */
public OperationalStatusMsg(ExtendedSquitter squitter) throws BadFormatException, UnspecifiedFormatError {
  super(squitter);
  setType(subtype.ADSB_STATUS);
  if (getFormatTypeCode() != 31) {
    throw new BadFormatException("String_Node_Str");
  }
  byte[] msg=this.getMessage();
  byte subtype_code=(byte)(msg[0] & 0x7);
  if (subtype_code > 1)   throw new UnspecifiedFormatError("String_Node_Str" + subtype_code + "String_Node_Str");
  if (subtype_code == 0) {
    capability_class_code=(msg[1] << 8) | msg[2];
  }
 else {
    capability_class_code=(msg[1] << 4) | (msg[2] & 0xF0) >>> 4;
    airplane_len_width=(byte)(msg[2] & 0xF);
  }
  operational_mode_code=(msg[3] << 8) | msg[4];
  version=(byte)(msg[5] >>> 5);
  nic_suppl=((msg[5] & 0x10) != 0);
  nac_pos=(byte)(msg[5] & 0xF);
  geometric_vertical_accuracy=(byte)(msg[6] >>> 6);
  sil=(byte)((msg[6] >>> 4) & 0x3);
  nic_trk_hdg=((msg[6] & 0x8) != 0);
  hrd=((msg[6] & 0x4) != 0);
}
Program: 40832
Project: 40832
Buggy source:
/** 
 * @return horizontal containment radius limit in meters. A return value of -1 means "unkown".Set NIC supplement A from Operational Status Message for better precision. Otherwise, we'll be pessimistic. Note: For ADS-B versions &lt; 2, this is inaccurate for NIC class 6, since there was no NIC supplement B in earlier versions.
 */
public double getHorizontalContainmentRadiusLimit(){
switch (getFormatTypeCode()) {
case 0:
case 18:
case 22:
    return -1;
case 9:
case 20:
  return 7.5;
case 10:
case 21:
return 25;
case 11:
if (nic_suppl_a) return 75;
 else return 185.2;
case 12:
return 370.4;
case 13:
if (!nic_suppl_b) return 926;
 else if (nic_suppl_a) return 1111.2;
 else return 555.6;
case 14:
return 1852;
case 15:
return 3704;
case 16:
if (nic_suppl_a) return 7408;
 else return 14816;
case 17:
return 37040;
default :
return 0;
}
}

Fixed version (ground truth):
/** 
 * @return horizontal containment radius limit in meters. A return value of -1 means "unkown".Set NIC supplement A from Operational Status Message for better precision. Otherwise, we'll be pessimistic. Note: For ADS-B versions &lt; 2, this is inaccurate for NIC class 6, since there was no NIC supplement B in earlier versions.
 */
public double getHorizontalContainmentRadiusLimit(){
switch (getFormatTypeCode()) {
case 0:
case 18:
case 22:
    return -1;
case 9:
case 20:
  return 7.5;
case 10:
case 21:
return 25;
case 11:
return nic_suppl_b ? 75 : 185.2;
case 12:
return 370.4;
case 13:
if (!nic_suppl_b) return 926;
 else return nic_suppl_a ? 1111.2 : 555.6;
case 14:
return 1852;
case 15:
return 3704;
case 16:
return nic_suppl_b ? 7408 : 14816;
case 17:
return 37040;
default :
return -1;
}
}
Program: 40833
Project: 40833
Buggy source:
/** 
 * @return Navigation integrity category. A NIC of 0 means "unkown".If NIC supplement is set before, the return value is exactly according to DO-260B. Otherwise it might be a little worse than it actually is.
 */
public byte getNavigationIntegrityCategory(){
switch (getFormatTypeCode()) {
case 0:
case 18:
case 22:
    return 0;
case 9:
case 20:
  return 11;
case 10:
case 21:
return 10;
case 11:
if (nic_suppl_a) return 9;
 else return 8;
case 12:
return 7;
case 13:
return 6;
case 14:
return 5;
case 15:
return 4;
case 16:
if (nic_suppl_a) return 3;
 else return 2;
case 17:
return 1;
default :
return 0;
}
}

Fixed version (ground truth):
/** 
 * @return Navigation integrity category. A NIC of 0 means "unkown".If NIC supplement is set before, the return value is exactly according to DO-260B. Otherwise it might be a little worse than it actually is.
 */
public byte getNavigationIntegrityCategory(){
switch (getFormatTypeCode()) {
case 0:
case 18:
case 22:
    return 0;
case 9:
case 20:
  return 11;
case 10:
case 21:
return 10;
case 11:
return (byte)(nic_suppl_b ? 9 : 8);
case 12:
return 7;
case 13:
return 6;
case 14:
return 5;
case 15:
return 4;
case 16:
return (byte)(nic_suppl_b ? 3 : 2);
case 17:
return 1;
default :
return 0;
}
}
Program: 40835
Project: 40835
Buggy source:
public static void main(String[] args) throws Exception {
  Scanner sc=new Scanner(System.in,"String_Node_Str");
  ExampleDecoder dec=new ExampleDecoder();
  while (sc.hasNext()) {
    String[] values=sc.nextLine().split("String_Node_Str");
    dec.decodeMsg(Double.parseDouble(values[0]),values[1]);
  }
  sc.close();
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  String icao=null;
  if (args.length > 0) {
    icao=args[0];
    System.err.println("String_Node_Str" + icao + "String_Node_Str");
  }
  Scanner sc=new Scanner(System.in,"String_Node_Str");
  ExampleDecoder dec=new ExampleDecoder();
  while (sc.hasNext()) {
    String[] values=sc.nextLine().split("String_Node_Str");
    dec.decodeMsg(Double.parseDouble(values[0]),values[1],icao);
  }
  sc.close();
}
Program: 40837
Project: 40837
Buggy source:
/** 
 * @return the decoded altitude in meters
 */
public double getAltitude(){
  boolean Mbit=(altitude_code & 0x40) != 0;
  boolean Qbit=(altitude_code & 0x10) != 0;
  int N;
  if (!Mbit && Qbit) {
    N=(altitude_code & 0x0F) | ((altitude_code & 0x20) >>> 1) | ((altitude_code & 0x1F80) >>> 2);
    return (25 * N - 1000) * 0.3048;
  }
 else {
    int C1=(0x1000 & altitude_code) >>> 12;
    int A1=(0x0800 & altitude_code) >>> 11;
    int C2=(0x0400 & altitude_code) >>> 10;
    int A2=(0x0200 & altitude_code) >>> 9;
    int C4=(0x0100 & altitude_code) >>> 8;
    int A4=(0x0080 & altitude_code) >>> 7;
    int B1=(0x0020 & altitude_code) >>> 5;
    int B2=(0x0008 & altitude_code) >>> 3;
    int D2=(0x0004 & altitude_code) >>> 2;
    int B4=(0x0002 & altitude_code) >>> 1;
    int D4=(0x0001 & altitude_code);
    int N500=grayToBin(D2 << 7 | D4 << 6 | A1 << 5 | A2 << 4 | A4 << 3 | B1 << 2 | B2 << 1 | B4,8);
    int N100=grayToBin(C1 << 2 | C2 << 1 | C4,3) - 1;
    if (N100 == 6)     N100=4;
    if (N500 % 2 != 0)     N100=4 - N100;
    return (-1200 + N500 * 500 + N100 * 100) * 0.3048;
  }
}

Fixed version (ground truth):
/** 
 * @return the decoded altitude in meters
 */
public Double getAltitude(){
  if (altitude_code == 0)   return null;
  boolean Mbit=(altitude_code & 0x40) != 0;
  if (!Mbit) {
    boolean Qbit=(altitude_code & 0x10) != 0;
    if (Qbit) {
      int N=(altitude_code & 0x0F) | ((altitude_code & 0x20) >>> 1) | ((altitude_code & 0x1F80) >>> 2);
      return (25 * N - 1000) * 0.3048;
    }
 else {
      int C1=(0x1000 & altitude_code) >>> 12;
      int A1=(0x0800 & altitude_code) >>> 11;
      int C2=(0x0400 & altitude_code) >>> 10;
      int A2=(0x0200 & altitude_code) >>> 9;
      int C4=(0x0100 & altitude_code) >>> 8;
      int A4=(0x0080 & altitude_code) >>> 7;
      int B1=(0x0020 & altitude_code) >>> 5;
      int B2=(0x0008 & altitude_code) >>> 3;
      int D2=(0x0004 & altitude_code) >>> 2;
      int B4=(0x0002 & altitude_code) >>> 1;
      int D4=(0x0001 & altitude_code);
      int N500=grayToBin(D2 << 7 | D4 << 6 | A1 << 5 | A2 << 4 | A4 << 3 | B1 << 2 | B2 << 1 | B4,8);
      int N100=grayToBin(C1 << 2 | C2 << 1 | C4,3) - 1;
      if (N100 == 6)       N100=4;
      if (N500 % 2 != 0)       N100=4 - N100;
      return (-1200 + N500 * 500 + N100 * 100) * 0.3048;
    }
  }
 else   return null;
}
Program: 40838
Project: 40838
Buggy source:
/** 
 * @param reply Mode S reply containing this altitude reply
 * @throws BadFormatException if message is not altitude reply or contains wrong values.
 */
public AltitudeReply(ModeSReply reply) throws BadFormatException {
  super(reply);
  setType(subtype.ALTITUDE_REPLY);
  if (getDownlinkFormat() != 4) {
    throw new BadFormatException("String_Node_Str");
  }
  byte[] payload=getPayload();
  flight_status=getFirstField();
  downlink_request=(byte)((payload[0] >>> 3) & 0x1F);
  utility_msg=(byte)((payload[0] & 0x7) << 3 | (payload[1] >>> 5) & 0x7);
  altitude_code=(short)((payload[1] << 8 | payload[2]) & 0x1FFF);
}

Fixed version (ground truth):
/** 
 * @param reply Mode S reply containing this altitude reply
 * @throws BadFormatException if message is not altitude reply or contains wrong values.
 */
public AltitudeReply(ModeSReply reply) throws BadFormatException {
  super(reply);
  setType(subtype.ALTITUDE_REPLY);
  if (getDownlinkFormat() != 4) {
    throw new BadFormatException("String_Node_Str");
  }
  byte[] payload=getPayload();
  flight_status=getFirstField();
  downlink_request=(byte)((payload[0] >>> 3) & 0x1F);
  utility_msg=(byte)((payload[0] & 0x7) << 3 | (payload[1] >>> 5) & 0x7);
  altitude_code=(short)((payload[1] << 8 | payload[2] & 0xFF) & 0x1FFF);
}
Program: 40839
Project: 40839
Buggy source:
/** 
 * @return the decoded altitude in meters
 */
public double getAltitude(){
  boolean Mbit=(altitude_code & 0x40) != 0;
  boolean Qbit=(altitude_code & 0x10) != 0;
  int N;
  if (!Mbit && Qbit) {
    N=(altitude_code & 0xF) | ((altitude_code & 0x20) >>> 1) | ((altitude_code & 0x1F80) >>> 2);
    return (25 * N - 1000) * 0.3048;
  }
 else {
    int C1=(0x1000 & altitude_code) >>> 12;
    int A1=(0x800 & altitude_code) >>> 11;
    int C2=(0x400 & altitude_code) >>> 10;
    int A2=(0x200 & altitude_code) >>> 9;
    int C4=(0x100 & altitude_code) >>> 8;
    int A4=(0x080 & altitude_code) >>> 7;
    int B1=(0x020 & altitude_code) >>> 5;
    int B2=(0x008 & altitude_code) >>> 3;
    int D2=(0x004 & altitude_code) >>> 2;
    int B4=(0x002 & altitude_code) >>> 1;
    int D4=(0x001 & altitude_code);
    int N500=grayToBin(D2 << 7 | D4 << 6 | A1 << 5 | A2 << 4 | A4 << 3 | B1 << 2 | B2 << 1 | B4,8);
    int N100=grayToBin(C1 << 2 | C2 << 1 | C4,3) - 1;
    if (N100 == 6)     N100=4;
    if (N500 % 2 != 0)     N100=4 - N100;
    return (-1200 + N500 * 500 + N100 * 100) * 0.3048;
  }
}

Fixed version (ground truth):
/** 
 * @return the decoded altitude in meters
 */
public Double getAltitude(){
  if (altitude_code == 0)   return null;
  boolean Mbit=(altitude_code & 0x40) != 0;
  if (!Mbit) {
    boolean Qbit=(altitude_code & 0x10) != 0;
    if (Qbit) {
      int N=(altitude_code & 0x0F) | ((altitude_code & 0x20) >>> 1) | ((altitude_code & 0x1F80) >>> 2);
      return (25 * N - 1000) * 0.3048;
    }
 else {
      int C1=(0x1000 & altitude_code) >>> 12;
      int A1=(0x0800 & altitude_code) >>> 11;
      int C2=(0x0400 & altitude_code) >>> 10;
      int A2=(0x0200 & altitude_code) >>> 9;
      int C4=(0x0100 & altitude_code) >>> 8;
      int A4=(0x0080 & altitude_code) >>> 7;
      int B1=(0x0020 & altitude_code) >>> 5;
      int B2=(0x0008 & altitude_code) >>> 3;
      int D2=(0x0004 & altitude_code) >>> 2;
      int B4=(0x0002 & altitude_code) >>> 1;
      int D4=(0x0001 & altitude_code);
      int N500=grayToBin(D2 << 7 | D4 << 6 | A1 << 5 | A2 << 4 | A4 << 3 | B1 << 2 | B2 << 1 | B4,8);
      int N100=grayToBin(C1 << 2 | C2 << 1 | C4,3) - 1;
      if (N100 == 6)       N100=4;
      if (N500 % 2 != 0)       N100=4 - N100;
      return (-1200 + N500 * 500 + N100 * 100) * 0.3048;
    }
  }
 else   return null;
}
Program: 40840
Project: 40840
Buggy source:
/** 
 * @param reply Mode S reply which contains this comm-b altitude reply
 * @throws BadFormatException if message is not comm-b altitude reply or contains wrong values.
 */
public CommBAltitudeReply(ModeSReply reply) throws BadFormatException {
  super(reply);
  setType(subtype.COMM_B_ALTITUDE_REPLY);
  if (getDownlinkFormat() != 20) {
    throw new BadFormatException("String_Node_Str");
  }
  byte[] payload=getPayload();
  flight_status=getFirstField();
  downlink_request=(byte)((payload[0] >>> 3) & 0x1F);
  utility_msg=(byte)((payload[0] & 0x7) << 3 | (payload[1] >>> 5) & 0x7);
  altitude_code=(short)((payload[1] << 8 | payload[2]) & 0x1FFF);
  message=new byte[7];
  for (int i=0; i < 7; i++)   message[i]=payload[i + 3];
}

Fixed version (ground truth):
/** 
 * @param reply Mode S reply which contains this comm-b altitude reply
 * @throws BadFormatException if message is not comm-b altitude reply or contains wrong values.
 */
public CommBAltitudeReply(ModeSReply reply) throws BadFormatException {
  super(reply);
  setType(subtype.COMM_B_ALTITUDE_REPLY);
  if (getDownlinkFormat() != 20) {
    throw new BadFormatException("String_Node_Str");
  }
  byte[] payload=getPayload();
  flight_status=getFirstField();
  downlink_request=(byte)((payload[0] >>> 3) & 0x1F);
  utility_msg=(byte)((payload[0] & 0x7) << 3 | (payload[1] >>> 5) & 0x7);
  altitude_code=(short)((payload[1] << 8 | payload[2] & 0xFF) & 0x1FFF);
  message=new byte[7];
  for (int i=0; i < 7; i++)   message[i]=payload[i + 3];
}
Program: 40841
Project: 40841
Buggy source:
/** 
 * @return the decoded altitude in meters
 */
public double getAltitude(){
  boolean Mbit=(altitude_code & 0x40) != 0;
  boolean Qbit=(altitude_code & 0x10) != 0;
  int N;
  if (!Mbit && Qbit) {
    N=(altitude_code & 0xF) | ((altitude_code & 0x20) >>> 1) | ((altitude_code & 0x1F80) >>> 2);
    return (25 * N - 1000) * 0.3048;
  }
 else {
    int C1=(0x1000 & altitude_code) >>> 12;
    int A1=(0x800 & altitude_code) >>> 11;
    int C2=(0x400 & altitude_code) >>> 10;
    int A2=(0x200 & altitude_code) >>> 9;
    int C4=(0x100 & altitude_code) >>> 8;
    int A4=(0x080 & altitude_code) >>> 7;
    int B1=(0x020 & altitude_code) >>> 5;
    int B2=(0x008 & altitude_code) >>> 3;
    int D2=(0x004 & altitude_code) >>> 2;
    int B4=(0x002 & altitude_code) >>> 1;
    int D4=(0x001 & altitude_code);
    int N500=grayToBin(D2 << 7 | D4 << 6 | A1 << 5 | A2 << 4 | A4 << 3 | B1 << 2 | B2 << 1 | B4,8);
    int N100=grayToBin(C1 << 2 | C2 << 1 | C4,3) - 1;
    if (N100 == 6)     N100=4;
    if (N500 % 2 != 0)     N100=4 - N100;
    return (-1200 + N500 * 500 + N100 * 100) * 0.3048;
  }
}

Fixed version (ground truth):
/** 
 * @return the decoded altitude in meters
 */
public Double getAltitude(){
  if (altitude_code == 0)   return null;
  boolean Mbit=(altitude_code & 0x40) != 0;
  if (!Mbit) {
    boolean Qbit=(altitude_code & 0x10) != 0;
    if (Qbit) {
      int N=(altitude_code & 0x0F) | ((altitude_code & 0x20) >>> 1) | ((altitude_code & 0x1F80) >>> 2);
      return (25 * N - 1000) * 0.3048;
    }
 else {
      int C1=(0x1000 & altitude_code) >>> 12;
      int A1=(0x0800 & altitude_code) >>> 11;
      int C2=(0x0400 & altitude_code) >>> 10;
      int A2=(0x0200 & altitude_code) >>> 9;
      int C4=(0x0100 & altitude_code) >>> 8;
      int A4=(0x0080 & altitude_code) >>> 7;
      int B1=(0x0020 & altitude_code) >>> 5;
      int B2=(0x0008 & altitude_code) >>> 3;
      int D2=(0x0004 & altitude_code) >>> 2;
      int B4=(0x0002 & altitude_code) >>> 1;
      int D4=(0x0001 & altitude_code);
      int N500=grayToBin(D2 << 7 | D4 << 6 | A1 << 5 | A2 << 4 | A4 << 3 | B1 << 2 | B2 << 1 | B4,8);
      int N100=grayToBin(C1 << 2 | C2 << 1 | C4,3) - 1;
      if (N100 == 6)       N100=4;
      if (N500 % 2 != 0)       N100=4 - N100;
      return (-1200 + N500 * 500 + N100 * 100) * 0.3048;
    }
  }
 else   return null;
}
Program: 40842
Project: 40842
Buggy source:
/** 
 * @param reply Mode S reply containing this long air-to-air ACAS reply
 * @throws BadFormatException if message is not long air-to-air ACAS reply or contains wrong values.
 */
public LongACAS(ModeSReply reply) throws BadFormatException {
  super(reply);
  setType(subtype.LONG_ACAS);
  if (getDownlinkFormat() != 16) {
    throw new BadFormatException("String_Node_Str");
  }
  byte[] payload=getPayload();
  airborne=(getFirstField() & 0x4) == 0;
  sensitivity_level=(byte)((payload[0] >>> 5) & 0x7);
  reply_information=(byte)((payload[0] & 0x7) << 1 | (payload[1] >>> 7) & 0x1);
  altitude_code=(short)((payload[1] << 8 | payload[2]) & 0x1FFF);
  valid_rac=payload[3] != 0x30;
  active_resolution_advisories=(short)((payload[4] << 6 | (payload[5] >>> 2) & 0x3) & 0x3FFF);
  racs_record=(byte)((payload[5] << 2 | (payload[6] >>> 6) & 0x3) & 0xF);
  ra_terminated=(payload[6] >>> 5 & 0x1) == 1;
  multiple_threat_encounter=(payload[6] >>> 4 & 0x1) == 1;
}

Fixed version (ground truth):
/** 
 * @param reply Mode S reply containing this long air-to-air ACAS reply
 * @throws BadFormatException if message is not long air-to-air ACAS reply or contains wrong values.
 */
public LongACAS(ModeSReply reply) throws BadFormatException {
  super(reply);
  setType(subtype.LONG_ACAS);
  if (getDownlinkFormat() != 16) {
    throw new BadFormatException("String_Node_Str");
  }
  byte[] payload=getPayload();
  airborne=(getFirstField() & 0x4) == 0;
  sensitivity_level=(byte)((payload[0] >>> 5) & 0x7);
  reply_information=(byte)((payload[0] & 0x7) << 1 | (payload[1] >>> 7) & 0x1);
  altitude_code=(short)((payload[1] << 8 | payload[2] & 0xFF) & 0x1FFF);
  valid_rac=payload[3] != 0x30;
  active_resolution_advisories=(short)((payload[4] << 6 | (payload[5] >>> 2) & 0x3) & 0x3FFF);
  racs_record=(byte)((payload[5] << 2 | (payload[6] >>> 6) & 0x3) & 0xF);
  ra_terminated=(payload[6] >>> 5 & 0x1) == 1;
  multiple_threat_encounter=(payload[6] >>> 4 & 0x1) == 1;
}
Program: 40843
Project: 40843
Buggy source:
/** 
 * @return the decoded altitude in meters
 */
public double getAltitude(){
  boolean Mbit=(altitude_code & 0x40) != 0;
  boolean Qbit=(altitude_code & 0x10) != 0;
  int N;
  if (!Mbit && Qbit) {
    N=(altitude_code & 0xF) | ((altitude_code & 0x20) >>> 1) | ((altitude_code & 0x1F80) >>> 2);
    return (25 * N - 1000) * 0.3048;
  }
 else {
    int C1=(0x1000 & altitude_code) >>> 12;
    int A1=(0x800 & altitude_code) >>> 11;
    int C2=(0x400 & altitude_code) >>> 10;
    int A2=(0x200 & altitude_code) >>> 9;
    int C4=(0x100 & altitude_code) >>> 8;
    int A4=(0x080 & altitude_code) >>> 7;
    int B1=(0x020 & altitude_code) >>> 5;
    int B2=(0x008 & altitude_code) >>> 3;
    int D2=(0x004 & altitude_code) >>> 2;
    int B4=(0x002 & altitude_code) >>> 1;
    int D4=(0x001 & altitude_code);
    int N500=grayToBin(D2 << 7 | D4 << 6 | A1 << 5 | A2 << 4 | A4 << 3 | B1 << 2 | B2 << 1 | B4,8);
    int N100=grayToBin(C1 << 2 | C2 << 1 | C4,3) - 1;
    if (N100 == 6)     N100=4;
    if (N500 % 2 != 0)     N100=4 - N100;
    return (-1200 + N500 * 500 + N100 * 100) * 0.3048;
  }
}

Fixed version (ground truth):
/** 
 * @return the decoded altitude in meters
 */
public Double getAltitude(){
  if (altitude_code == 0)   return null;
  boolean Mbit=(altitude_code & 0x40) != 0;
  if (!Mbit) {
    boolean Qbit=(altitude_code & 0x10) != 0;
    if (Qbit) {
      int N=(altitude_code & 0x0F) | ((altitude_code & 0x20) >>> 1) | ((altitude_code & 0x1F80) >>> 2);
      return (25 * N - 1000) * 0.3048;
    }
 else {
      int C1=(0x1000 & altitude_code) >>> 12;
      int A1=(0x0800 & altitude_code) >>> 11;
      int C2=(0x0400 & altitude_code) >>> 10;
      int A2=(0x0200 & altitude_code) >>> 9;
      int C4=(0x0100 & altitude_code) >>> 8;
      int A4=(0x0080 & altitude_code) >>> 7;
      int B1=(0x0020 & altitude_code) >>> 5;
      int B2=(0x0008 & altitude_code) >>> 3;
      int D2=(0x0004 & altitude_code) >>> 2;
      int B4=(0x0002 & altitude_code) >>> 1;
      int D4=(0x0001 & altitude_code);
      int N500=grayToBin(D2 << 7 | D4 << 6 | A1 << 5 | A2 << 4 | A4 << 3 | B1 << 2 | B2 << 1 | B4,8);
      int N100=grayToBin(C1 << 2 | C2 << 1 | C4,3) - 1;
      if (N100 == 6)       N100=4;
      if (N500 % 2 != 0)       N100=4 - N100;
      return (-1200 + N500 * 500 + N100 * 100) * 0.3048;
    }
  }
 else   return null;
}
Program: 40844
Project: 40844
Buggy source:
/** 
 * @param reply Mode S reply containing this short air-air acas reply
 * @throws BadFormatException if message is not short air-air acas reply or contains wrong values.
 */
public ShortACAS(ModeSReply reply) throws BadFormatException {
  super(reply);
  setType(subtype.SHORT_ACAS);
  if (getDownlinkFormat() != 0) {
    throw new BadFormatException("String_Node_Str");
  }
  byte[] payload=getPayload();
  airborne=(getFirstField() & 0x4) == 0;
  cross_link_capability=(getFirstField() & 0x2) != 0;
  sensitivity_level=(byte)((payload[0] >>> 5) & 0x7);
  reply_information=(byte)((payload[0] & 0x7) << 1 | (payload[1] >>> 7) & 0x1);
  altitude_code=(short)((payload[1] << 8 | payload[2]) & 0x1FFF);
}

Fixed version (ground truth):
/** 
 * @param reply Mode S reply containing this short air-air acas reply
 * @throws BadFormatException if message is not short air-air acas reply or contains wrong values.
 */
public ShortACAS(ModeSReply reply) throws BadFormatException {
  super(reply);
  setType(subtype.SHORT_ACAS);
  if (getDownlinkFormat() != 0) {
    throw new BadFormatException("String_Node_Str");
  }
  byte[] payload=getPayload();
  airborne=(getFirstField() & 0x4) == 0;
  cross_link_capability=(getFirstField() & 0x2) != 0;
  sensitivity_level=(byte)((payload[0] >>> 5) & 0x7);
  reply_information=(byte)((payload[0] & 0x7) << 1 | (payload[1] >>> 7) & 0x1);
  altitude_code=(short)((payload[1] << 8 | payload[2] & 0xFF) & 0x1FFF);
}
Program: 40845
Project: 40845
Buggy source:
/** 
 * @param raw_message raw extended squitter as hex string
 * @throws BadFormatException if message is not extended squitter or contains wrong values.
 */
public ExtendedSquitter(String raw_message) throws BadFormatException {
  super(raw_message);
  setType(subtype.EXTENDED_SQUITTER);
  if (getDownlinkFormat() != 17 && getDownlinkFormat() != 18) {
    throw new BadFormatException("String_Node_Str",raw_message);
  }
  byte[] payload=getPayload();
  capabilities=(byte)(payload[0] & 0x7);
  message=new byte[7];
  for (int i=0; i < 7; i++)   message[i]=payload[i + 3];
  format_type_code=(byte)((message[0] >>> 3) & 0x1F);
}

Fixed version (ground truth):
/** 
 * @param raw_message raw extended squitter as hex string
 * @throws BadFormatException if message is not extended squitter or contains wrong values.
 */
public ExtendedSquitter(String raw_message) throws BadFormatException {
  super(raw_message);
  setType(subtype.EXTENDED_SQUITTER);
  if (getDownlinkFormat() != 17 && getDownlinkFormat() != 18) {
    throw new BadFormatException("String_Node_Str",raw_message);
  }
  byte[] payload=getPayload();
  capabilities=getFirstField();
  message=new byte[7];
  for (int i=0; i < 7; i++)   message[i]=payload[i + 3];
  format_type_code=(byte)((message[0] >>> 3) & 0x1F);
}
Program: 40846
Project: 40846
Buggy source:
/** 
 * @return true if parity in message matched recalculated parity
 */
public boolean checkParity(){
  return tools.areEqual(calcParity(),getParity());
}

Fixed version (ground truth):
/** 
 * @return true if parity in message matched calculated parity
 */
public boolean checkParity(){
  return tools.areEqual(calcParity(),getParity());
}
Program: 40848
Project: 40848
Buggy source:
public String toString(){
  return super.toString() + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ getDownlinkFormat()+ "String_Node_Str"+ "String_Node_Str"+ getCapabilities()+ "String_Node_Str"+ "String_Node_Str"+ tools.toHexString(getIcao24())+ "String_Node_Str"+ "String_Node_Str"+ tools.toHexString(getPayload())+ "String_Node_Str"+ "String_Node_Str"+ tools.toHexString(getParity())+ "String_Node_Str"+ "String_Node_Str"+ tools.toHexString(calcParity());
}

Fixed version (ground truth):
public String toString(){
  return super.toString() + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ getDownlinkFormat()+ "String_Node_Str"+ "String_Node_Str"+ tools.toHexString(getIcao24())+ "String_Node_Str"+ "String_Node_Str"+ tools.toHexString(getPayload())+ "String_Node_Str"+ "String_Node_Str"+ tools.toHexString(getParity())+ "String_Node_Str"+ "String_Node_Str"+ tools.toHexString(calcParity());
}
Program: 40849
Project: 40849
Buggy source:
/** 
 * @return recalculated parity as 3-byte array
 */
public byte[] calcParity(){
  byte[] message=new byte[payload.length + 1];
  message[0]=(byte)(downlink_format << 3 | capabilities);
  for (byte b=0; b < payload.length; ++b)   message[b + 1]=payload[b];
  return calcParity(message);
}

Fixed version (ground truth):
/** 
 * @return calculates Mode S parity as 3-byte array
 */
public byte[] calcParity(){
  byte[] message=new byte[payload.length + 1];
  message[0]=(byte)(downlink_format << 3 | first_field);
  for (byte b=0; b < payload.length; ++b)   message[b + 1]=payload[b];
  return calcParity(message);
}
Program: 40850
Project: 40850
Buggy source:
public String toString(){
  return super.toString() + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ (isOddFormat() ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ (hasPosition() ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ (hasAltitude() ? "String_Node_Str" : "String_Node_Str");
}

Fixed version (ground truth):
public String toString(){
  try {
    return super.toString() + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ (isOddFormat() ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ (hasPosition() ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ (hasAltitude() ? getAltitude() : "String_Node_Str");
  }
 catch (  MissingInformationException e) {
    return "String_Node_Str";
  }
}
Program: 40851
Project: 40851
Buggy source:
/** 
 * Note:<br> 7700 indicates emergency<br> 7600 indicates radiocommunication failure<br> 7500 indicates unlawful interference<br> 2000 indicates that transponder is not yet operated<br>
 * @return The identity (Mode A code; see ICAO Annex 10 V4)
 */
public String getIdentity(){
  int C1=(0x1000 & identity) >>> 12;
  int A1=(0x800 & identity) >>> 11;
  int C2=(0x400 & identity) >>> 10;
  int A2=(0x200 & identity) >>> 9;
  int C4=(0x100 & identity) >>> 8;
  int A4=(0x080 & identity) >>> 7;
  int B1=(0x020 & identity) >>> 5;
  int D1=(0x010 & identity) >>> 4;
  int B2=(0x008 & identity) >>> 3;
  int D2=(0x004 & identity) >>> 2;
  int B4=(0x002 & identity) >>> 1;
  int D4=(0x001 & identity);
  String A=Integer.toString(A4 << 2 + A2 << 1 + A1);
  String B=Integer.toString(B4 << 2 + B2 << 1 + B1);
  String C=Integer.toString(C4 << 2 + C2 << 1 + C1);
  String D=Integer.toString(D4 << 2 + D2 << 1 + D1);
  return A + B + C+ D;
}

Fixed version (ground truth):
/** 
 * Note:<br> 7700 indicates emergency<br> 7600 indicates radiocommunication failure<br> 7500 indicates unlawful interference<br> 2000 indicates that transponder is not yet operated<br>
 * @return The identity (Mode A code; see ICAO Annex 10 V4)
 */
public String getIdentity(){
  int C1=(0x1000 & identity) >>> 12;
  int A1=(0x800 & identity) >>> 11;
  int C2=(0x400 & identity) >>> 10;
  int A2=(0x200 & identity) >>> 9;
  int C4=(0x100 & identity) >>> 8;
  int A4=(0x080 & identity) >>> 7;
  int B1=(0x020 & identity) >>> 5;
  int D1=(0x010 & identity) >>> 4;
  int B2=(0x008 & identity) >>> 3;
  int D2=(0x004 & identity) >>> 2;
  int B4=(0x002 & identity) >>> 1;
  int D4=(0x001 & identity);
  String A=Integer.toString((A4 << 2) + (A2 << 1) + A1);
  String B=Integer.toString((B4 << 2) + (B2 << 1) + B1);
  String C=Integer.toString((C4 << 2) + (C2 << 1) + C1);
  String D=Integer.toString((D4 << 2) + (D2 << 1) + D1);
  return A + B + C+ D;
}
Program: 40852
Project: 40852
Buggy source:
/** 
 * @param raw_message raw altitude reply as hex string
 * @throws BadFormatException if message is not altitude reply or contains wrong values.
 */
public IdentifyReply(String raw_message) throws BadFormatException {
  super(raw_message);
  setType(subtype.IDENTIFY_REPLY);
  if (getDownlinkFormat() != 4) {
    throw new BadFormatException("String_Node_Str",raw_message);
  }
  byte[] payload=getPayload();
  flight_status=getFirstField();
  downlink_request=(byte)((payload[0] >>> 3) & 0x1F);
  utility_msg=(byte)((payload[0] & 0x7) << 3 | (payload[1] >>> 5) & 0x7);
  identity=(short)((payload[1] << 8 | payload[2]) & 0x1FFF);
}

Fixed version (ground truth):
/** 
 * @param raw_message raw altitude reply as hex string
 * @throws BadFormatException if message is not altitude reply or contains wrong values.
 */
public IdentifyReply(String raw_message) throws BadFormatException {
  super(raw_message);
  setType(subtype.IDENTIFY_REPLY);
  if (getDownlinkFormat() != 5) {
    throw new BadFormatException("String_Node_Str",raw_message);
  }
  byte[] payload=getPayload();
  flight_status=getFirstField();
  downlink_request=(byte)((payload[0] >>> 3) & 0x1F);
  utility_msg=(byte)((payload[0] & 0x7) << 3 | (payload[1] >>> 5) & 0x7);
  identity=(short)((payload[1] << 8 | payload[2]) & 0x1FFF);
}
Program: 40853
Project: 40853
Buggy source:
public String toString(){
  return super.toString() + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ getDownlinkFormat()+ "String_Node_Str"+ "String_Node_Str"+ tools.toHexString(getIcao24())+ "String_Node_Str"+ "String_Node_Str"+ tools.toHexString(getPayload())+ "String_Node_Str"+ "String_Node_Str"+ tools.toHexString(getParity())+ "String_Node_Str"+ "String_Node_Str"+ tools.toHexString(calcParity());
}

Fixed version (ground truth):
public String toString(){
  return "String_Node_Str" + "String_Node_Str" + getDownlinkFormat() + "String_Node_Str"+ "String_Node_Str"+ tools.toHexString(getIcao24())+ "String_Node_Str"+ "String_Node_Str"+ tools.toHexString(getPayload())+ "String_Node_Str"+ "String_Node_Str"+ tools.toHexString(getParity())+ "String_Node_Str"+ "String_Node_Str"+ tools.toHexString(calcParity());
}