Uploaded image for project: 'Opencast'
  1. MH-10523

Misleading exception parameter in getFileFromCollection

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed and reviewed
    • Affects Version/s: 1.6.0, 2.3.3, 3.0
    • Fix Version/s: 3.2
    • Component/s: Backend Software
    • Labels:
      None
    • Severity:
      Incorrectly Functioning With Workaround
    • Steps to reproduce:
      Hide
      getFileFromCollection(String collectionId, String fileName) in WorkingFileRepositoryImpl.java has this code:

      directory = getCollectionDirectory(collectionId, false);
      if (directory == null)
              throw new NotFoundException(fileName);

      This is misleading because the log error is then

      org.opencastproject.util.NotFoundException: 175.mkv
              at org.opencastproject.workingfilerepository.impl.WorkingFileRepositoryImpl.getFileFromCollection(WorkingFileRepositoryImpl.java:453)

      but the NotFoundException refers to the path, not the filename.

      So this should be:

              throw new NotFoundException(collectionId);

      and the exception below in the same function should also be amended to be more descriptive, e.g.:

       if (!sourceFile.exists()) {
            throw new NotFoundException(sourceFile);

       if (!md5File.exists()) {
            throw new NotFoundException(md5File);
      Show
      getFileFromCollection(String collectionId, String fileName) in WorkingFileRepositoryImpl.java has this code: directory = getCollectionDirectory(collectionId, false); if (directory == null)         throw new NotFoundException(fileName); This is misleading because the log error is then org.opencastproject.util.NotFoundException: 175.mkv         at org.opencastproject.workingfilerepository.impl.WorkingFileRepositoryImpl.getFileFromCollection(WorkingFileRepositoryImpl.java:453) but the NotFoundException refers to the path, not the filename. So this should be:         throw new NotFoundException(collectionId); and the exception below in the same function should also be amended to be more descriptive, e.g.:  if (!sourceFile.exists()) {       throw new NotFoundException(sourceFile);  if (!md5File.exists()) {       throw new NotFoundException(md5File);

      TestRail: Results

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                smarquard Stephen Marquard
                Reporter:
                smarquard Stephen Marquard
              • Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  TestRail: Cases