Program: 40834
Project: 40834
Buggy source:
public void decodeMsg(double timestamp,String raw) throws Exception {
  ModeSReply msg;
  try {
    msg=Decoder.genericDecoder(raw);
  }
 catch (  BadFormatException e) {
    System.out.println("String_Node_Str" + e.getMessage());
    return;
  }
catch (  UnspecifiedFormatError e) {
    System.out.println("String_Node_Str");
    return;
  }
  String icao24=tools.toHexString(msg.getIcao24());
  if (tools.isZero(msg.getParity()) || msg.checkParity()) {
    List<String> to_remove=new ArrayList<String>();
    for (    String key : decs.keySet())     if (decs.get(key).getLastUsedTime() < timestamp - 3600)     to_remove.add(key);
    for (    String key : to_remove)     decs.remove(key);
switch (msg.getType()) {
case ADSB_AIRBORN_POSITION:
      AirbornePositionMsg airpos=(AirbornePositionMsg)msg;
    System.out.print("String_Node_Str" + icao24 + "String_Node_Str");
  if (decs.containsKey(icao24)) {
    dec=decs.get(icao24);
    airpos.setNICSupplementA(dec.getNICSupplementA());
    Position current=dec.decodePosition(timestamp,airpos);
    if (current == null)     System.out.println("String_Node_Str");
 else     System.out.println("String_Node_Str" + current.getLatitude() + "String_Node_Str"+ current.getLongitude()+ "String_Node_Str");
  }
 else {
    dec=new PositionDecoder();
    dec.decodePosition(timestamp,airpos);
    decs.put(icao24,dec);
    System.out.println("String_Node_Str");
  }
System.out.println("String_Node_Str" + airpos.getHorizontalContainmentRadiusLimit() + "String_Node_Str");
System.out.println("String_Node_Str" + (airpos.hasAltitude() ? airpos.getAltitude() : "String_Node_Str") + "String_Node_Str");
break;
case ADSB_SURFACE_POSITION:
SurfacePositionMsg surfpos=(SurfacePositionMsg)msg;
System.out.print("String_Node_Str" + icao24 + "String_Node_Str");
if (decs.containsKey(icao24)) {
dec=decs.get(icao24);
Position current=dec.decodePosition(timestamp,surfpos);
if (current == null) System.out.println("String_Node_Str");
 else System.out.println("String_Node_Str" + current.getLatitude() + "String_Node_Str"+ current.getLongitude()+ "String_Node_Str");
}
 else {
dec=new PositionDecoder();
dec.decodePosition(timestamp,surfpos);
decs.put(icao24,dec);
System.out.println("String_Node_Str");
}
System.out.println("String_Node_Str" + surfpos.getHorizontalContainmentRadiusLimit() + "String_Node_Str");
if (surfpos.hasValidHeading()) System.out.println("String_Node_Str" + surfpos.getHeading() + "String_Node_Str");
System.out.println("String_Node_Str");
break;
case ADSB_EMERGENCY:
EmergencyOrPriorityStatusMsg status=(EmergencyOrPriorityStatusMsg)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ status.getEmergencyStateText());
System.out.println("String_Node_Str" + status.getModeACode()[0] + status.getModeACode()[1]+ status.getModeACode()[2]+ status.getModeACode()[3]);
break;
case ADSB_AIRSPEED:
AirspeedHeadingMsg airspeed=(AirspeedHeadingMsg)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ (airspeed.hasAirspeedInfo() ? airspeed.getAirspeed() + "String_Node_Str" : "String_Node_Str"));
if (airspeed.hasHeadingInfo()) System.out.println("String_Node_Str" + (airspeed.hasHeadingInfo() ? airspeed.getHeading() + "String_Node_Str" : "String_Node_Str"));
if (airspeed.hasVerticalRateInfo()) System.out.println("String_Node_Str" + (airspeed.hasVerticalRateInfo() ? airspeed.getVerticalRate() + "String_Node_Str" : "String_Node_Str"));
break;
case ADSB_IDENTIFICATION:
IdentificationMsg ident=(IdentificationMsg)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ new String(ident.getIdentity()));
System.out.println("String_Node_Str" + ident.getCategoryDescription());
break;
case ADSB_STATUS:
OperationalStatusMsg opstat=(OperationalStatusMsg)msg;
PositionDecoder dec;
if (decs.containsKey(icao24)) dec=decs.get(icao24);
 else {
dec=new PositionDecoder();
decs.put(icao24,dec);
}
dec.setNICSupplementA(opstat.getNICSupplementA());
if (opstat.getSubtypeCode() == 1) dec.setNICSupplementC(opstat.getNICSupplementC());
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ opstat.getVersion());
System.out.println("String_Node_Str" + opstat.has1090ESIn());
break;
case ADSB_TCAS:
TCASResolutionAdvisoryMsg tcas=(TCASResolutionAdvisoryMsg)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ tcas.hasRATerminated());
System.out.println("String_Node_Str" + tcas.getThreatType());
if (tcas.getThreatType() == 1) System.out.println("String_Node_Str" + String.format("String_Node_Str",tcas.getThreatIdentity()));
break;
case ADSB_VELOCITY:
VelocityOverGroundMsg veloc=(VelocityOverGroundMsg)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ (veloc.hasVelocityInfo() ? veloc.getVelocity() : "String_Node_Str")+ "String_Node_Str");
System.out.println("String_Node_Str" + (veloc.hasVelocityInfo() ? veloc.getHeading() : "String_Node_Str") + "String_Node_Str");
System.out.println("String_Node_Str" + (veloc.hasVerticalRateInfo() ? veloc.getVerticalRate() : "String_Node_Str") + "String_Node_Str");
break;
case EXTENDED_SQUITTER:
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ ((ExtendedSquitter)msg).getFormatTypeCode()+ "String_Node_Str");
break;
default :
}
}
 else if (msg.getDownlinkFormat() != 17) {
switch (msg.getType()) {
case MODES_REPLY:
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ msg.getDownlinkFormat());
break;
case SHORT_ACAS:
ShortACAS acas=(ShortACAS)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ acas.getAltitude()+ "String_Node_Str"+ (acas.hasOperatingACAS() ? "String_Node_Str" : "String_Node_Str"));
System.out.println("String_Node_Str" + (acas.isAirborne() ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ acas.getSensitivityLevel());
break;
case ALTITUDE_REPLY:
AltitudeReply alti=(AltitudeReply)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ alti.getAltitude()+ "String_Node_Str");
break;
case IDENTIFY_REPLY:
IdentifyReply identify=(IdentifyReply)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ identify.getIdentity());
break;
case ALL_CALL_REPLY:
AllCallReply allcall=(AllCallReply)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ tools.toHexString(allcall.getInterrogatorID())+ "String_Node_Str"+ (allcall.hasValidInterrogatorID() ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str");
break;
case LONG_ACAS:
LongACAS long_acas=(LongACAS)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ long_acas.getAltitude()+ "String_Node_Str"+ (long_acas.hasOperatingACAS() ? "String_Node_Str" : "String_Node_Str"));
System.out.println("String_Node_Str" + (long_acas.isAirborne() ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ long_acas.getSensitivityLevel());
System.out.println("String_Node_Str" + (long_acas.hasValidRAC() ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ long_acas.getResolutionAdvisoryComplement()+ "String_Node_Str"+ long_acas.hasMultipleThreats()+ "String_Node_Str");
break;
case MILITARY_EXTENDED_SQUITTER:
System.out.println("String_Node_Str" + icao24 + "String_Node_Str");
break;
case COMM_B_ALTITUDE_REPLY:
CommBAltitudeReply commBaltitude=(CommBAltitudeReply)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ commBaltitude.getAltitude()+ "String_Node_Str");
break;
case COMM_B_IDENTIFY_REPLY:
CommBIdentifyReply commBidentify=(CommBIdentifyReply)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ commBidentify.getIdentity());
break;
case COMM_D_ELM:
System.out.println("String_Node_Str" + icao24 + "String_Node_Str");
break;
default :
}
}
 else {
System.out.println("String_Node_Str");
}
}

