Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Suspected inconsistencies in URIHandler.exist
Suspected inconsistencies in URIHandler.exist [message #1849829] Thu, 03 February 2022 16:50 Go to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hello,

when we tried to decouple our code from concrete file system implementations (java.io, org.eclipse.core.resources), we thought it might be a great idea to base most of the IO work on the abstraction of URIs and URIConverter.
After all, URIConverter offers almost everything one needs to work with resources.

When we were testing this in an Eclipse environment that also uses virtual folders, we figured some inconsistencies between the PlatformResourceURIHandlerImpl and FileURIHandlerImpl.

The FileURIHandlerImpl will happily answer a query for exists() with true, if it refers to a directory, whereas the PlatformResourceURIHandlerImpl doesn't agree to that for virtual folders. It resorts to the WorkbenchHelper

    public static boolean exists(String platformResourcePath, Map<?, ?> options)
    {
      IResource resource = getWorkspaceRoot().findMember(new Path(platformResourcePath));
      return resource != null && resource.getResourceAttributes() != null;
    }


Is there a reason why this isn't implemented by means of `resource.exists()` but rejects virtual resources?
Re: Suspected inconsistencies in URIHandler.exist [message #1849841 is a reply to message #1849829] Fri, 04 February 2022 08:07 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33143
Registered: July 2009
Senior Member
Is the problem that's it's null because the resource is not local? I'm not sure what virtual means and I see that org.eclipse.core.resources.IResource.isLocal(int) is deprecated without replacement.

What do you think should be changed? Use org.eclipse.core.resources.IResource.isAccessible()?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Suspected inconsistencies in URIHandler.exist [message #1849845 is a reply to message #1849841] Fri, 04 February 2022 09:34 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Ed,

thank you for the quick feedback. I'd think that `IResource.isAccessible()` would indeed be a proper replacement and would be in line with what I'd expect the URIConverter to respond to exists().
We'll probably do some experiments with a locally patched ExtendURIConverter with a replaced specialization of the PlatformResourceURIHandlerImpl. I'll report back here.

Best
Sebastian


Re: Suspected inconsistencies in URIHandler.exist [message #1849852 is a reply to message #1849845] Fri, 04 February 2022 16:23 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Rather than patching EMF, you can install your own 'better' URIHandler in front of / instead of the standard in ExtensibleURIConverterImpl.getContentHandlers.

Regards

Ed Willink
Re: Suspected inconsistencies in URIHandler.exist [message #1849883 is a reply to message #1849852] Mon, 07 February 2022 12:13 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Ed,

> install your own 'better' URIHandler in front of / instead of the standard in ExtensibleURIConverterImpl.getContentHandlers.

yes, that's what I meant by locally patched.

Best
Sebastian
Previous Topic:[CDO] Rare problem in permission cache
Next Topic:how to make a ComboView not selectable
Goto Forum:
  


Current Time: Thu May 02 00:59:45 GMT 2024

Powered by FUDForum. Page generated in 0.03490 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top