Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 311962

Summary: [repo] should Repository Managers be throwing IAE for invalid URL's?
Product: [Eclipse Project] Equinox Reporter: Susan McCourt <susan>
Component: p2Assignee: P2 Inbox <equinox.p2-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: irbull, pascal
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug

Description Susan McCourt CLA 2010-05-06 15:32:22 EDT
During 3.6 RC1, we ran into bug 311338 because the Helios staging site had an invalid repository reference location.

While walking repo references, the client-side code was calling manager.contains(URI location).  It hit the IAE and the consequence of this bad location was severe from a user point of view - you get an error dialog with an IAE with no understanding of where the location came from.

This is problematic for several reasons
- the javadoc for manager.contains(URI) doesn't mention that an IAE can be thrown.  In fact one would assume from the javadoc that a bogus location would simply return "false".
- if an exception should be thrown when validating locations, it should be a checked exception so that callers know to be prepared for it.  As it is, API clients can get burned by this, and any refactoring inside the repo manager code could introduce this into other API, etc.
- I think that checkValidLocation should throw a checked exception (URISyntaxException?) and then inside the repository manager it can be determined on a case by case basis whether the exception is thrown by API methods that use this method, or whether it's caught.  For example, for manager.contains, I would expect the exception to be caught and then return false.

We may want to introduce a logging/debug flag so that invalid locations are logged in debug mode.  This way, if there are sites with bad references, etc. then they could be logged.

In this case, the bad location came in via reference.  Even better would be for the repo manager to check the validity of the location when it encountered the bad reference, log it there, and then not keep the reference.  One could argue that if the repo manager thinks it's a bad URI, why did it hang onto the location for clients to manipulate?
Comment 1 Eclipse Webmaster CLA 2019-09-06 16:19:20 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
Comment 2 Eclipse Genie CLA 2021-09-02 12:02:16 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.