Fixed version (ground truth):
public void decodeMsg(double timestamp,String raw,String icao) throws Exception {
  ModeSReply msg;
  try {
    msg=Decoder.genericDecoder(raw);
  }
 catch (  BadFormatException e) {
    System.out.println("String_Node_Str" + e.getMessage());
    return;
  }
catch (  UnspecifiedFormatError e) {
    System.out.println("String_Node_Str");
    return;
  }
  String icao24=tools.toHexString(msg.getIcao24());
  if (icao != null && !icao.toLowerCase().equals(icao24))   return;
  if (tools.isZero(msg.getParity()) || msg.checkParity()) {
    List<String> to_remove=new ArrayList<String>();
    for (    String key : decs.keySet())     if (decs.get(key).getLastUsedTime() < timestamp - 3600)     to_remove.add(key);
    for (    String key : to_remove)     decs.remove(key);
switch (msg.getType()) {
case ADSB_AIRBORN_POSITION:
      AirbornePositionMsg airpos=(AirbornePositionMsg)msg;
    System.out.print("String_Node_Str" + icao24 + "String_Node_Str");
  if (decs.containsKey(icao24)) {
    dec=decs.get(icao24);
    airpos.setNICSupplementA(dec.getNICSupplementA());
    Position current=dec.decodePosition(timestamp,airpos);
    if (current == null)     System.out.println("String_Node_Str");
 else     System.out.println("String_Node_Str" + current.getLatitude() + "String_Node_Str"+ current.getLongitude()+ "String_Node_Str");
  }
 else {
    dec=new PositionDecoder();
    dec.decodePosition(timestamp,airpos);
    decs.put(icao24,dec);
    System.out.println("String_Node_Str");
  }
System.out.println("String_Node_Str" + airpos.getHorizontalContainmentRadiusLimit() + "String_Node_Str");
System.out.println("String_Node_Str" + (airpos.hasAltitude() ? airpos.getAltitude() : "String_Node_Str") + "String_Node_Str");
break;
case ADSB_SURFACE_POSITION:
SurfacePositionMsg surfpos=(SurfacePositionMsg)msg;
System.out.print("String_Node_Str" + icao24 + "String_Node_Str");
if (decs.containsKey(icao24)) {
dec=decs.get(icao24);
Position current=dec.decodePosition(timestamp,surfpos);
if (current == null) System.out.println("String_Node_Str");
 else System.out.println("String_Node_Str" + current.getLatitude() + "String_Node_Str"+ current.getLongitude()+ "String_Node_Str");
}
 else {
dec=new PositionDecoder();
dec.decodePosition(timestamp,surfpos);
decs.put(icao24,dec);
System.out.println("String_Node_Str");
}
System.out.println("String_Node_Str" + surfpos.getHorizontalContainmentRadiusLimit() + "String_Node_Str");
if (surfpos.hasValidHeading()) System.out.println("String_Node_Str" + surfpos.getHeading() + "String_Node_Str");
System.out.println("String_Node_Str");
break;
case ADSB_EMERGENCY:
EmergencyOrPriorityStatusMsg status=(EmergencyOrPriorityStatusMsg)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ status.getEmergencyStateText());
System.out.println("String_Node_Str" + status.getModeACode()[0] + status.getModeACode()[1]+ status.getModeACode()[2]+ status.getModeACode()[3]);
break;
case ADSB_AIRSPEED:
AirspeedHeadingMsg airspeed=(AirspeedHeadingMsg)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ (airspeed.hasAirspeedInfo() ? airspeed.getAirspeed() + "String_Node_Str" : "String_Node_Str"));
if (airspeed.hasHeadingInfo()) System.out.println("String_Node_Str" + (airspeed.hasHeadingInfo() ? airspeed.getHeading() + "String_Node_Str" : "String_Node_Str"));
if (airspeed.hasVerticalRateInfo()) System.out.println("String_Node_Str" + (airspeed.hasVerticalRateInfo() ? airspeed.getVerticalRate() + "String_Node_Str" : "String_Node_Str"));
break;
case ADSB_IDENTIFICATION:
IdentificationMsg ident=(IdentificationMsg)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ new String(ident.getIdentity()));
System.out.println("String_Node_Str" + ident.getCategoryDescription());
break;
case ADSB_STATUS:
OperationalStatusMsg opstat=(OperationalStatusMsg)msg;
PositionDecoder dec;
if (decs.containsKey(icao24)) dec=decs.get(icao24);
 else {
dec=new PositionDecoder();
decs.put(icao24,dec);
}
dec.setNICSupplementA(opstat.getNICSupplementA());
if (opstat.getSubtypeCode() == 1) dec.setNICSupplementC(opstat.getNICSupplementC());
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ opstat.getVersion());
System.out.println("String_Node_Str" + opstat.has1090ESIn());
break;
case ADSB_TCAS:
TCASResolutionAdvisoryMsg tcas=(TCASResolutionAdvisoryMsg)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ tcas.hasRATerminated());
System.out.println("String_Node_Str" + tcas.getThreatType());
if (tcas.getThreatType() == 1) System.out.println("String_Node_Str" + String.format("String_Node_Str",tcas.getThreatIdentity()));
break;
case ADSB_VELOCITY:
VelocityOverGroundMsg veloc=(VelocityOverGroundMsg)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ (veloc.hasVelocityInfo() ? veloc.getVelocity() : "String_Node_Str")+ "String_Node_Str");
System.out.println("String_Node_Str" + (veloc.hasVelocityInfo() ? veloc.getHeading() : "String_Node_Str") + "String_Node_Str");
System.out.println("String_Node_Str" + (veloc.hasVerticalRateInfo() ? veloc.getVerticalRate() : "String_Node_Str") + "String_Node_Str");
break;
case EXTENDED_SQUITTER:
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ ((ExtendedSquitter)msg).getFormatTypeCode()+ "String_Node_Str");
break;
default :
}
}
 else if (msg.getDownlinkFormat() != 17) {
switch (msg.getType()) {
case MODES_REPLY:
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ msg.getDownlinkFormat());
break;
case SHORT_ACAS:
ShortACAS acas=(ShortACAS)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ acas.getAltitude()+ "String_Node_Str"+ (acas.hasOperatingACAS() ? "String_Node_Str" : "String_Node_Str"));
System.out.println("String_Node_Str" + (acas.isAirborne() ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ acas.getSensitivityLevel());
break;
case ALTITUDE_REPLY:
AltitudeReply alti=(AltitudeReply)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ alti.getAltitude()+ "String_Node_Str");
break;
case IDENTIFY_REPLY:
IdentifyReply identify=(IdentifyReply)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ identify.getIdentity());
break;
case ALL_CALL_REPLY:
AllCallReply allcall=(AllCallReply)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ tools.toHexString(allcall.getInterrogatorID())+ "String_Node_Str"+ (allcall.hasValidInterrogatorID() ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str");
break;
case LONG_ACAS:
LongACAS long_acas=(LongACAS)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ long_acas.getAltitude()+ "String_Node_Str"+ (long_acas.hasOperatingACAS() ? "String_Node_Str" : "String_Node_Str"));
System.out.println("String_Node_Str" + (long_acas.isAirborne() ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ long_acas.getSensitivityLevel());
System.out.println("String_Node_Str" + (long_acas.hasValidRAC() ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ long_acas.getResolutionAdvisoryComplement()+ "String_Node_Str"+ long_acas.hasMultipleThreats()+ "String_Node_Str");
break;
case MILITARY_EXTENDED_SQUITTER:
System.out.println("String_Node_Str" + icao24 + "String_Node_Str");
break;
case COMM_B_ALTITUDE_REPLY:
CommBAltitudeReply commBaltitude=(CommBAltitudeReply)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ commBaltitude.getAltitude()+ "String_Node_Str");
break;
case COMM_B_IDENTIFY_REPLY:
CommBIdentifyReply commBidentify=(CommBIdentifyReply)msg;
System.out.println("String_Node_Str" + icao24 + "String_Node_Str"+ commBidentify.getIdentity());
break;
case COMM_D_ELM:
System.out.println("String_Node_Str" + icao24 + "String_Node_Str");
break;
default :
}
}
 else {
System.out.println("String_Node_Str");
}
}