Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325430 - XmlExtendedMetadata: infinite recursion for package using ##targetNamespace
Summary: XmlExtendedMetadata: infinite recursion for package using ##targetNamespace
Status: CLOSED FIXED
Alias: None
Product: MDT.BPMN2
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-16 06:04 EDT by Henning Heitkoetter CLA
Modified: 2010-09-24 04:11 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henning Heitkoetter CLA 2010-09-16 06:04:09 EDT
XmlExtendedMetadata.getNamespace is called for every EPackage that needs to appear in the namespace declarations of the serialized file. Our special version ensures that the namespace without "-XMI" is used (see comments 8-11 of bug 316591).

It does so by iterating over the structural features and using their namespace. However, if an EPackage uses metadata on references that has namespace=##targetNamespace, XmlExtendedMetadata is called again by BasicExtendedMetadata.basicGetNamespace, leading to an infinite recursion. This appears for example with the XMLTypePackage. (Packages other than the BPMN packages can for example be used because of ItemDefinition.structureRef.)

As the goal of our overriding implementation is removing the "-XMI" for the 4 EPackages defined in our plugin, we could test for these and simply remove the -XMI part instead of inspecting the features.

Like this, with some safeguards in order to only handle only "our" packages:
  String result = super.getNamespace(ePackage);
  if (result.endsWith("-XMI"))
    result = result.substring(0, result.length() - 4);
  return result;
  
What do you think? Am I overlooking something?
Comment 1 Henning Heitkoetter CLA 2010-09-24 04:11:36 EDT
Fixed in 185aac9fc8a676ce7fedb187df02bdd56da1f889.