-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add local artifact repositories for resolution #883
Conversation
ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/P2TargetUtils.java
Outdated
Show resolved
Hide resolved
findWorkspaceRepos(result); | ||
if (Boolean.parseBoolean(System.getProperty("pde.usePoolsInfo", "true"))) { //$NON-NLS-1$ //$NON-NLS-2$ | ||
try { | ||
result.addAll(RepositoryHelper.getSharedBundlePools().stream().map(Path::toUri).toList()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to fail to add any shared bundle pool if a single Path.toUri throws an exception? Or should the try-catch be on a basis of a single pool?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's so much prettier with streams. 😱
Realistically 99.99% of the people (likely an huge under-estimate) have only one pool, and it is 0% likely that any of the paths cannot be converted to URIs because all hell would have broken loose long before p2/PDE ever reads them.
So technically yes, but realistically, not really.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say that actually it should never fail, otherwise the file is corrupted (e.g. wrong encoding) and it should be fixed.
So I would say it is ok to fail for all, but the catched exception should be logged instead so that a users notices the corruption: PDECore.log(Status.error("Failed to load shared bundle-pool locations",e));
or similar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@laeubi was suggesting that maybe getSharedBundlePools should handle/log all the exceptions
eclipse-equinox/p2#377 (comment)
I tend to agree with him. What about you?
In any case, this commit was about using IRepositoryManager.REPOSITORIES_LOCAL
and removing the condition. 😱
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to agree with him. What about you?
If all exceptions are handled there, I'm fine with that as well. But that should include the conversion to URIs.
If Oomph also needs a URI, it would make sense to handle all exceptions there, if there a different demands it is better handled by the callers (since they need some handling any ways).
In any case, this commit was about using IRepositoryManager.REPOSITORIES_LOCAL and removing the condition. 😱
Yes that's right. Nevertheless it would be good to find some kind of agreement on this quickly to reduce the trouble of multiple versions. 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have this change pending:
As such the only possible exception here is from the toURI call, but note that the called method has done an isDirectory test so I don't think we need to worry about to URI failing for an existing directory and needing to log it...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And no, I don't want to convert to URIs in that method because I think it's important that these things are locations in the file system which is no longer clear/obvious when they are returned as URIs.
I think at some point here I will need to draw the line and call it done. Folks can continue do whatever they like. One may wish to revisit a number of things including things like this: 🙈
eclipse.pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/P2TargetUtils.java
Lines 1502 to 1504 in e7d05ff
} catch (CoreException e) { | |
// if there is a problem, move on. Could log something here | |
return; |
The chance that toURI will fail for a Path for which isDirectory is true, where the value is the bundle pool used for all installations is pretty much zero, so talking about the value of logging that information is probably wasted breath. 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As such the only possible exception here is from the toURI call, but note that the called method has done an isDirectory test so I don't think we need to worry about to URI failing for an existing directory and needing to log it...
Makes sense.
Looking at the Java-doc of Path.toUri()
I see only:
* @throws java.io.IOError
* if an I/O error occurs obtaining the absolute path, or where a
* file system is constructed to access the contents of a file as
* a file system, and the URI of the enclosing file system cannot be
* obtained
*
* @throws SecurityException
* In the case of the default provider, and a security manager
* is installed, the {@link #toAbsolutePath toAbsolutePath} method
* throws a security exception.
Both are more fundamental problems that will probably apply to all paths and I don't expect any other than the default file-systems to be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's important that these things are locations in the file system which is no longer clear/obvious when they are returned as URIs
A Path can be a remote filesystem or even a virtual one... actually Path
= URI
+ Browsing Capability
+ (optional) Watcher
;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true. Even an archive has Paths to access it.
Test Results 264 files - 6 264 suites - 6 43m 9s ⏱️ - 18m 20s For more details on these failures, see this check. Results for commit 6957e78. ± Comparison against base commit e7d05ff. ♻️ This comment has been updated with latest results. |
Fixes #881