Program: 94509
Project: 94509
Buggy source:
/** 
 * Returns the list of MrsPyramidInputSplit objects required across all of the input pyramids. Sub-classes should have no need to override this method. It contains logic required by all input formats (described in the overview for this class).
 */
@Override public List<InputSplit> getSplits(JobContext context) throws IOException, InterruptedException {
  TiledInputFormatContext ifContext=TiledInputFormatContext.load(context.getConfiguration());
  Set<String> inputSet=ifContext.getInputs();
  MrsPyramid[] pyramids=new MrsPyramid[inputSet.size()];
  int inputIndex=0;
  for (  String strInput : inputSet) {
    String pyramid=strInput;
    MrsPyramid p=MrsImagePyramid.open(pyramid,context.getConfiguration());
    pyramids[inputIndex]=p;
    inputIndex++;
  }
  Arrays.sort(pyramids,new Comparator<MrsPyramid>(){
    @Override public int compare(    MrsPyramid p1,    MrsPyramid p2){
      Bounds b=p1.getBounds();
      double a1=b.getWidth() * b.getHeight();
      b=p2.getBounds();
      double a2=b.getWidth() * b.getHeight();
      int result=Double.compare(a2,a1);
      if (result == 0) {
        int v1=p1.getMaximumLevel();
        int v2=p2.getMaximumLevel();
        if (v1 == v2) {
          return 0;
        }
        return (v1 < v2) ? 1 : -1;
      }
      return result;
    }
  }
);
  List<List<TiledInputSplit>> nativeSplitsPerInput=new LinkedList<List<TiledInputSplit>>();
  Map<String,Bounds> post=new HashMap<String,Bounds>();
  int[] zooms=new int[pyramids.length];
  for (int i=0; i < pyramids.length; i++) {
    String pyramid=pyramids[i].getName();
    zooms[i]=ifContext.getZoomLevel();
    List<TiledInputSplit> splits=getNativeSplits(context,ifContext,pyramid);
    nativeSplitsPerInput.add(filterInputSplits(ifContext,splits,zooms[i],pyramids[i].getTileSize()));
    post.put(pyramid,pyramids[i].getBounds());
  }
  List<InputSplit> splits=new LinkedList<InputSplit>();
  Map<String,Bounds> pre=new HashMap<String,Bounds>();
  for (int i=0; i < pyramids.length; i++) {
    MrsPyramid pyramid=pyramids[i];
    Bounds b=post.remove(pyramid.getName());
    List<TiledInputSplit> ns=nativeSplitsPerInput.get(i);
    if (ns != null) {
      Iterator<TiledInputSplit> iter=ns.iterator();
      while (iter.hasNext()) {
        TiledInputSplit tiledSplit=iter.next();
        MrsPyramidInputSplit mpsplit=new MrsPyramidInputSplit(tiledSplit,pyramid.getName(),zooms[i],pre.values().toArray(new Bounds[0]),post.values().toArray(new Bounds[0]));
        splits.add(mpsplit);
      }
    }
    pre.put(pyramid.getName(),b);
  }
  return splits;
}

Fixed version (ground truth):
/** 
 * Returns the list of MrsPyramidInputSplit objects required across all of the input pyramids. Sub-classes should have no need to override this method. It contains logic required by all input formats (described in the overview for this class).
 */
@Override public List<InputSplit> getSplits(JobContext context) throws IOException, InterruptedException {
  TiledInputFormatContext ifContext=TiledInputFormatContext.load(context.getConfiguration());
  Set<String> inputSet=ifContext.getInputs();
  MrsPyramid[] pyramids=new MrsPyramid[inputSet.size()];
  int inputIndex=0;
  for (  String strInput : inputSet) {
    String pyramid=strInput;
    MrsPyramid p=MrsImagePyramid.open(pyramid,context.getConfiguration());
    pyramids[inputIndex]=p;
    inputIndex++;
  }
  Arrays.sort(pyramids,new Comparator<MrsPyramid>(){
    @Override public int compare(    MrsPyramid p1,    MrsPyramid p2){
      Bounds b=p1.getBounds();
      double a1=b.getWidth() * b.getHeight();
      b=p2.getBounds();
      double a2=b.getWidth() * b.getHeight();
      int result=Double.compare(a2,a1);
      if (result == 0) {
        int v1=p1.getMaximumLevel();
        int v2=p2.getMaximumLevel();
        if (v1 == v2) {
          return 0;
        }
        return (v1 < v2) ? 1 : -1;
      }
      return result;
    }
  }
);
  List<List<TiledInputSplit>> nativeSplitsPerInput=new LinkedList<List<TiledInputSplit>>();
  Map<String,Bounds> post=new HashMap<String,Bounds>();
  int[] zooms=new int[pyramids.length];
  for (int i=0; i < pyramids.length; i++) {
    String pyramid=pyramids[i].getName();
    zooms[i]=ifContext.getZoomLevel();
    List<TiledInputSplit> splits=getNativeSplits(context,ifContext,pyramid);
    log.info("String_Node_Str" + splits.size());
    List<TiledInputSplit> filteredSplits=filterInputSplits(ifContext,splits,zooms[i],pyramids[i].getTileSize());
    log.info("String_Node_Str" + filteredSplits.size());
    nativeSplitsPerInput.add(filteredSplits);
    post.put(pyramid,pyramids[i].getBounds());
  }
  List<InputSplit> splits=new LinkedList<InputSplit>();
  Map<String,Bounds> pre=new HashMap<String,Bounds>();
  for (int i=0; i < pyramids.length; i++) {
    MrsPyramid pyramid=pyramids[i];
    Bounds b=post.remove(pyramid.getName());
    List<TiledInputSplit> ns=nativeSplitsPerInput.get(i);
    if (ns != null) {
      Iterator<TiledInputSplit> iter=ns.iterator();
      while (iter.hasNext()) {
        TiledInputSplit tiledSplit=iter.next();
        MrsPyramidInputSplit mpsplit=new MrsPyramidInputSplit(tiledSplit,pyramid.getName(),zooms[i],pre.values().toArray(new Bounds[0]),post.values().toArray(new Bounds[0]));
        splits.add(mpsplit);
      }
    }
    pre.put(pyramid.getName(),b);
  }
  return splits;
}