[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] Use of ProvisionException.REPOSITORY_NOT_FOUND?

Thanks John,
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:


Which tests fail? Can you point out the failure, or attach a patch somewhere with your changes that cause test failures? The only important distinction is that a NOT_FOUND exception will cause the repository manager to keep trying with another repository type, whereas other exceptions will result in the repository manager not trying another repository type (because the repository is there, but there were problems reading it). See the javadoc in MetadataRepositoryFactory#load for details.




Henrik Lindberg <henrik.lindberg@xxxxxxxxxxxxxx>
Sent by: p2-dev-bounces@xxxxxxxxxxx

03/11/2009 10:01 PM

Please respond to
P2 developer discussions <p2-dev@xxxxxxxxxxx>

To
P2 developer discussions <p2-dev@xxxxxxxxxxx>
cc
Subject
[p2-dev] Use of ProvisionException.REPOSITORY_NOT_FOUND?





When testing repository loading and using invalid URI's to test errors  
- tests fail if the Status.getCode() is not REPOSITORY_NOT_FOUND.
I saw one comment that said that "this status code is expected, since  
all others will be logged".

I wonder how the status codes should be used? There are codes for  
ACCESS denied, INVALID location, etc. Wouldn't it be more appropriate  
to use those when the
cause is known? I now have statuses with more details working, and I  
selected what I thought were suitable codes from ProvisionException  
only to find that tests fail...

Can someone shed some light on how it is supposed to work?

Henrik Lindberg
henrik.lindberg@xxxxxxxxxxxxxx


_______________________________________________
p2-dev mailing list
p2-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/p2-dev

_______________________________________________
p2-dev mailing list
p2-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/p2-dev