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

Workaround fix for checking mod time for file:// URL

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-3
    • 1.0-JSR-4
    • None
    • None

    Description

      Fix for GroovyClassLoader to allow it to detect changed sources for file:// urls:

      <snip>
      private boolean isSourceNewer(URL source, Class cls) throws IOException {
      long lastMod;

      //
      // Special handling for file:// protocol, as getLastModified() often reports
      // incorrect results (-1)
      //
      if (source.getProtocol().equals("file"))

      { // Coerce the file URL to a File String path = source.getPath().replace('/', File.separatorChar).replace('|', ':'); File file = new File(path); lastMod = file.lastModified(); }

      else

      { lastMod = source.openConnection().getLastModified(); }

      return lastMod > getTimeStamp(cls);
      }
      </snip>

      Attachments

        Activity

          People

            guillaume Guillaume Sauthier
            jason@planet57.com Jason Dillon
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: