Misleading exception parameter in getFileFromCollection

Steps to reproduce

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);

Activity

Show:
Karen Dolan
January 2, 2018, 1:40 PM

Hi Stephen, do you know if this is also fixed in 4x?

Fixed and reviewed

Assignee

Stephen Marquard

Reporter

Stephen Marquard

Severity

Incorrectly Functioning With Workaround

Tags (folksonomy)

None

Components

Fix versions

Affects versions

Priority

Major