I do have some problems to understand how it exactly should behave in
case of a non existing file. I try to explain.
Referencing the file org.apache.james.repository.file.AbstractFileRepository
a) Method "File getFile(final String key)" [1] declares throwing an
IOException. In fact no code inside the method will ever throw such an
exception. Should this IOException indicate that the file doesn't exists?
b) Method "void remove(final String key)" [2] throws a RuntimeException
if any exception occurs. The only exception which could be thrown inside
the try block is a NullPointerException, which is thrown in a) if the
Method "encode(key)" [3] returns null. This is never the case (it
contains at least 'File.separator'). The only thing what could happen is
that [3] throws a NullPointerException (if 'key' is null). But a)
declares only throwing IOException.
Let b) throw an IOException when unable to delete the file (e.g. file
does not exist) there's a failing test case [4]. This test case has
comment "// removing an unexisting message does not throw/return errors".
My questions:
- Why does a) declares an IOException? IMO this makes only sense if a)
makes a test for file existence.
- Do we just ignore the delete failure in case of not existing file to
delete or is the test case [4] wrong and should expect an IOException?
Thanks
Felix
[1]
https://builds.apache.org/view/G-L/view/James/job/james-server-trunk-site/site/xref/org/apache/james/repository/file/AbstractFileRepository.html#231
[2]
https://builds.apache.org/view/G-L/view/James/job/james-server-trunk-site/site/xref/org/apache/james/repository/file/AbstractFileRepository.html#272
[3]
https://builds.apache.org/view/G-L/view/James/job/james-server-trunk-site/site/xref/org/apache/james/repository/file/AbstractFileRepository.html#330
[4]
https://builds.apache.org/view/G-L/view/James/job/james-server-trunk-site/site/xref-test/org/apache/james/mailrepository/AbstractMailRepositoryTest.html#99
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]