Program: 11013
Project: 11013
Buggy source:
/** 
 * Join any exits to their neighbouring entries, moving clockwise around the sector. If an exit is on a different side to it's corresponding entry, add the sector corner points between the two points when joining.
 */
public void completePolygons(){
  Map<EntryExit,TileRecord> pointMap=new HashMap<EntryExit,TileRecord>();
  Map<TileRecord,EntryExit> reverseExitMap=new HashMap<TileRecord,EntryExit>();
  List<EntryExit> entryExits=new ArrayList<EntryExit>();
  List<EntryExit> entries=new ArrayList<EntryExit>();
  List<EntryExit> exits=new ArrayList<EntryExit>();
  for (  TileRecord r : records) {
    if (r.entered && r.exited) {
      Coordinate en=r.coordinates.get(0);
      Coordinate ex=r.coordinates.get(r.coordinates.size() - 1);
      EntryExit entry=new EntryExit(en,centroid,true);
      EntryExit exit=new EntryExit(ex,centroid,false);
      pointMap.put(entry,r);
      pointMap.put(exit,r);
      reverseExitMap.put(r,exit);
      entryExits.add(entry);
      entryExits.add(exit);
      entries.add(entry);
      exits.add(exit);
    }
  }
  if (entries.size() != exits.size())   throw new IllegalStateException("String_Node_Str");
  if (entries.isEmpty()) {
    if (filled) {
      fillSector();
    }
    return;
  }
  Collections.sort(entryExits);
  Collections.sort(entries);
  Collections.sort(exits);
  int offset=0;
  EntryExit previous=entryExits.get(entryExits.size() - 2);
  EntryExit current=entryExits.get(entryExits.size() - 1);
  for (int i=0; i < entryExits.size(); i++) {
    EntryExit next=entryExits.get(i);
    if (current.isExit() && next.isEntry() && !current.coordinate.equals(next.coordinate)&& !(previous.isEntry() && current.coordinate.equals(previous.coordinate))) {
      offset=entries.indexOf(next) - exits.indexOf(current);
      break;
    }
    previous=current;
    current=next;
  }
  for (int i=0; i < entries.size(); i++) {
    EntryExit exit=exits.get(i);
    EntryExit entry=entries.get((i + offset + entries.size()) % entries.size());
    TileRecord exitRecord=pointMap.remove(exit);
    TileRecord entryRecord=pointMap.remove(entry);
    addCornerPoints(exitRecord,entry.coordinate,exit.coordinate);
    if (exitRecord == entryRecord) {
    }
 else {
      exitRecord.coordinates.addAll(entryRecord.coordinates);
      records.remove(entryRecord);
      EntryExit entrysExit=reverseExitMap.get(entryRecord);
      pointMap.put(entrysExit,exitRecord);
      reverseExitMap.put(exitRecord,entrysExit);
    }
  }
}

Fixed version (ground truth):
/** 
 * Join any exits to their neighbouring entries, moving clockwise around the sector. If an exit is on a different side to it's corresponding entry, add the sector corner points between the two points when joining.
 */
public void completePolygons(){
  Map<EntryExit,TileRecord> pointMap=new HashMap<EntryExit,TileRecord>();
  Map<TileRecord,EntryExit> reverseExitMap=new HashMap<TileRecord,EntryExit>();
  List<EntryExit> entryExits=new ArrayList<EntryExit>();
  List<EntryExit> entries=new ArrayList<EntryExit>();
  List<EntryExit> exits=new ArrayList<EntryExit>();
  for (  TileRecord r : records) {
    if (r.entered && r.exited) {
      Coordinate en=r.coordinates.get(0);
      Coordinate ex=r.coordinates.get(r.coordinates.size() - 1);
      EntryExit entry=new EntryExit(en,centroid,true);
      EntryExit exit=new EntryExit(ex,centroid,false);
      pointMap.put(entry,r);
      pointMap.put(exit,r);
      reverseExitMap.put(r,exit);
      entryExits.add(entry);
      entryExits.add(exit);
      entries.add(entry);
      exits.add(exit);
    }
  }
  if (entries.size() != exits.size())   throw new IllegalStateException("String_Node_Str");
  if (entries.isEmpty()) {
    if (filled) {
      fillSector();
    }
    return;
  }
  Collections.sort(entryExits);
  Collections.sort(entries);
  Collections.sort(exits);
  int offset=0;
  EntryExit previous=entryExits.get(entryExits.size() - 2);
  EntryExit current=entryExits.get(entryExits.size() - 1);
  for (int i=0; i < entryExits.size(); i++) {
    EntryExit next=entryExits.get(i);
    if (current.isExit() && next.isEntry() && !current.coordinate.equals(next.coordinate)&& !(previous.isEntry() && current.coordinate.equals(previous.coordinate))) {
      offset=entries.indexOf(next) - exits.indexOf(current);
      break;
    }
    previous=current;
    current=next;
  }
  TileRecord exitRecord=null;
  for (int i=0; i < entries.size(); i++) {
    EntryExit exit=exits.get(i);
    EntryExit entry=entries.get((i + offset + entries.size()) % entries.size());
    exitRecord=pointMap.remove(exit);
    TileRecord entryRecord=pointMap.remove(entry);
    addCornerPoints(exitRecord,entry.coordinate,exit.coordinate);
    if (exitRecord == entryRecord) {
    }
 else {
      exitRecord.coordinates.addAll(entryRecord.coordinates);
      exitRecord.holes.addAll(entryRecord.holes);
      records.remove(entryRecord);
      EntryExit entrysExit=reverseExitMap.get(entryRecord);
      pointMap.put(entrysExit,exitRecord);
      reverseExitMap.put(exitRecord,entrysExit);
    }
  }
  exitRecord.holes.addAll(filledHoles);
}