Program: 28297
Project: 28297
Buggy source:
private void processCookieHeaders(final URLConnection urlConnection){
  CookieManager systemCookieManager=(CookieManager)CookieManager.getDefault();
  if (systemCookieManager == null) {
    logger.finer("String_Node_Str");
    return;
  }
  CookieStore systemCookieJar=systemCookieManager.getCookieStore();
  List<HttpCookie> newCookies=systemCookieJar.getCookies();
  if (newCookies.isEmpty()) {
    return;
  }
  if (sessionCache.lastModified() == 0) {
    if (cookieManager == null) {
      cookieManager=new CookieManager(new ClientCookieStore(new CookieManager().getCookieStore(),sessionCache),CookiePolicy.ACCEPT_ALL);
    }
    try {
      cookieManager.put(((ClientCookieStore)cookieManager.getCookieStore()).getStaticURI(),urlConnection.getHeaderFields());
    }
 catch (    IOException e) {
      logger.finer("String_Node_Str" + e.toString());
      return;
    }
    try {
      ((ClientCookieStore)cookieManager.getCookieStore()).store();
    }
 catch (    IOException e) {
      logger.finer("String_Node_Str" + e.toString());
    }
    return;
  }
  if (cookieManager == null) {
    cookieManager=new CookieManager(new ClientCookieStore(new CookieManager().getCookieStore(),sessionCache),CookiePolicy.ACCEPT_ALL);
    try {
      ((ClientCookieStore)cookieManager.getCookieStore()).load();
    }
 catch (    IOException e) {
      logger.finer("String_Node_Str" + e.toString());
      return;
    }
  }
  boolean newCookieFound=false;
  for (  HttpCookie cookie : systemCookieJar.getCookies()) {
    int cookieIndex=cookieManager.getCookieStore().getCookies().indexOf(cookie);
    if (cookieIndex == -1) {
      newCookieFound=true;
      break;
    }
 else {
      HttpCookie c1=cookieManager.getCookieStore().getCookies().get(cookieIndex);
      if (!c1.getValue().equals(cookie.getValue())) {
        newCookieFound=true;
        break;
      }
    }
  }
  if (newCookieFound) {
    try {
      try {
        cookieManager.put(((ClientCookieStore)cookieManager.getCookieStore()).getStaticURI(),urlConnection.getHeaderFields());
      }
 catch (      IOException e) {
        logger.finer("String_Node_Str" + e.toString());
        return;
      }
      ((ClientCookieStore)cookieManager.getCookieStore()).store();
    }
 catch (    IOException e) {
      logger.finer("String_Node_Str" + e.toString());
    }
  }
 else {
    ((ClientCookieStore)cookieManager.getCookieStore()).touchStore();
  }
}

Fixed version (ground truth):
private void processCookieHeaders(final URLConnection urlConnection){
  CookieManager systemCookieManager=(CookieManager)CookieManager.getDefault();
  if (systemCookieManager == null) {
    logger.finer("String_Node_Str");
    return;
  }
  CookieStore systemCookieJar=systemCookieManager.getCookieStore();
  List<HttpCookie> newCookies=systemCookieJar.getCookies();
  if (newCookies.isEmpty()) {
    return;
  }
  if (sessionCache.lastModified() == 0) {
    if (cookieManager == null) {
      cookieManager=new CookieManager(new ClientCookieStore(new CookieManager().getCookieStore(),sessionCache),CookiePolicy.ACCEPT_ALL);
    }
    try {
      cookieManager.put(((ClientCookieStore)cookieManager.getCookieStore()).getStaticURI(),urlConnection.getHeaderFields());
    }
 catch (    IOException e) {
      if (logger.isLoggable(Level.FINER))       logger.finer("String_Node_Str" + e.toString());
      return;
    }
    try {
      ((ClientCookieStore)cookieManager.getCookieStore()).store();
    }
 catch (    IOException e) {
      if (logger.isLoggable(Level.FINER))       logger.finer("String_Node_Str" + e.toString());
    }
    return;
  }
  if (cookieManager == null) {
    cookieManager=new CookieManager(new ClientCookieStore(new CookieManager().getCookieStore(),sessionCache),CookiePolicy.ACCEPT_ALL);
    try {
      ((ClientCookieStore)cookieManager.getCookieStore()).load();
    }
 catch (    IOException e) {
      if (logger.isLoggable(Level.FINER))       logger.finer("String_Node_Str" + e.toString());
      return;
    }
  }
  boolean newCookieFound=false;
  for (  HttpCookie cookie : systemCookieJar.getCookies()) {
    int cookieIndex=cookieManager.getCookieStore().getCookies().indexOf(cookie);
    if (cookieIndex == -1) {
      newCookieFound=true;
      break;
    }
 else {
      HttpCookie c1=cookieManager.getCookieStore().getCookies().get(cookieIndex);
      if (!c1.getValue().equals(cookie.getValue())) {
        newCookieFound=true;
        break;
      }
    }
  }
  if (newCookieFound) {
    try {
      try {
        cookieManager.put(((ClientCookieStore)cookieManager.getCookieStore()).getStaticURI(),urlConnection.getHeaderFields());
      }
 catch (      IOException e) {
        if (logger.isLoggable(Level.FINER))         logger.finer("String_Node_Str" + e.toString());
        return;
      }
      ((ClientCookieStore)cookieManager.getCookieStore()).store();
    }
 catch (    IOException e) {
      if (logger.isLoggable(Level.FINER))       logger.finer("String_Node_Str" + e.toString());
    }
  }
 else {
    ((ClientCookieStore)cookieManager.getCookieStore()).touchStore();
  }
}