Program: 74018
Project: 74018
Buggy source:
/** 
 * Open up a file, return a list of relative or absolute URLs that match a regexp.
 * @param demosURL The URL of the file containing URLs.
 * @param regexp The regular expression, for example ".*.xml$".
 * @param absoluteURLs True if we should return absolute URLs.
 * @param depth Depth to recurse.  Depth of 0 do not recurse.Recursing only makes sense if the regexp argument includes .htm* files: ".*(.htm|.html|.xml)"
 * @return a list of Strings naming absolute or relative URLs.
 */
private static List _getURLs(URL demosURL,String regexp,boolean absoluteURLs,int depth) throws IOException {
  StringBuffer demosBuffer=new StringBuffer();
  BufferedReader in=null;
  String demosURLParent=demosURL.toString().substring(0,demosURL.toString().lastIndexOf("String_Node_Str") + 1);
  try {
    in=new BufferedReader(new InputStreamReader(demosURL.openStream()));
    String inputLine;
    while ((inputLine=in.readLine()) != null) {
      demosBuffer.append(inputLine);
    }
  }
 catch (  Exception ex) {
    System.out.println("String_Node_Str" + demosURL + "String_Node_Str"+ ex);
    return new LinkedList();
  }
 finally {
    if (in != null) {
      in.close();
    }
  }
  String demos=demosBuffer.toString();
  List modelList=new LinkedList();
  int modelStartIndex=demos.indexOf("String_Node_Str");
  while (modelStartIndex != -1) {
    int modelEndIndex=demos.indexOf("String_Node_Str",modelStartIndex + 6);
    if (modelEndIndex != -1) {
      String modelLink=demos.substring(modelStartIndex + 6,modelEndIndex);
      if (!modelLink.startsWith("String_Node_Str") && modelLink.matches(regexp)) {
        String model=modelLink;
        if (absoluteURLs) {
          model=demosURLParent + modelLink;
          Exception ex1=null;
          try {
            model=(new URI(demosURLParent + modelLink)).normalize().getPath();
            model=new File(model).toString().replace('\\','/');
          }
 catch (          URISyntaxException ex) {
            ex1=ex;
          }
catch (          NullPointerException ex2) {
          }
          if (model == null) {
            try {
              model=MoMLApplication.specToURL(modelLink).toString();
            }
 catch (            Exception ex) {
              if (modelLink.startsWith("String_Node_Str")) {
                modelLink=modelLink.substring(1);
                try {
                  model=MoMLApplication.specToURL(modelLink).toString();
                }
 catch (                Exception ex2) {
                }
              }
 else {
                String absoluteModelLink=demosURLParent + modelLink;
                try {
                  model=MoMLApplication.specToURL(absoluteModelLink).toString();
                }
 catch (                Exception ex3) {
                  System.out.println("String_Node_Str" + demosURLParent + modelLink+ "String_Node_Str"+ modelLink+ "String_Node_Str"+ absoluteModelLink+ "String_Node_Str"+ ex1+ "String_Node_Str"+ ex3);
                }
              }
            }
          }
        }
        if (model != null) {
          URL modelURL=null;
          if (model.startsWith("String_Node_Str")) {
            modelURL=new URL(model);
          }
 else {
            if (model.startsWith("String_Node_Str")) {
              model=model.substring("String_Node_Str".length());
            }
            modelURL=new File(model).toURI().toURL();
          }
          boolean sawModel=modelList.contains(model);
          if (!sawModel) {
            modelList.add(model);
            if (depth > 0 && model.matches("String_Node_Str")) {
              modelList.addAll(_getURLs(modelURL,regexp,absoluteURLs,depth - 1));
            }
          }
        }
      }
    }
    modelStartIndex=demos.indexOf("String_Node_Str",modelEndIndex);
  }
  return modelList;
}

Fixed version (ground truth):
/** 
 * Open up a file, return a list of relative or absolute URLs that match a regexp.
 * @param demosURL The URL of the file containing URLs.
 * @param regexp The regular expression, for example ".*.xml$".
 * @param absoluteURLs True if we should return absolute URLs.
 * @param depth Depth to recurse.  Depth of 0 do not recurse.Recursing only makes sense if the regexp argument includes .htm* files: ".*(.htm|.html|.xml)"
 * @return a list of Strings naming absolute or relative URLs.
 */
private static List _getURLs(URL demosURL,String regexp,boolean absoluteURLs,int depth) throws IOException {
  StringBuffer demosBuffer=new StringBuffer();
  BufferedReader in=null;
  String demosURLParent=demosURL.toString().substring(0,demosURL.toString().lastIndexOf("String_Node_Str") + 1);
  try {
    in=new BufferedReader(new InputStreamReader(demosURL.openStream()));
    String inputLine;
    while ((inputLine=in.readLine()) != null) {
      demosBuffer.append(inputLine);
    }
  }
 catch (  Exception ex) {
    System.out.println("String_Node_Str" + demosURL + "String_Node_Str"+ ex);
    return new LinkedList();
  }
 finally {
    if (in != null) {
      in.close();
    }
  }
  String demos=demosBuffer.toString();
  List modelList=new LinkedList();
  int modelStartIndex=demos.indexOf("String_Node_Str");
  while (modelStartIndex != -1) {
    int modelEndIndex=demos.indexOf("String_Node_Str",modelStartIndex + 6);
    if (modelEndIndex != -1) {
      String modelLink=demos.substring(modelStartIndex + 6,modelEndIndex);
      if (!modelLink.startsWith("String_Node_Str") && modelLink.matches(regexp)) {
        String model=modelLink;
        if (absoluteURLs) {
          model=demosURLParent + modelLink;
          Exception ex1=null;
          try {
            model=(new URI(demosURLParent + modelLink)).normalize().getPath();
            model=new File(model).toString().replace('\\','/');
          }
 catch (          URISyntaxException ex) {
            ex1=ex;
          }
catch (          NullPointerException ex2) {
          }
          if (model == null) {
            try {
              model=MoMLApplication.specToURL(modelLink).toString();
            }
 catch (            Exception ex) {
              if (modelLink.startsWith("String_Node_Str")) {
                modelLink=modelLink.substring(1);
                try {
                  model=MoMLApplication.specToURL(modelLink).toString();
                }
 catch (                Exception ex2) {
                  System.out.println("String_Node_Str" + demosURLParent + modelLink+ "String_Node_Str"+ modelLink+ "String_Node_Str"+ ex2);
                }
              }
 else {
                String absoluteModelLink=demosURLParent + modelLink;
                try {
                  model=MoMLApplication.specToURL(absoluteModelLink).toString();
                }
 catch (                Exception ex3) {
                  System.out.println("String_Node_Str" + demosURLParent + modelLink+ "String_Node_Str"+ modelLink+ "String_Node_Str"+ absoluteModelLink+ "String_Node_Str"+ ex1+ "String_Node_Str"+ ex3);
                }
              }
            }
          }
        }
        if (model != null) {
          URL modelURL=null;
          if (model.startsWith("String_Node_Str")) {
            modelURL=new URL(model);
          }
 else {
            if (model.startsWith("String_Node_Str")) {
              model=model.substring("String_Node_Str".length());
            }
            modelURL=new File(model).toURI().toURL();
          }
          boolean sawModel=modelList.contains(model);
          if (!sawModel) {
            modelList.add(model);
            if (depth > 0 && model.matches("String_Node_Str")) {
              modelList.addAll(_getURLs(modelURL,regexp,absoluteURLs,depth - 1));
            }
          }
        }
      }
    }
    modelStartIndex=demos.indexOf("String_Node_Str",modelEndIndex);
  }
  return modelList;
}