Program: 31745
Project: 31745
Buggy source:
private static String getHelper(final RemoteWebDriver driver,final Node urlNode,final String url,final boolean p_cached,final String runGuid,final HtmlNode[] clicks){
  final String urlHash=CommonUtil.isEmpty(url) ? null : Crypto.fastHash(url);
  final long time=System.currentTimeMillis();
  if (urlHash != null) {
synchronized (fetchLocalCacheLock) {
      if (fetchLocalCache.containsKey(urlHash)) {
        if (time - fetchLocalCache.get(urlHash) < FETCH_LOCAL_CACHE_EXPIRES) {
          try {
            return FileUtils.readFileToString(new File("String_Node_Str" + urlHash),"String_Node_Str");
          }
 catch (          Throwable t) {
            Log.exception(t);
            fetchLocalCache.remove(urlHash);
          }
        }
 else {
          fetchLocalCache.remove(urlHash);
        }
      }
    }
  }
  if (!CommonUtil.isEmpty(url)) {
    final Object resultLock=new Object();
    final String initVal;
    final String[] result;
synchronized (resultLock) {
      initVal=Crypto.random();
      result=new String[]{initVal};
    }
    final AtomicBoolean started=new AtomicBoolean();
    Thread thread=new Thread(new Runnable(){
      @Override public void run(){
        started.set(true);
        boolean cached=p_cached;
        String newHandle=null;
        String origHandle=null;
        try {
          origHandle=driver.getWindowHandle();
          String content=null;
          if (!cached) {
            try {
              Util.get(driver,url,urlNode,false);
            }
 catch (            Throwable t) {
              if (urlNode != null) {
                Util.newWindow(driver);
              }
              Util.get(driver,url,false);
            }
            if (urlNode != null) {
              newHandle=driver.getWindowHandle();
            }
            Util.doClicks(driver,clicks,null);
            content=driver.getPageSource();
            if (CommonUtil.isEmpty(content)) {
              cached=true;
            }
          }
          if (cached) {
            if (ScreenSlicerBatch.isCancelled(runGuid)) {
              return;
            }
            Util.get(driver,toCacheUrl(url),false);
            content=driver.getPageSource();
          }
          content=Util.clean(content,driver.getCurrentUrl()).outerHtml();
          if (WebApp.DEBUG) {
            try {
              FileUtils.writeStringToFile(new File("String_Node_Str" + System.currentTimeMillis()),content);
            }
 catch (            IOException e) {
            }
          }
synchronized (resultLock) {
            result[0]=content;
          }
        }
 catch (        Throwable t) {
          Log.exception(t);
        }
 finally {
synchronized (resultLock) {
            if (initVal.equals(result[0])) {
              result[0]=null;
            }
          }
          Util.driverSleepRandLong();
          if (newHandle != null && origHandle != null) {
            try {
              Util.cleanUpNewWindows(driver,origHandle);
            }
 catch (            Throwable t) {
              Log.exception(t);
            }
          }
        }
      }
    }
);
    thread.start();
    try {
      while (!started.get()) {
        try {
          Thread.sleep(WAIT);
        }
 catch (        Throwable t) {
          Log.exception(t);
        }
      }
      thread.join(HANG_TIME);
synchronized (resultLock) {
        if (initVal.equals(result[0])) {
          try {
            Log.exception(new Exception("String_Node_Str"));
            forceQuit();
            thread.interrupt();
          }
 catch (          Throwable t) {
            Log.exception(t);
          }
          throw new ActionFailed();
        }
 else         if (urlHash != null && !CommonUtil.isEmpty(result[0]) && result[0].length() > MIN_FETCH_CACHE_PAGE_LEN) {
synchronized (fetchLocalCacheLock) {
            if (fetchLocalCache.size() > MAX_FETCH_LOCAL_CACHE) {
              try {
                FileUtils.deleteQuietly(new File("String_Node_Str"));
                FileUtils.forceMkdir(new File("String_Node_Str"));
              }
 catch (              Throwable t) {
                Log.exception(t);
              }
              fetchLocalCache.clear();
            }
            FileUtils.writeStringToFile(new File("String_Node_Str" + urlHash),result[0],"String_Node_Str",false);
            fetchLocalCache.put(urlHash,time);
          }
        }
        return result[0];
      }
    }
 catch (    Throwable t) {
      Log.exception(t);
    }
  }
  return null;
}

