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

Bug 365272

Summary: Cannot open UML XMI resource by content description in standalone mode
Product: [Modeling] MDT.UML2 Reporter: Ed Willink <ed>
Component: CoreAssignee: UML2 Inbox <mdt-uml2-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3    
Version: 3.2.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description Ed Willink CLA 2011-12-01 02:32:50 EST
I've developed a UML init that replicates most of the Eclipse init but fall foul of the temporary ResourceSet in XMI222UMLResourceFactoryImpl.createResource that prevents my URI mapping for platform:/plugin/org.eclipse.uml2.uml/ being used for UML30_2_UML.ecore2xml. I cannot avoid the MalformedURLException: unknown protocol: platform

Any of the following might fix it:

a) for a non-global URIConverter to delegate to the global URI_MAP
- perhaps this is a bug in its own right

b) for the local ResourceSet to copy the prevailing registrations then add its custom ones
- perhaps this would benefit from a ResourceSetImpl clone constructor or EcoreUtil method

c) for the Platform stream support to use the EcorePlugin.getPlatformResourceMap
Comment 1 Kenn Hussey CLA 2011-12-01 22:03:33 EST
As far as I'm aware, a "non-global" URIConverter _does_ delegate to the global URI map, per the following code in ExtensibleURIConverterImpl:

  protected URIMap getInternalURIMap()
  {
    if (uriMap == null)
    {
      URIMappingRegistryImpl mappingRegistryImpl =
        new URIMappingRegistryImpl()
        {
          private static final long serialVersionUID = 1L;

          @Override
          protected URI delegatedGetURI(URI uri)
          {
            return URIMappingRegistryImpl.INSTANCE.getURI(uri);
          }
        };

      uriMap = (URIMap)mappingRegistryImpl.map();
    }

    return uriMap;
  }

Is this not happening for you? Are you sure you've registered the proper mapping in the global URI map?
Comment 2 Ed Willink CLA 2011-12-04 06:58:11 EST
(In reply to comment #1)
> As far as I'm aware, a "non-global" URIConverter _does_ delegate to the global
> URI map, per the following code in ExtensibleURIConverterImpl:
> 
> Is this not happening for you? Are you sure you've registered the proper
> mapping in the global URI map?

It depends on which global URI Map you populate: Bug 365515.

So solution a) is available.
Comment 3 Kenn Hussey CLA 2011-12-05 11:21:36 EST
I guess there's nothing to "fix" in UML2, then.