|Re: [p2-dev] Use of ProvisionException.REPOSITORY_NOT_FOUND?|
Question is which exceptions to interpret as "not found". The current impl (before patch in 216278) hides many of these issues - for instance, the cache manager will look for a jar and an xml file, and determines their existence via a call to Transport.getLastModified, and this method returns 0 when there is an error, and this is interpreted as a "file not found" - but it could just as well be a "unknown host", or "connection refused".
In the patch, the getLastModified throws exceptions on errors so they can be reported to the user.
The test that failed was: MetadataRepositoryManagerTest.testFailedConnection() it tries to connect to "invalid://eclipse" - which my patch originally reported as a REPOSITORY_FAILED_READ, but the test wants REPOSITORY_NOT_FOUND. The test is wrong if the authoritative interpretation of "invalid:" should be made by ECF, but is correct if a meta data repository loader could determine that "invalid:" is in fact a scheme that it understands and the test to determine which loader to load the repo is performed by trying to load using this URI. If in fact, it is the repository loader that decides, then all repositories should typically return REPOSITORY_NOT_FOUND, because they do not know if some other repository wants to try to connect to a repo on a special port, with (additional) parameters, or indeed always add an "x" to the hostname (or something equally crazy).
I suspect that the intention is that repositories decide, and that the only errors that should be reported as "FAILED_READ" are IO errors when reading the "found file(s)".
On Mar 16, 2009, at 3:08 PM, John Arthorne wrote: