Program: 60176
Project: 60176
Buggy source:
/** 
 * Gets cookies belonging exactly to the host name given, not to a broader domain.
 * @param hostName the host name
 * @param path the path
 * @return the cookies strict
 */
private Collection<Cookie> getCookiesStrict(String hostName,String path){
  if ((path == null) || (path.length() == 0)) {
    path="String_Node_Str";
  }
  boolean liflag=logger.isLoggable(Level.INFO);
  Collection<Cookie> cookies=new LinkedList<Cookie>();
  Cookie cookie=new Cookie();
  Set<String> transientCookieNames=new HashSet<String>();
synchronized (this) {
    Map<String,CookieValue> hostMap=this.transientMapByHost.get(hostName);
    if (hostMap != null) {
      Iterator<Map.Entry<String,CookieValue>> i=hostMap.entrySet().iterator();
      while (i.hasNext()) {
        Map.Entry<String,CookieValue> entry=i.next();
        CookieValue cookieValue=entry.getValue();
        if (cookieValue.isExpired()) {
          if (liflag) {
            logger.info("String_Node_Str" + entry.getKey() + "String_Node_Str"+ hostName+ "String_Node_Str"+ cookieValue.getExpires());
          }
        }
 else {
          if (path.startsWith(cookieValue.getPath())) {
            String cookieName=entry.getKey();
            transientCookieNames.add(cookieName);
            cookie.setName(cookieName);
            cookie.setValue(cookieValue.getValue());
            cookie.setPath(cookieValue.getPath());
            cookie.setDomain(cookieValue.getDomain());
            cookies.add(cookie);
          }
 else {
            if (liflag) {
              logger.info("String_Node_Str" + cookieValue + "String_Node_Str"+ path);
            }
          }
        }
      }
    }
  }
  try {
    RestrictedStore store=StorageManager.getInstance().getRestrictedStore(hostName,false);
    if (store != null) {
      Collection paths;
      paths=store.getPaths(COOKIE_PATH_PATTERN);
      Iterator pathsIterator=paths.iterator();
      while (pathsIterator.hasNext()) {
        String filePath=(String)pathsIterator.next();
        String cookieName=this.getCookieNameFromPath(filePath);
        if (!transientCookieNames.contains(cookieName)) {
          CookieValue cookieValue=(CookieValue)store.retrieveObject(filePath);
          if (cookieValue != null) {
            if (cookieValue.isExpired()) {
              if (logger.isLoggable(Level.INFO)) {
                logger.info("String_Node_Str" + cookieName + "String_Node_Str"+ hostName+ "String_Node_Str"+ cookieValue.getExpires());
              }
              store.removeObject(filePath);
            }
 else {
              if (path.startsWith(cookieValue.getPath())) {
synchronized (this) {
                  Map<String,CookieValue> hostMap=this.transientMapByHost.get(hostName);
                  if (hostMap == null) {
                    hostMap=new HashMap<String,CookieValue>();
                    this.transientMapByHost.put(hostName,hostMap);
                  }
                  hostMap.put(cookieName,cookieValue);
                }
                cookie.setName(cookieName);
                cookie.setValue(cookieValue.getValue());
                cookie.setPath(cookieValue.getPath());
                cookie.setDomain(cookieValue.getDomain());
                cookies.add(cookie);
              }
 else {
                if (logger.isLoggable(Level.INFO)) {
                  logger.info("String_Node_Str" + cookieValue + "String_Node_Str"+ path);
                }
              }
            }
          }
 else {
            logger.warning("String_Node_Str" + cookieName + "String_Node_Str");
          }
        }
      }
    }
  }
 catch (  IOException ioe) {
    logger.log(Level.SEVERE,"String_Node_Str",ioe);
  }
catch (  ClassNotFoundException cnf) {
    logger.log(Level.SEVERE,"String_Node_Str",cnf);
  }
  return cookies;
}

Fixed version (ground truth):
/** 
 * Gets cookies belonging exactly to the host name given, not to a broader domain.
 * @param hostName the host name
 * @param path the path
 * @return the cookies strict
 */
private Collection<Cookie> getCookiesStrict(String hostName,String path){
  if ((path == null) || (path.length() == 0)) {
    path="String_Node_Str";
  }
  boolean liflag=logger.isLoggable(Level.INFO);
  Collection<Cookie> cookies=new LinkedList<Cookie>();
  Set<String> transientCookieNames=new HashSet<String>();
synchronized (this) {
    Map<String,CookieValue> hostMap=this.transientMapByHost.get(hostName);
    if (hostMap != null) {
      Iterator<Map.Entry<String,CookieValue>> i=hostMap.entrySet().iterator();
      while (i.hasNext()) {
        Map.Entry<String,CookieValue> entry=i.next();
        CookieValue cookieValue=entry.getValue();
        if (cookieValue.isExpired()) {
          if (liflag) {
            logger.info("String_Node_Str" + entry.getKey() + "String_Node_Str"+ hostName+ "String_Node_Str"+ cookieValue.getExpires());
          }
        }
 else {
          if (path.startsWith(cookieValue.getPath())) {
            String cookieName=entry.getKey();
            transientCookieNames.add(cookieName);
            Cookie cookie=new Cookie();
            cookie.setName(cookieName);
            cookie.setValue(cookieValue.getValue());
            cookie.setPath(cookieValue.getPath());
            cookie.setDomain(cookieValue.getDomain());
            cookies.add(cookie);
          }
 else {
            if (liflag) {
              logger.info("String_Node_Str" + cookieValue + "String_Node_Str"+ path);
            }
          }
        }
      }
    }
  }
  try {
    RestrictedStore store=StorageManager.getInstance().getRestrictedStore(hostName,false);
    if (store != null) {
      Collection paths;
      paths=store.getPaths(COOKIE_PATH_PATTERN);
      Iterator pathsIterator=paths.iterator();
      while (pathsIterator.hasNext()) {
        String filePath=(String)pathsIterator.next();
        String cookieName=this.getCookieNameFromPath(filePath);
        if (!transientCookieNames.contains(cookieName)) {
          CookieValue cookieValue=(CookieValue)store.retrieveObject(filePath);
          if (cookieValue != null) {
            if (cookieValue.isExpired()) {
              if (logger.isLoggable(Level.INFO)) {
                logger.info("String_Node_Str" + cookieName + "String_Node_Str"+ hostName+ "String_Node_Str"+ cookieValue.getExpires());
              }
              store.removeObject(filePath);
            }
 else {
              if (path.startsWith(cookieValue.getPath())) {
synchronized (this) {
                  Map<String,CookieValue> hostMap=this.transientMapByHost.get(hostName);
                  if (hostMap == null) {
                    hostMap=new HashMap<String,CookieValue>();
                    this.transientMapByHost.put(hostName,hostMap);
                  }
                  hostMap.put(cookieName,cookieValue);
                }
                cookie.setName(cookieName);
                cookie.setValue(cookieValue.getValue());
                cookie.setPath(cookieValue.getPath());
                cookie.setDomain(cookieValue.getDomain());
                cookies.add(cookie);
              }
 else {
                if (logger.isLoggable(Level.INFO)) {
                  logger.info("String_Node_Str" + cookieValue + "String_Node_Str"+ path);
                }
              }
            }
          }
 else {
            logger.warning("String_Node_Str" + cookieName + "String_Node_Str");
          }
        }
      }
    }
  }
 catch (  IOException ioe) {
    logger.log(Level.SEVERE,"String_Node_Str",ioe);
  }
catch (  ClassNotFoundException cnf) {
    logger.log(Level.SEVERE,"String_Node_Str",cnf);
  }
  return cookies;
}