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

Bug 364909

Summary: MalformedURLException committing
Product: [Modeling] EMFCompare Reporter: Ed Willink <ed>
Component: TeamAssignee: EMF Compare <emf.compare-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: b.muskalla, Ed.Merks, laurent.goubet, remy.suen
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description Ed Willink CLA 2011-11-27 10:09:23 EST
24-Nov N-build: When committing I often get "Error occurred while building scope for committing changes". NB. classpath is a 'proprietary' Xtext scheme. Perhaps this is an Xtext bug, or an EMF compare bug, but why are they even active?

org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: java.net.MalformedURLException: unknown protocol: classpath
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:315)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:397)
	at org.eclipse.xtext.xtext.XtextLinkingService.getUsedGrammar(XtextLinkingService.java:111)
	at org.eclipse.xtext.xtext.XtextLinkingService.getLinkedObjects(XtextLinkingService.java:83)
	at org.eclipse.xtext.linking.impl.Linker.getLinkedObject(Linker.java:211)
	at org.eclipse.xtext.linking.impl.Linker.ensureIsLinked(Linker.java:120)
	at org.eclipse.xtext.linking.impl.Linker.ensureLinked(Linker.java:69)
	at org.eclipse.xtext.linking.impl.Linker.ensureLinked(Linker.java:56)
	at org.eclipse.xtext.linking.impl.Linker.ensureModelLinked(Linker.java:233)
	at org.eclipse.xtext.linking.impl.Linker.doLinkModel(Linker.java:229)
	at org.eclipse.xtext.linking.impl.AbstractCleaningLinker.linkModel(AbstractCleaningLinker.java:38)
	at org.eclipse.xtext.xtext.XtextLinker.linkModel(XtextLinker.java:216)
	at org.eclipse.xtext.resource.XtextResource.doLinking(XtextResource.java:276)
	at org.eclipse.xtext.linking.lazy.LazyLinkingResource.doLinking(LazyLinkingResource.java:77)
	at org.eclipse.xtext.resource.XtextResource.updateInternalState(XtextResource.java:244)
	at org.eclipse.xtext.resource.XtextResource.updateInternalState(XtextResource.java:234)
	at org.eclipse.xtext.resource.XtextResource.doLoad(XtextResource.java:157)
	at org.eclipse.xtext.linking.lazy.LazyLinkingResource.doLoad(LazyLinkingResource.java:70)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1511)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1290)
	at org.eclipse.emf.compare.util.ModelUtils.load(ModelUtils.java:382)
	at org.eclipse.emf.compare.util.EclipseModelUtils.getResource(EclipseModelUtils.java:227)
	at org.eclipse.emf.compare.logical.model.EMFModelProvider.getMappings(EMFModelProvider.java:122)
	at org.eclipse.emf.compare.logical.model.EMFModelProvider.getMappings(EMFModelProvider.java:92)
	at org.eclipse.core.resources.mapping.ModelProvider.getMappings(ModelProvider.java:142)
	at org.eclipse.core.resources.mapping.ModelProvider.getMappings(ModelProvider.java:169)
	at org.eclipse.team.core.mapping.provider.SynchronizationScopeManager.getMappings(SynchronizationScopeManager.java:100)
	at org.eclipse.team.core.mapping.provider.SynchronizationScopeManager.getMappingsFromProviders(SynchronizationScopeManager.java:86)
	at org.eclipse.team.core.mapping.provider.SynchronizationScopeManager.internalPrepareContext(SynchronizationScopeManager.java:204)
	at org.eclipse.team.core.mapping.provider.SynchronizationScopeManager.access$0(SynchronizationScopeManager.java:187)
	at org.eclipse.team.core.mapping.provider.SynchronizationScopeManager$1.run(SynchronizationScopeManager.java:167)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.team.core.mapping.provider.SynchronizationScopeManager.initialize(SynchronizationScopeManager.java:165)
	at org.eclipse.team.core.subscribers.SubscriberScopeManager.access$0(SubscriberScopeManager.java:1)
	at org.eclipse.team.core.subscribers.SubscriberScopeManager$1.run(SubscriberScopeManager.java:81)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.team.core.subscribers.SubscriberScopeManager.initialize(SubscriberScopeManager.java:79)
	at org.eclipse.team.ui.synchronize.ModelOperation.initializeScope(ModelOperation.java:161)
	at org.eclipse.team.ui.synchronize.ModelOperation.beginOperation(ModelOperation.java:124)
	at org.eclipse.team.ui.synchronize.ModelOperation.run(ModelOperation.java:105)
	at org.eclipse.egit.ui.internal.operations.GitScopeUtil.collectRelatedChanges(GitScopeUtil.java:168)
	at org.eclipse.egit.ui.internal.operations.GitScopeUtil.access$0(GitScopeUtil.java:158)
	at org.eclipse.egit.ui.internal.operations.GitScopeUtil$1.run(GitScopeUtil.java:141)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: java.net.MalformedURLException: unknown protocol: classpath
	at java.net.URL.<init>(URL.java:574)
	at java.net.URL.<init>(URL.java:464)
	at java.net.URL.<init>(URL.java:413)
	at org.eclipse.emf.ecore.resource.impl.URIHandlerImpl.createInputStream(URIHandlerImpl.java:176)
	at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(ExtensibleURIConverterImpl.java:350)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1262)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:255)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:270)
	... 43 more
