Program: 40854
Project: 40854
Buggy source:
public static void main(String[] args){
  Options opts=new Options();
  opts.addOption("String_Node_Str","String_Node_Str",false,"String_Node_Str");
  opts.addOption("String_Node_Str","String_Node_Str",true,"String_Node_Str");
  opts.addOption("String_Node_Str","String_Node_Str",true,"String_Node_Str");
  opts.addOption("String_Node_Str","String_Node_Str",true,"String_Node_Str");
  opts.addOption("String_Node_Str","String_Node_Str",true,"String_Node_Str");
  CommandLineParser parser=new DefaultParser();
  CommandLine cmd;
  File avro=null, kmlfile=null;
  String filter_icao24=null;
  Long filter_max=null;
  Double filter_start=null, filter_end=null;
  String file=null, out=null;
  try {
    cmd=parser.parse(opts,args);
    try {
      if (cmd.hasOption("String_Node_Str"))       filter_icao24=cmd.getOptionValue("String_Node_Str");
      if (cmd.hasOption("String_Node_Str"))       filter_start=Double.parseDouble(cmd.getOptionValue("String_Node_Str"));
      if (cmd.hasOption("String_Node_Str"))       filter_end=Double.parseDouble(cmd.getOptionValue("String_Node_Str"));
      if (cmd.hasOption("String_Node_Str"))       filter_max=Long.parseLong(cmd.getOptionValue("String_Node_Str"));
    }
 catch (    NumberFormatException e) {
      throw new ParseException("String_Node_Str" + e.getMessage());
    }
    if (cmd.hasOption("String_Node_Str")) {
      printHelp(opts);
      System.exit(0);
    }
    if (cmd.getArgList().size() != 2)     throw new ParseException("String_Node_Str");
    file=cmd.getArgList().get(0);
    out=cmd.getArgList().get(1);
  }
 catch (  ParseException e) {
    System.err.println(e.getMessage() + "String_Node_Str");
    printHelp(opts);
    System.exit(1);
  }
  System.out.println("String_Node_Str");
  try {
    avro=new File(file);
    if (!avro.exists() || avro.isDirectory() || !avro.canRead()) {
      throw new FileNotFoundException("String_Node_Str");
    }
    kmlfile=new File(out);
    if (kmlfile.exists() || kmlfile.isDirectory())     throw new java.io.IOException("String_Node_Str");
  }
 catch (  FileNotFoundException e) {
    System.err.println("String_Node_Str" + e.getMessage() + "String_Node_Str");
    System.exit(1);
  }
catch (  IOException e) {
    System.err.println("String_Node_Str" + e.getMessage() + "String_Node_Str");
    System.exit(1);
  }
  DatumReader<ModeSEncodedMessage> datumReader=new SpecificDatumReader<ModeSEncodedMessage>(ModeSEncodedMessage.class);
  long msgCount=0, good_pos_cnt=0, bad_pos_cnt=0, flights_cnt=0, err_pos_cnt=0;
  try {
    DataFileReader<ModeSEncodedMessage> fileReader=new DataFileReader<ModeSEncodedMessage>(avro,datumReader);
    System.err.println("String_Node_Str" + "String_Node_Str" + file + "String_Node_Str"+ "String_Node_Str"+ filter_icao24+ "String_Node_Str"+ "String_Node_Str"+ filter_start+ "String_Node_Str"+ "String_Node_Str"+ filter_end+ "String_Node_Str"+ "String_Node_Str"+ filter_max+ "String_Node_Str");
    ModeSEncodedMessage record=new ModeSEncodedMessage();
    HashMap<String,Flight> flights=new HashMap<String,Flight>();
    Flight flight;
    String icao24;
    ModeSReply msg;
    AirbornePositionMsg airpos;
    SurfacePositionMsg surfacepos;
    IdentificationMsg ident;
    Avro2Kml a2k=new Avro2Kml();
    OskyKml kml=a2k.new OskyKml();
    mainloop:     while (fileReader.hasNext()) {
      record=fileReader.next(record);
      if (record.getTimeAtServer() < filter_start)       continue;
      if (record.getTimeAtServer() > filter_end)       continue;
      List<String> to_remove=new ArrayList<String>();
      for (      String key : flights.keySet()) {
        if (flights.get(key).last < record.getTimeAtServer() - 3600) {
          to_remove.add(key);
        }
      }
      for (      String key : to_remove) {
        if (filter_max != null && kml.getNumberOfFlights() >= filter_max)         break mainloop;
        kml.addFlight(flights.get(key));
        flights.remove(key);
      }
      msgCount++;
      try {
        msg=Decoder.genericDecoder(record.getRawMessage().toString());
      }
 catch (      BadFormatException e) {
        continue;
      }
      icao24=tools.toHexString(msg.getIcao24());
      if (filter_icao24 != null && !icao24.equals(filter_icao24))       continue;
      if (flights.containsKey(icao24))       flight=flights.get(icao24);
 else {
        flight=a2k.new Flight();
        flight.icao24=icao24;
        flight.first=record.getTimeAtServer();
        flights.put(icao24,flight);
        ++flights_cnt;
      }
      flight.last=record.getTimeAtServer();
      if (!flight.serials.contains(record.getSensorSerialNumber()))       flight.serials.add(record.getSensorSerialNumber());
      if (msg instanceof AirbornePositionMsg) {
        airpos=(AirbornePositionMsg)msg;
        Position rec=record.getSensorLatitude() != null ? new Position(record.getSensorLongitude(),record.getSensorLatitude(),record.getSensorAltitude()) : null;
        airpos.setNICSupplementA(flight.dec.getNICSupplementA());
        Position pos=flight.dec.decodePosition(record.getTimeAtServer(),rec,airpos);
        if (pos == null)         ++err_pos_cnt;
 else {
          if (pos.isReasonable()) {
            Coordinate coord=new Coordinate(pos.getLongitude(),pos.getLatitude(),pos.getAltitude() != null && pos.getAltitude() > 0 ? pos.getAltitude() : 0);
            if (!flight.coords.contains(coord)) {
              flight.coords.add(coord);
              ++good_pos_cnt;
            }
          }
 else {
            flight.contains_unreasonable=true;
            ++bad_pos_cnt;
          }
        }
      }
 else       if (msg instanceof SurfacePositionMsg) {
        surfacepos=(SurfacePositionMsg)msg;
        Position rec=record.getSensorLatitude() != null ? new Position(record.getSensorLongitude(),record.getSensorLatitude(),record.getSensorAltitude()) : null;
        Position pos=flight.dec.decodePosition(record.getTimeAtServer(),rec,surfacepos);
        if (pos == null)         ++err_pos_cnt;
 else {
          if (pos.isReasonable()) {
            Coordinate coord=new Coordinate(pos.getLongitude(),pos.getLatitude(),0);
            if (!flight.coords.contains(coord)) {
              flight.coords.add(coord);
              ++good_pos_cnt;
            }
          }
 else {
            flight.contains_unreasonable=true;
            ++bad_pos_cnt;
          }
        }
      }
 else       if (msg instanceof IdentificationMsg) {
        ident=(IdentificationMsg)msg;
        flight.callsign=ident.getIdentity();
      }
    }
    for (    String key : flights.keySet()) {
      if (filter_max != null && kml.getNumberOfFlights() >= filter_max)       break;
      kml.addFlight(flights.get(key));
    }
    fileReader.close();
    kml.writeToFile(kmlfile);
  }
 catch (  IOException e) {
    System.err.println("String_Node_Str" + e.getMessage());
    System.exit(1);
  }
catch (  Exception e) {
    System.err.println("String_Node_Str" + e.getMessage());
    e.printStackTrace();
    System.exit(1);
  }
  System.err.println("String_Node_Str" + msgCount + "String_Node_Str");
  System.err.println("String_Node_Str" + good_pos_cnt);
  System.err.println("String_Node_Str" + bad_pos_cnt);
  System.err.println("String_Node_Str" + err_pos_cnt);
  System.err.println("String_Node_Str" + flights_cnt);
}

