Program: 187979
Project: 187979
Buggy source:
/** 
 * Stage 7:  Match all files from RES(HASH) with SRC(HASH) and put in MATCH and delete all incorrect matches from MATCH
 */
@SuppressWarnings("String_Node_Str") public static void stage7(final String src,final String srchash,final String res,final String reshash,final String match) throws IOException {
  final File dirsrc=new File(src);
  final File dirres=new File(res);
  final File fsrchash=new File(srchash);
  final File freshash=new File(reshash);
  final File dirmatch=new File(match);
  String abssrc=dirsrc.getAbsolutePath();
  if (abssrc.endsWith("String_Node_Str") == false)   abssrc+='/';
  String absres=dirres.getAbsolutePath();
  if (absres.endsWith("String_Node_Str") == false)   absres+='/';
  String absmatch=dirmatch.getAbsolutePath();
  if (absmatch.endsWith("String_Node_Str") == false)   absmatch+='/';
  if (dirsrc.exists() == false) {
    System.err.println("String_Node_Str");
    System.exit(-701);
  }
  if (dirsrc.isDirectory() == false) {
    System.err.println("String_Node_Str");
    System.exit(-702);
  }
  if (dirres.exists() == false) {
    System.err.println("String_Node_Str");
    System.exit(-703);
  }
  if (dirres.isDirectory() == false) {
    System.err.println("String_Node_Str");
    System.exit(-704);
  }
  if (fsrchash.exists()) {
    System.err.println("String_Node_Str");
    System.exit(-705);
  }
  if (freshash.exists()) {
    System.err.println("String_Node_Str");
    System.exit(-706);
  }
  if (dirmatch.exists() == false) {
    dirmatch.mkdir();
  }
 else   if (dirmatch.isDirectory() == false) {
    System.err.println("String_Node_Str");
    System.exit(-707);
  }
  final HashMap<Long,ArrayList<String>> srcmap=new HashMap<Long,ArrayList<String>>();
  final HashMap<Long,ArrayList<String>> resmap=new HashMap<Long,ArrayList<String>>();
  for (  final Object[] objs : new Object[][]{{fsrchash,srcmap},{freshash,resmap}}) {
    final File hash=(File)(objs[0]);
    final HashMap<Long,ArrayList<String>> map=(HashMap<Long,ArrayList<String>>)(objs[1]);
    final Scanner sc=new Scanner(new BufferedInputStream(new FileInputStream(hash)));
    while (sc.hasNext()) {
      final String line=sc.nextLine();
      if (line.isEmpty())       break;
      final int space=line.indexOf(' ');
      final Long key=Long.valueOf(line.substring(0,space));
      final String value=line.substring(space + 1).replace("String_Node_Str","String_Node_Str");
      ArrayList<String> values=map.get(key);
      if (values == null)       map.put(key,values=new ArrayList<String>());
      values.add(value);
    }
  }
  final Set<Long> keys=srcmap.keySet();
  for (  final Long key : keys) {
    final ArrayList<String> srcs=srcmap.get(key);
    final ArrayList<String> ress=srcmap.get(key);
    final HashMap<String,SoftReference<long[]>> map=new HashMap<String,SoftReference<long[]>>();
    for (    final String relsrc : srcs) {
      final String asrc=abssrc + relsrc;
      final long[] dsrc;
      final int sw, sh;
{
        final BufferedImage img=ImageIO.read(new File(asrc));
        sw=img.getWidth();
        sh=img.getHeight();
        dsrc=new long[((sw * sh) + 63) >> 6];
        long p=0;
        for (int y=0; y < sh; y++)         for (int x=0; x < sw; x++, p++)         if ((img.getRGB(x,y) & 0xFF000000) != 0)         dsrc[(int)(p >> 6)]^=1L << (p & 63);
      }
      mid:       for (      final String relres : ress) {
        final String ares=absres + relres;
        final SoftReference<long[]> dressr=map.get(relres);
        long[] dres=dressr == null ? null : dressr.get();
        final BufferedImage img=ImageIO.read(new File(ares));
        final int w=img.getWidth(), h=img.getHeight();
        if ((w != sw) || (h != sh))         continue;
        if (dres == null) {
          dres=new long[((w * h) + 63) >> 6];
          long p=0;
          for (int y=0; y < h; y++)           for (int x=0; x < w; x++, p++)           if ((img.getRGB(x,y) & 0xFF000000) != 0)           dres[(int)(p >> 6)]^=1L << (p & 63);
          map.put(relres,new SoftReference<long[]>(dres));
        }
        for (int i=0, n=dsrc.length; i < n; i++)         if (dsrc[i] != dres[i])         continue mid;
        int ev;
        if (exec("String_Node_Str","String_Node_Str",ares,absmatch + relres) != 0)         if ((ev=exec("String_Node_Str",ares,absmatch + relres)) != 0)         System.err.println("String_Node_Str" + ev + "String_Node_Str"+ ares+ "String_Node_Str"+ absmatch+ relres+ "String_Node_Str");
      }
      (new File(abssrc + relsrc)).delete();
    }
    for (    final String relres : ress)     (new File(absres + relres)).delete();
  }
}

