Uploaded image for project: 'Commons Compress'
  1. Commons Compress
  2. COMPRESS-205

Unit tests can fail when path to project is non-trivial (fix in description)

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.5
    • Component/s: None
    • Labels:
      None

      Description

      return factory.createCompressorInputStream(new BufferedInputStream(new FileInputStream(new File(rsc.getFile()))));

      can fail to find the files for testing e.g. /root/.jenkins/jobs/Commons%20Compress/workspace/target/test-classes/test.txt (No such file or directory)

      This can be fixed by simply opening the stream from the URL:

      private CompressorInputStream getStreamFor(String resource)
      throws CompressorException, IOException

      { final URL rsc = classLoader.getResource(resource); assertNotNull("Could not find resource "+resource,rsc); return factory.createCompressorInputStream( new BufferedInputStream(rsc.openStream())); }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dan2097 Daniel Lowe
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: