Program: 29100
Project: 29100
Buggy source:
/** 
 * This method downloads the main wsdl/schema and its imports in to the directory specified and returns the name of downloaded root document.
 * @param httpUrl
 * @param wsdlDir
 * @return Returns the name of the root file downloaded with the invocation.
 * @throws Exception
 */
private String downloadWsdlsAndSchemas(URL httpUrl,File wsdlDir) throws Exception {
  wsdlDir.mkdirs();
  String fileName=httpUrl.toString().substring(httpUrl.toString().lastIndexOf("String_Node_Str") + 1);
  File toFile=new File(wsdlDir.getAbsolutePath() + File.separator + fileName);
  downloadFile(httpUrl,toFile);
  HashSet<Import> wsdlRelativeImports=new HashSet<Import>();
  HashSet<Import> schemaRelativeImports=new HashSet<Import>();
  HashSet<Import> wsdlIncludes=new HashSet<Import>();
  HashSet<Import> schemaIncludes=new HashSet<Import>();
  parseRelativeImports(httpUrl,wsdlRelativeImports,wsdlIncludes,schemaRelativeImports,schemaIncludes);
  wsdlRelativeImports.addAll(wsdlIncludes);
  schemaRelativeImports.addAll(schemaIncludes);
  String urlWithoutFileName=httpUrl.toString().substring(0,httpUrl.toString().lastIndexOf("String_Node_Str"));
  for (  Import next : schemaRelativeImports) {
    String location=next.getLocation();
    location=location.replaceAll("String_Node_Str","String_Node_Str" + File.separator);
    if (location.lastIndexOf(File.separator) != -1) {
      File newDir=new File(wsdlDir.getAbsolutePath() + File.separator + location.substring(0,location.lastIndexOf(File.separator)));
      newDir.mkdirs();
    }
    downloadFile(new URL(urlWithoutFileName + "String_Node_Str" + next.getLocation()),new File(wsdlDir.getAbsolutePath() + File.separator + location));
  }
  for (  Import next : wsdlRelativeImports) {
    String newWsdlLocation=next.getLocation();
    newWsdlLocation=newWsdlLocation.replaceAll("String_Node_Str","String_Node_Str" + File.separator);
    File newWsdlDir;
    if (newWsdlLocation.lastIndexOf(File.separator) != -1) {
      newWsdlDir=new File(wsdlDir.getAbsolutePath() + File.separator + newWsdlLocation.substring(0,newWsdlLocation.lastIndexOf(File.separator)));
    }
 else {
      newWsdlDir=wsdlDir;
    }
    downloadWsdlsAndSchemas(new URL(urlWithoutFileName + "String_Node_Str" + next.getLocation()),newWsdlDir);
  }
  return fileName;
}

Fixed version (ground truth):
/** 
 * This method downloads the main wsdl/schema and its imports in to the directory specified and returns the name of downloaded root document.
 * @param httpUrl
 * @param wsdlDir
 * @return Returns the name of the root file downloaded with the invocation.
 * @throws Exception
 */
private String downloadWsdlsAndSchemas(URL httpUrl,File wsdlDir) throws Exception {
  mkDirs(wsdlDir);
  String fileName=httpUrl.toString().substring(httpUrl.toString().lastIndexOf("String_Node_Str") + 1);
  File toFile=new File(wsdlDir.getAbsolutePath() + File.separator + fileName);
  downloadFile(httpUrl,toFile);
  HashSet<Import> wsdlRelativeImports=new HashSet<Import>();
  HashSet<Import> schemaRelativeImports=new HashSet<Import>();
  HashSet<Import> wsdlIncludes=new HashSet<Import>();
  HashSet<Import> schemaIncludes=new HashSet<Import>();
  parseRelativeImports(httpUrl,wsdlRelativeImports,wsdlIncludes,schemaRelativeImports,schemaIncludes);
  wsdlRelativeImports.addAll(wsdlIncludes);
  schemaRelativeImports.addAll(schemaIncludes);
  String urlWithoutFileName=httpUrl.toString().substring(0,httpUrl.toString().lastIndexOf("String_Node_Str"));
  for (  Import next : schemaRelativeImports) {
    String location=next.getLocation();
    location=location.replaceAll("String_Node_Str","String_Node_Str" + File.separator);
    if (location.lastIndexOf(File.separator) != -1) {
      File newDir=new File(wsdlDir.getAbsolutePath() + File.separator + location.substring(0,location.lastIndexOf(File.separator)));
      mkDirs(newDir);
    }
    downloadFile(new URL(urlWithoutFileName + "String_Node_Str" + next.getLocation()),new File(wsdlDir.getAbsolutePath() + File.separator + location));
  }
  for (  Import next : wsdlRelativeImports) {
    String newWsdlLocation=next.getLocation();
    newWsdlLocation=newWsdlLocation.replaceAll("String_Node_Str","String_Node_Str" + File.separator);
    File newWsdlDir;
    if (newWsdlLocation.lastIndexOf(File.separator) != -1) {
      newWsdlDir=new File(wsdlDir.getAbsolutePath() + File.separator + newWsdlLocation.substring(0,newWsdlLocation.lastIndexOf(File.separator)));
    }
 else {
      newWsdlDir=wsdlDir;
    }
    downloadWsdlsAndSchemas(new URL(urlWithoutFileName + "String_Node_Str" + next.getLocation()),newWsdlDir);
  }
  return fileName;
}