Page MenuHomePhabricator

Unknown file extension causes Command Line Modules to throw errors.
Closed, ResolvedPublic

Description

All output files from a command line module get automatically loaded when the command line module finishes. However, if the file extension is unrecognised it obviously cant be loaded.

In MITK 2014.03, this was simply a warning message to console.
In MITK 2014.10, an exception is thrown.

It may well be the case that a command line module generates output such as .csv files. Clearly these should not even be attempted to be automatically reloaded.

So, we should check the file extension before attempting to load.

Event Timeline

Agreed. Could we just catch the execption and log a warning, emulation the 2014.10 behaviour?

Looks okay to me. Was there a special reason for using the LoadInfo object instead of just catching mitk::Exception from the IOUtil::Load() call?

Not really. I just try to avoid exceptions if I can. In Java it used to be quite expensive to raise exceptions. Maybe this is an invalid approach now. I am getting old after all.

I see ;-)

Unfortunately, we should still catch the exception because the LoadInfo "trick" does not mean that there won't be an exception during the IOUtil::Load() call. The reader could still encounter errors when actually reading the file.

Yes, looks good to me. Thanks for working on this! I could merge a PR today.

Add the moment I have no program with which to test it.

I was wanting John Hipwell (UCL) to test it. But he's not available today.

Hi Sascha,

i iterated a bit in testing, and ended up here:

https://github.com/MITK/MITK/pull/97

Matt

[71e2eb]: Merge branch 'bug-18819-check-file-extension' of https://github.com/Ma

Merged commits:

2015-03-06 11:13:09 Matt Clarkson [933db1]
Check file extension, and use try/catch for CLI module.