Fixed version (ground truth):
public static void main(String[] args){
  Options opts=new Options();
  opts.addOption("String_Node_Str","String_Node_Str",false,"String_Node_Str");
  opts.addOption("String_Node_Str","String_Node_Str",true,"String_Node_Str");
  opts.addOption("String_Node_Str","String_Node_Str",true,"String_Node_Str");
  opts.addOption("String_Node_Str","String_Node_Str",true,"String_Node_Str");
  opts.addOption("String_Node_Str","String_Node_Str",true,"String_Node_Str");
  CommandLineParser parser=new DefaultParser();
  CommandLine cmd;
  File avro=null, kmlfile=null;
  String filter_icao24=null;
  Long filter_max=null;
  Double filter_start=null, filter_end=null;
  String file=null, out=null;
  try {
    cmd=parser.parse(opts,args);
    try {
      if (cmd.hasOption("String_Node_Str"))       filter_icao24=cmd.getOptionValue("String_Node_Str");
      if (cmd.hasOption("String_Node_Str"))       filter_start=Double.parseDouble(cmd.getOptionValue("String_Node_Str"));
      if (cmd.hasOption("String_Node_Str"))       filter_end=Double.parseDouble(cmd.getOptionValue("String_Node_Str"));
      if (cmd.hasOption("String_Node_Str"))       filter_max=Long.parseLong(cmd.getOptionValue("String_Node_Str"));
    }
 catch (    NumberFormatException e) {
      throw new ParseException("String_Node_Str" + e.getMessage());
    }
    if (cmd.hasOption("String_Node_Str")) {
      printHelp(opts);
      System.exit(0);
    }
    if (cmd.getArgList().size() != 2)     throw new ParseException("String_Node_Str");
    file=cmd.getArgList().get(0);
    out=cmd.getArgList().get(1);
  }
 catch (  ParseException e) {
    System.err.println(e.getMessage() + "String_Node_Str");
    printHelp(opts);
    System.exit(1);
  }
  System.out.println("String_Node_Str");
  try {
    avro=new File(file);
    if (!avro.exists() || avro.isDirectory() || !avro.canRead()) {
      throw new FileNotFoundException("String_Node_Str");
    }
    kmlfile=new File(out);
    if (kmlfile.exists() || kmlfile.isDirectory())     throw new java.io.IOException("String_Node_Str");
  }
 catch (  FileNotFoundException e) {
    System.err.println("String_Node_Str" + e.getMessage() + "String_Node_Str");
    System.exit(1);
  }
catch (  IOException e) {
    System.err.println("String_Node_Str" + e.getMessage() + "String_Node_Str");
    System.exit(1);
  }
  DatumReader<ModeSEncodedMessage> datumReader=new SpecificDatumReader<ModeSEncodedMessage>(ModeSEncodedMessage.class);
  long msgCount=0, good_pos_cnt=0, bad_pos_cnt=0, flights_cnt=0, err_pos_cnt=0;
  try {
    DataFileReader<ModeSEncodedMessage> fileReader=new DataFileReader<ModeSEncodedMessage>(avro,datumReader);
    System.err.println("String_Node_Str" + "String_Node_Str" + file + "String_Node_Str"+ "String_Node_Str"+ filter_icao24+ "String_Node_Str"+ "String_Node_Str"+ filter_start+ "String_Node_Str"+ "String_Node_Str"+ filter_end+ "String_Node_Str"+ "String_Node_Str"+ filter_max+ "String_Node_Str");
    ModeSEncodedMessage record=new ModeSEncodedMessage();
    HashMap<String,Flight> flights=new HashMap<String,Flight>();
    Flight flight;
    String icao24;
    ModeSReply msg;
    AirbornePositionMsg airpos;
    SurfacePositionMsg surfacepos;
    IdentificationMsg ident;
    Avro2Kml a2k=new Avro2Kml();
    OskyKml kml=a2k.new OskyKml();
    mainloop:     while (fileReader.hasNext()) {
      record=fileReader.next(record);
      if (filter_start != null && record.getTimeAtServer() < filter_start)       continue;
      if (filter_end != null && record.getTimeAtServer() > filter_end)       continue;
      List<String> to_remove=new ArrayList<String>();
      for (      String key : flights.keySet()) {
        if (flights.get(key).last < record.getTimeAtServer() - 3600) {
          to_remove.add(key);
        }
      }
      for (      String key : to_remove) {
        if (filter_max != null && kml.getNumberOfFlights() >= filter_max)         break mainloop;
        kml.addFlight(flights.get(key));
        flights.remove(key);
      }
      msgCount++;
      try {
        msg=Decoder.genericDecoder(record.getRawMessage().toString());
      }
 catch (      BadFormatException e) {
        continue;
      }
      icao24=tools.toHexString(msg.getIcao24());
      if (filter_icao24 != null && !icao24.equals(filter_icao24))       continue;
      if (flights.containsKey(icao24))       flight=flights.get(icao24);
 else {
        flight=a2k.new Flight();
        flight.icao24=icao24;
        flight.first=record.getTimeAtServer();
        flights.put(icao24,flight);
        ++flights_cnt;
      }
      flight.last=record.getTimeAtServer();
      if (!flight.serials.contains(record.getSensorSerialNumber()))       flight.serials.add(record.getSensorSerialNumber());
      if (msg instanceof AirbornePositionMsg) {
        airpos=(AirbornePositionMsg)msg;
        Position rec=record.getSensorLatitude() != null ? new Position(record.getSensorLongitude(),record.getSensorLatitude(),record.getSensorAltitude()) : null;
        airpos.setNICSupplementA(flight.dec.getNICSupplementA());
        Position pos=flight.dec.decodePosition(record.getTimeAtServer(),rec,airpos);
        if (pos == null)         ++err_pos_cnt;
 else {
          if (pos.isReasonable()) {
            Coordinate coord=new Coordinate(pos.getLongitude(),pos.getLatitude(),pos.getAltitude() != null && pos.getAltitude() > 0 ? pos.getAltitude() : 0);
            if (!flight.coords.contains(coord)) {
              flight.coords.add(coord);
              ++good_pos_cnt;
            }
          }
 else {
            flight.contains_unreasonable=true;
            ++bad_pos_cnt;
          }
        }
      }
 else       if (msg instanceof SurfacePositionMsg) {
        surfacepos=(SurfacePositionMsg)msg;
        Position rec=record.getSensorLatitude() != null ? new Position(record.getSensorLongitude(),record.getSensorLatitude(),record.getSensorAltitude()) : null;
        Position pos=flight.dec.decodePosition(record.getTimeAtServer(),rec,surfacepos);
        if (pos == null)         ++err_pos_cnt;
 else {
          if (pos.isReasonable()) {
            Coordinate coord=new Coordinate(pos.getLongitude(),pos.getLatitude(),0);
            if (!flight.coords.contains(coord)) {
              flight.coords.add(coord);
              ++good_pos_cnt;
            }
          }
 else {
            flight.contains_unreasonable=true;
            ++bad_pos_cnt;
          }
        }
      }
 else       if (msg instanceof IdentificationMsg) {
        ident=(IdentificationMsg)msg;
        flight.callsign=ident.getIdentity();
      }
    }
    for (    String key : flights.keySet()) {
      if (filter_max != null && kml.getNumberOfFlights() >= filter_max)       break;
      kml.addFlight(flights.get(key));
    }
    fileReader.close();
    kml.writeToFile(kmlfile);
  }
 catch (  IOException e) {
    System.err.println("String_Node_Str" + e.getMessage());
    System.exit(1);
  }
catch (  Exception e) {
    System.err.println("String_Node_Str" + e.getMessage());
    e.printStackTrace();
    System.exit(1);
  }
  System.err.println("String_Node_Str" + msgCount + "String_Node_Str");
  System.err.println("String_Node_Str" + good_pos_cnt);
  System.err.println("String_Node_Str" + bad_pos_cnt);
  System.err.println("String_Node_Str" + err_pos_cnt);
  System.err.println("String_Node_Str" + flights_cnt);
}