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

Bug 357962

Summary: [EMF Runtime Extensions] Make sure that problems occurring when saving model elements in a new resource are not recorded as errors/warnings on resource
Product: [Automotive] Sphinx Reporter: Stephan Eberle <stephaneberle9>
Component: CoreAssignee: Stephan Eberle <stephaneberle9>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3 CC: ali.akar82, idydieng, quoclan, robert.kiss
Version: 0.7.0   
Target Milestone: 0.7.0   
Hardware: All   
OS: All   
Whiteboard:

Description Stephan Eberle CLA 2011-09-16 12:34:47 EDT
= Problem description =
Currently, org.eclipse.sphinx.emf.util.EcoreResourceUtil.loadModelResource(ResourceSet, URI, Map<?, ?>, boolean) and org.eclipse.sphinx.emf.util.EcoreResourceUtil.saveModelResource(Resource, Map<?, ?>) record exceptions raised during load or save operation as errors on the the affected model resource. These errors are subsequently translated into problem markers, attached to the underlying file and thus become visible in the Problems view.

While this behavior makes sense for already existing resources that are loaded or saved it doesn't make much sense on new resources being created and saved for the first time. If exceptions are raised in that case, the underlying file will never be created. So, there won't be any target for attaching the problem markers created from the errors recorded on the model resource. Users just notice that nothing has happened but neither Problems view nor Error Log view give any hint about what went wrong.

= Resolution approach =
Make sure that exceptions raised when saving model resources are only recorded as errors on model resource when the latter already exists (i.e., in case when EcoreResourceUtil#saveModelResource() is directly called by clients). Log raised exceptions in error log instead when saving models to new resources (i.e., in case when EcoreResourceUtil#saveNewModelResource() is called).
Comment 1 Stephan Eberle CLA 2011-09-16 12:36:39 EDT
Fixed as proposed in description.
Comment 2 Balazs Grill CLA 2021-07-14 02:14:51 EDT
Mass-closing Resolved tickets