Fixed version (ground truth):
private static String getHelper(final RemoteWebDriver driver,final Node urlNode,final String url,final boolean p_cached,final String runGuid,final HtmlNode[] clicks){
  final String urlHash=CommonUtil.isEmpty(url) ? null : Crypto.fastHash(url);
  final long time=System.currentTimeMillis();
  if (urlHash != null) {
synchronized (fetchLocalCacheLock) {
      if (fetchLocalCache.containsKey(urlHash)) {
        if (time - fetchLocalCache.get(urlHash) < FETCH_LOCAL_CACHE_EXPIRES) {
          try {
            return FileUtils.readFileToString(new File("String_Node_Str" + urlHash),"String_Node_Str");
          }
 catch (          Throwable t) {
            Log.exception(t);
            fetchLocalCache.remove(urlHash);
          }
        }
 else {
          fetchLocalCache.remove(urlHash);
        }
      }
    }
  }
  if (!CommonUtil.isEmpty(url)) {
    final Object resultLock=new Object();
    final String initVal;
    final String[] result;
synchronized (resultLock) {
      initVal=Random.next();
      result=new String[]{initVal};
    }
    final AtomicBoolean started=new AtomicBoolean();
    Thread thread=new Thread(new Runnable(){
      @Override public void run(){
        started.set(true);
        boolean cached=p_cached;
        String newHandle=null;
        String origHandle=null;
        try {
          origHandle=driver.getWindowHandle();
          String content=null;
          if (!cached) {
            try {
              Util.get(driver,url,urlNode,false);
            }
 catch (            Throwable t) {
              if (urlNode != null) {
                Util.newWindow(driver);
              }
              Util.get(driver,url,false);
            }
            if (urlNode != null) {
              newHandle=driver.getWindowHandle();
            }
            Util.doClicks(driver,clicks,null);
            content=driver.getPageSource();
            if (CommonUtil.isEmpty(content)) {
              cached=true;
            }
          }
          if (cached) {
            if (ScreenSlicerBatch.isCancelled(runGuid)) {
              return;
            }
            Util.get(driver,toCacheUrl(url),false);
            content=driver.getPageSource();
          }
          content=Util.clean(content,driver.getCurrentUrl()).outerHtml();
          if (WebApp.DEBUG) {
            try {
              FileUtils.writeStringToFile(new File("String_Node_Str" + System.currentTimeMillis()),content);
            }
 catch (            IOException e) {
            }
          }
synchronized (resultLock) {
            result[0]=content;
          }
        }
 catch (        Throwable t) {
          Log.exception(t);
        }
 finally {
synchronized (resultLock) {
            if (initVal.equals(result[0])) {
              result[0]=null;
            }
          }
          Util.driverSleepRandLong();
          if (newHandle != null && origHandle != null) {
            try {
              Util.cleanUpNewWindows(driver,origHandle);
            }
 catch (            Throwable t) {
              Log.exception(t);
            }
          }
        }
      }
    }
);
    thread.start();
    try {
      while (!started.get()) {
        try {
          Thread.sleep(WAIT);
        }
 catch (        Throwable t) {
          Log.exception(t);
        }
      }
      thread.join(HANG_TIME);
synchronized (resultLock) {
        if (initVal.equals(result[0])) {
          try {
            Log.exception(new Exception("String_Node_Str"));
            forceQuit();
            thread.interrupt();
          }
 catch (          Throwable t) {
            Log.exception(t);
          }
          throw new ActionFailed();
        }
 else         if (urlHash != null && !CommonUtil.isEmpty(result[0]) && result[0].length() > MIN_FETCH_CACHE_PAGE_LEN) {
synchronized (fetchLocalCacheLock) {
            if (fetchLocalCache.size() > MAX_FETCH_LOCAL_CACHE) {
              try {
                FileUtils.deleteQuietly(new File("String_Node_Str"));
                FileUtils.forceMkdir(new File("String_Node_Str"));
              }
 catch (              Throwable t) {
                Log.exception(t);
              }
              fetchLocalCache.clear();
            }
            FileUtils.writeStringToFile(new File("String_Node_Str" + urlHash),result[0],"String_Node_Str",false);
            fetchLocalCache.put(urlHash,time);
          }
        }
        return result[0];
      }
    }
 catch (    Throwable t) {
      Log.exception(t);
    }
  }
  return null;
}