Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Getting resource malformed URL exception exception while closing and opening the project(Getting resource malformed URL exception exception while closing and opening the project)
Getting resource malformed URL exception exception while closing and opening the project [message #1801606] Wed, 23 January 2019 11:58 Go to next message
Sharmila D is currently offline Sharmila DFriend
Messages: 81
Registered: June 2018
Member
Please find the below code snippet where Iam adding the contents to the model file .I having two ways to add the contents:
1st way:


final ResourceSet resSet = new ResourceSetImpl();

resSet.getPackageRegistry().put(ePackage.getNsURI(), ePackage);
Resource resourcee = resSet.createResource(local_semanticModelURI);
resourcee.getContents().add(au);

// now save the content.
try {
resourcee.save(Collections.EMPTY_MAP);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
while adding the elements it doest give an error.If we close and open project then Iam getting the below error
!MESSAGE An internal error occurred during: "Loading models".
!STACK 0
java.lang.RuntimeException: The modeling project "de" is invalid: Problem during loading models: unknown protocol: ar
at org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.OpenRepresentationsFileJob.runInWorkspace(OpenRepresentationsFileJob.java:135)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: java.net.MalformedURLException: unknown protocol: ar
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$ResourceLocator.demandLoadHelper(ResourceSetImpl.java:804)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$MappedResourceLocator.getResource(ResourceSetImpl.java:1204)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:352)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getEObject(ResourceSetImpl.java:220)
at org.eclipse.sphinx.emf.ecore.proxymanagement.ProxyResolutionBehavior.eResolveProxyInResourceSet(ProxyResolutionBehavior.java:63)
at org.eclipse.sphinx.emf.ecore.proxymanagement.ProxyResolutionBehavior.eResolveProxy(ProxyResolutionBehavior.java:47)
at org.eclipse.sphinx.emf.ecore.ExtendedMinimalEObjectImpl.eResolveProxy(ExtendedMinimalEObjectImpl.java:28)
at autosar40.swcomponent.composition.impl.SwComponentPrototypeImpl.getType(SwComponentPrototypeImpl.java:211)
at autosar40.swcomponent.composition.impl.SwComponentPrototypeImpl.eGet(SwComponentPrototypeImpl.java:347)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1011)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1003)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:998)
at org.eclipse.sirius.ecore.extender.tool.internal.ReferencesResolver.resolveCrossReferences(ReferencesResolver.java:100)
at org.eclipse.sirius.ecore.extender.tool.internal.ReferencesResolver.doResolveAll(ReferencesResolver.java:93)
at org.eclipse.sirius.ecore.extender.tool.internal.ReferencesResolver.resolve(ReferencesResolver.java:74)
at org.eclipse.sirius.ecore.extender.tool.api.ModelUtils.resolveAll(ModelUtils.java:452)
at org.eclipse.sirius.business.internal.session.danalysis.SessionResourcesTracker.forceLoadingOfEveryLinkedResource(SessionResourcesTracker.java:170)
at org.eclipse.sirius.business.internal.session.danalysis.SessionResourcesTracker.initialize(SessionResourcesTracker.java:94)
at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.open(DAnalysisSessionImpl.java:1175)
at org.eclipse.sirius.business.internal.session.SessionManagerImpl.openSession(SessionManagerImpl.java:386)
at org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.OpenRepresentationsFileJob.performOpenSession(OpenRepresentationsFileJob.java:156)
at org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.OpenRepresentationsFileJob.runInWorkspace(OpenRepresentationsFileJob.java:125)
... 2 more
Caused by: java.net.MalformedURLException: unknown protocol: ar
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at org.eclipse.emf.ecore.resource.impl.URIHandlerImpl.createInputStream(URIHandlerImpl.java:199)
at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(ExtensibleURIConverterImpl.java:360)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1269)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
... 24 more

2nd way:

final ResourceSet resSet = new ResourceSetImpl();
Resource resourcee = resSet.createResource(local_semanticModelURI);
// Resource resourcee = resSet.getResource(local_semanticModelURI, true);
resourcee.getContents().add(au);
try {
resourcee.save(Collections.EMPTY_MAP);
// resourcee.load(Collections.EMPTY_MAP);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
It is working correct while closing and opening the project also it is working fine but the way it will write in text editor is XML format if (when we do open with text editor on modelFile) .I dont want to write in that format. If I follow first process it will write in the format I want so that I can export easily but while opening and closing of project Iam getting resource malformed URL exception.

can some please help me where Iam going wrong
  • Attachment: error.PNG
    (Size: 12.50KB, Downloaded 73 times)

[Updated on: Thu, 24 January 2019 05:30]

Report message to a moderator

Re: Getting resource malformed URL exception exception while closing and opening the project [message #1801623 is a reply to message #1801606] Wed, 23 January 2019 18:13 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

"ar" and "de" are presumably related in some way to the value of local_semanticModelURI that you don't share with us.

When I get a MalformedURLException, I use a debugger and usually find out quite rapidly how stupid I have been.

Regards

Ed Willink

Previous Topic:Custom Diagram Layout ('arrange-all') does not work as expected
Next Topic:[ANN] Sirius 5.1.4
Goto Forum:
  


Current Time: Thu Apr 18 23:50:08 GMT 2024

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

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

Back to the top