Program: 44899
Project: 44899
Buggy source:
/** 
 * Returns a canonical value of the given path, where '.' and '..' path fragments are factored out, and '~' replaced by the specified value (if not <code>null</code>).
 * @param path the path to canonize
 * @param separator the path separator to use that delimits path fragments.
 * @param tildeReplacement if the specified value is not null, it is used to replace path fragments equal to '~'
 * @return the canonized path
 * @throws MalformedURLException if the path is invalid
 */
protected String canonizePath(String path,String separator,String tildeReplacement) throws MalformedURLException {
  if (!path.equals("String_Node_Str")) {
    int pos;
    int pos2=0;
    String dir;
    String dirWS;
    Vector pathV=new Vector();
    while ((pos=pos2) != -1) {
      pos2=path.indexOf(separator,pos);
      if (pos2 == -1) {
        dir=path.substring(pos);
        dirWS=dir;
      }
 else {
        dir=path.substring(pos,++pos2);
        dirWS=dir.substring(0,dir.length() - 1);
      }
      if ((dirWS.equals("String_Node_Str") && pathV.size() > 0) || dirWS.equals("String_Node_Str")) {
        continue;
      }
 else       if (dirWS.equals("String_Node_Str")) {
        if (pathV.size() == 0)         throw new MalformedURLException();
        pathV.removeElementAt(pathV.size() - 1);
        continue;
      }
 else       if (dirWS.equals("String_Node_Str") && (tildeReplacement != null)) {
        path=path.substring(0,pos) + tildeReplacement + path.substring(pos + 1);
        pos2=pos;
        continue;
      }
      pathV.add(dir);
    }
    path="String_Node_Str";
    int nbDirs=pathV.size();
    for (int i=0; i < nbDirs; i++)     path+=pathV.elementAt(i);
  }
  return path;
}

Fixed version (ground truth):
/** 
 * Returns a canonical value of the given path, where '.' and '..' path fragments are factored out, and '~' replaced by the specified value (if not <code>null</code>).
 * @param path the path to canonize
 * @param separator the path separator to use that delimits path fragments.
 * @param tildeReplacement if the specified value is not null, it is used to replace path fragments equal to '~'
 * @return the canonized path
 * @throws MalformedURLException if the path is invalid
 */
protected String canonizePath(String path,String separator,String tildeReplacement) throws MalformedURLException {
  if (!path.equals("String_Node_Str")) {
    int pos;
    int pos2=0;
    int separatorLen=separator.length();
    String dir;
    String dirWS;
    Vector pathV=new Vector();
    while ((pos=pos2) != -1) {
      pos2=path.indexOf(separator,pos);
      if (pos2 == -1) {
        dir=path.substring(pos);
        dirWS=dir;
      }
 else {
        pos2+=separatorLen;
        dir=path.substring(pos,separatorLen);
        dirWS=dir.substring(0,dir.length() - separatorLen);
      }
      if ((dirWS.equals("String_Node_Str") && pathV.size() > 0) || dirWS.equals("String_Node_Str")) {
        continue;
      }
 else       if (dirWS.equals("String_Node_Str")) {
        if (pathV.size() == 0)         throw new MalformedURLException();
        pathV.removeElementAt(pathV.size() - 1);
        continue;
      }
 else       if (tildeReplacement != null && dirWS.equals("String_Node_Str")) {
        path=path.substring(0,pos) + tildeReplacement + path.substring(pos + 1);
        pos2=pos;
        continue;
      }
      pathV.add(dir);
    }
    path="String_Node_Str";
    int nbDirs=pathV.size();
    for (int i=0; i < nbDirs; i++)     path+=pathV.elementAt(i);
  }
  return path;
}