Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-395

GroovyClassLoader fails to resolve .groovy files in classpath on win32

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0-beta-5
    • None
    • None

    Description

      in GroovyClassLoader#expandClassPath the ClassLoader will try to expand the absolute path from C:\ to \C:\ on win32.

      Here's the fix:

      private void expandClassPath(List pathList, String base, String classpath) {
      paths = classpath.split(File.pathSeparator);
      for (int i = 0; i < paths.length; i++) {
      File path = null;

      if ("".equals(base))

      { path = new File(paths[i]); }

      else

      { path = new File(base, paths[i]); }

      if (path.exists()) {
      if (!path.isDirectory()) {
      try

      { // Get the manifest classpath entry from the jar JarFile jar = new JarFile(path); pathList.add(paths[i]); Manifest manifest = jar.getManifest(); Attributes classPathAttributes = manifest.getMainAttributes(); String manifestClassPath = classPathAttributes.getValue("Class-Path"); if (manifestClassPath != null) expandClassPath(pathList, paths[i], manifestClassPath); }

      catch (IOException e)

      { // Bad jar, ignore continue; }

      } else

      { pathList.add(paths[i]); }

      }
      }
      }

      Sorry, I don't know how to create a real diff. This also includes an NPE fix whenever a jar file is missing a Class-Path manifest entry we are not going to try to expand the classpath.

      Attachments

        Activity

          People

            Unassigned Unassigned
            maniax Thomas Heller
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: