Program: 44877
Project: 44877
Buggy source:
/** 
 * Finds the resource with the given path and returns a URL pointing to its location, or <code>null</code> if the resource couldn't be located. The given <code>ClassLoader</code> is used for locating the resource. <p>The given resource path must be forward slash (<code>/</code>) separated. It may or may not start with a leading forward slash character, this doesn't affect the way it is interpreted.</p> <p>The <code>rootPackageFile</code> argument can be used to limit the scope of the search to a specific location (JAR file or directory) in the classpath: resources located outside of this location will not be matched. This avoids potential ambiguities that can arise if the specified resource path exists in several locations. If this parameter is <code>null</code>, the resource is looked up in the whole class path. In that case and if several resources with the specified path exist, the choice of the resource to return is arbitrary.</p>
 * @param path forward slash-separated path to the resource to look for, relative to the parent classpathlocation (directory or JAR file) that contains it.
 * @param classLoader the ClassLoader used for locating the resource. May not be <code>null</code>.
 * @param rootPackageFile root package location (JAR file or directory) that limits the scope of the search,<code>null</code> to look for the resource in the whole class path.
 * @return a URL pointing to the resource, or <code>null</code> if the resource couldn't be located
 */
public static URL getResourceAsURL(String path,ClassLoader classLoader,AbstractFile rootPackageFile){
  path=removeLeadingSlash(path);
  if (rootPackageFile == null)   return classLoader.getResource(path);
  String separator=rootPackageFile.getSeparator();
  if (!separator.equals("String_Node_Str"))   path=StringUtils.replaceCompat(path,"String_Node_Str",separator);
  try {
    Enumeration resourceEnum=classLoader.getResources(removeLeadingSlash(path));
    String rootPackagePath=rootPackageFile.getAbsolutePath();
    String resourcePath=rootPackageFile.getAbsolutePath(true) + path;
    URL resourceURL;
    while (resourceEnum.hasMoreElements()) {
      resourceURL=(URL)resourceEnum.nextElement();
      if ("String_Node_Str".equals(resourceURL.getProtocol())) {
        if (getJarFilePath(resourceURL).equals(rootPackagePath))         return resourceURL;
      }
 else {
        if (normalizeUrlPath(getDecodedURLPath(resourceURL)).equals(resourcePath))         return resourceURL;
      }
    }
  }
 catch (  IOException e) {
    FileLogger.fine("String_Node_Str" + path,e);
    return null;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Finds the resource with the given path and returns a URL pointing to its location, or <code>null</code> if the resource couldn't be located. The given <code>ClassLoader</code> is used for locating the resource. <p>The given resource path must be forward slash (<code>/</code>) separated. It may or may not start with a leading forward slash character, this doesn't affect the way it is interpreted.</p> <p>The <code>rootPackageFile</code> argument can be used to limit the scope of the search to a specific location (JAR file or directory) in the classpath: resources located outside of this location will not be matched. This avoids potential ambiguities that can arise if the specified resource path exists in several locations. If this parameter is <code>null</code>, the resource is looked up in the whole class path. In that case and if several resources with the specified path exist, the choice of the resource to return is arbitrary.</p>
 * @param path forward slash-separated path to the resource to look for, relative to the parent classpathlocation (directory or JAR file) that contains it.
 * @param classLoader the ClassLoader used for locating the resource. May not be <code>null</code>.
 * @param rootPackageFile root package location (JAR file or directory) that limits the scope of the search,<code>null</code> to look for the resource in the whole class path.
 * @return a URL pointing to the resource, or <code>null</code> if the resource couldn't be located
 */
public static URL getResourceAsURL(String path,ClassLoader classLoader,AbstractFile rootPackageFile){
  path=removeLeadingSlash(path);
  if (rootPackageFile == null)   return classLoader.getResource(path);
  String separator=rootPackageFile.getSeparator();
  String nativePath;
  if (separator.equals("String_Node_Str"))   nativePath=path;
 else   nativePath=StringUtils.replaceCompat(path,"String_Node_Str",separator);
  try {
    Enumeration resourceEnum=classLoader.getResources(path);
    String rootPackagePath=rootPackageFile.getAbsolutePath();
    String resourcePath=rootPackageFile.getAbsolutePath(true) + nativePath;
    URL resourceURL;
    while (resourceEnum.hasMoreElements()) {
      resourceURL=(URL)resourceEnum.nextElement();
      if ("String_Node_Str".equals(resourceURL.getProtocol())) {
        if (getJarFilePath(resourceURL).equals(rootPackagePath))         return resourceURL;
      }
 else {
        if (normalizeUrlPath(getDecodedURLPath(resourceURL)).equals(resourcePath))         return resourceURL;
      }
    }
  }
 catch (  IOException e) {
    FileLogger.fine("String_Node_Str" + path,e);
    return null;
  }
  return null;
}