Comment 1 Benjamin Muskalla CLA 2011-12-01 08:21:53 EST
Pushing this over to EMF for further diagnosis. Ed, in case you have a CVS sandbox somewhere, you could check if CVS encounters similar problems.
Comment 2 Ed Merks CLA 2011-12-01 08:30:56 EST
I've not encountered this type of problem using either GIT or CVS; but I don't have EMF Compare installed.  I'm not sure what this code is up to:

org.eclipse.emf.compare.logical.model.EMFModelProvider.getMappings(EMFModelProvider.java:92

but it should probably guard against failures...
Comment 3 Laurent Goubet CLA 2012-03-06 06:16:59 EST
Ed, Benjamin,

EMF Compare's "getMappings" is quite young, we may indeed be missing a guard or two.

The purpose of that class is to detect the links between a set of models in order to determine, from one physical file, the whole set of physical files composing the underlying logical model : you cannot commit one file without commiting the others (lest you end up with a corrupt model).

Here, we have found an Xtext file, tried to load it to determine the links between it and the other models ... and failed somehow (Xtext requires more setup than "Resource.load()" even when run from within Eclipse (and thus, with all initialization done)?).

We need to guard against loading failures even for EMF Resources, and ignore these resources from the logical model it seems. That may lead to corrupt models if one file is commited without the others ... but it is better than a thrown exception.
Comment 4 Ed Willink CLA 2012-03-06 07:15:57 EST
Laurent

You might want to take another shot at Bug 340408 which I raised to get Xtext resources working correctly in Acceleo. Getting EMF Compare working is a much stronger use case.
Comment 5 Laurent Goubet CLA 2012-03-06 08:25:54 EST
Ed,

I must admit that I don't really know : the current issue is that EMF Compare tries to load a resource because it has the "EMF" content type ... but we don't know anything other than that. We thus cannot initialize the package : we expect it to be already registered in the running instance of Eclipse (since the content type is there, registered through a plugin.xml, we assume that the package has been registered through the same plugin.xml). If it isn't ... well I don't know if we should just ignore the resource (there could be parsing errors anyway) or try our best to register it.
Comment 6 Laurent Goubet CLA 2012-03-06 08:57:29 EST
For now, I've added a catch clause to avoid brutal "errors" when resolving the logical model. We'll have to add kind of an extension mechanism and integration plugins in order to handle those EPackages with a non-standard initialization.
Comment 7 Ed Willink CLA 2012-03-06 10:08:35 EST
(In reply to comment #0)
> .. or an EMF compare bug, but why are they even active?

Why is EMF Compare active during a commit? Is there a way to ensure that EMF Compare is only used when I want it?
Comment 8 Laurent Goubet CLA 2013-01-17 11:09:01 EST
This bug has been fixed on the 1.* stream, and is not reproducible on 2.*.