Fixed version (ground truth):
/** 
 * Stage 7:  Match all files from RES(HASH) with SRC(HASH) and put in MATCH and delete all incorrect matches from MATCH
 */
@SuppressWarnings("String_Node_Str") public static void stage7(final String src,final String srchash,final String res,final String reshash,final String match) throws IOException {
  final File dirsrc=new File(src);
  final File dirres=new File(res);
  final File fsrchash=new File(srchash);
  final File freshash=new File(reshash);
  final File dirmatch=new File(match);
  String abssrc=dirsrc.getAbsolutePath();
  if (abssrc.endsWith("String_Node_Str") == false)   abssrc+='/';
  String absres=dirres.getAbsolutePath();
  if (absres.endsWith("String_Node_Str") == false)   absres+='/';
  String absmatch=dirmatch.getAbsolutePath();
  if (absmatch.endsWith("String_Node_Str") == false)   absmatch+='/';
  if (dirsrc.exists() == false) {
    System.err.println("String_Node_Str");
    System.exit(-701);
  }
  if (dirsrc.isDirectory() == false) {
    System.err.println("String_Node_Str");
    System.exit(-702);
  }
  if (dirres.exists() == false) {
    System.err.println("String_Node_Str");
    System.exit(-703);
  }
  if (dirres.isDirectory() == false) {
    System.err.println("String_Node_Str");
    System.exit(-704);
  }
  if (fsrchash.exists() == false) {
    System.err.println("String_Node_Str");
    System.exit(-705);
  }
  if (freshash.exists() == false) {
    System.err.println("String_Node_Str");
    System.exit(-706);
  }
  if (dirmatch.exists() == false) {
    dirmatch.mkdir();
  }
 else   if (dirmatch.isDirectory() == false) {
    System.err.println("String_Node_Str");
    System.exit(-707);
  }
  final HashMap<Long,ArrayList<String>> srcmap=new HashMap<Long,ArrayList<String>>();
  final HashMap<Long,ArrayList<String>> resmap=new HashMap<Long,ArrayList<String>>();
  for (  final Object[] objs : new Object[][]{{fsrchash,srcmap},{freshash,resmap}}) {
    final File hash=(File)(objs[0]);
    final HashMap<Long,ArrayList<String>> map=(HashMap<Long,ArrayList<String>>)(objs[1]);
    final Scanner sc=new Scanner(new BufferedInputStream(new FileInputStream(hash)));
    while (sc.hasNext()) {
      final String line=sc.nextLine();
      if (line.isEmpty())       break;
      final int space=line.indexOf(' ');
      final Long key=Long.valueOf(line.substring(0,space));
      final String value=line.substring(space + 1).replace("String_Node_Str","String_Node_Str");
      ArrayList<String> values=map.get(key);
      if (values == null)       map.put(key,values=new ArrayList<String>());
      values.add(value);
    }
  }
  final Set<Long> keys=srcmap.keySet();
  for (  final Long key : keys) {
    final ArrayList<String> srcs=srcmap.get(key);
    final ArrayList<String> ress=srcmap.get(key);
    final HashMap<String,SoftReference<long[]>> map=new HashMap<String,SoftReference<long[]>>();
    for (    final String relsrc : srcs) {
      final String asrc=abssrc + relsrc;
      final long[] dsrc;
      final int sw, sh;
{
        final BufferedImage img=ImageIO.read(new File(asrc));
        sw=img.getWidth();
        sh=img.getHeight();
        dsrc=new long[((sw * sh) + 63) >> 6];
        long p=0;
        for (int y=0; y < sh; y++)         for (int x=0; x < sw; x++, p++)         if ((img.getRGB(x,y) & 0xFF000000) != 0)         dsrc[(int)(p >> 6)]^=1L << (p & 63);
      }
      mid:       for (      final String relres : ress) {
        final String ares=absres + relres;
        final SoftReference<long[]> dressr=map.get(relres);
        long[] dres=dressr == null ? null : dressr.get();
        final BufferedImage img=ImageIO.read(new File(ares));
        final int w=img.getWidth(), h=img.getHeight();
        if ((w != sw) || (h != sh))         continue;
        if (dres == null) {
          dres=new long[((w * h) + 63) >> 6];
          long p=0;
          for (int y=0; y < h; y++)           for (int x=0; x < w; x++, p++)           if ((img.getRGB(x,y) & 0xFF000000) != 0)           dres[(int)(p >> 6)]^=1L << (p & 63);
          map.put(relres,new SoftReference<long[]>(dres));
        }
        for (int i=0, n=dsrc.length; i < n; i++)         if (dsrc[i] != dres[i])         continue mid;
        int ev;
        if (exec("String_Node_Str","String_Node_Str",ares,absmatch + relres) != 0)         if ((ev=exec("String_Node_Str",ares,absmatch + relres)) != 0)         System.err.println("String_Node_Str" + ev + "String_Node_Str"+ ares+ "String_Node_Str"+ absmatch+ relres+ "String_Node_Str");
      }
      (new File(abssrc + relsrc)).delete();
    }
    for (    final String relres : ress)     (new File(absres + relres)).delete();
  }
}