Skip to content

Commit

Permalink
Detect factories having designate element with both "pid" and
Browse files Browse the repository at this point in the history
"factoryPid" attributes

This relates to #1728
  • Loading branch information
kwin committed Nov 10, 2023
1 parent e5b4df5 commit 9ece0cf
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,15 +365,16 @@ private Descriptor parseMetatype(InputStream is, String name) throws IOException
StartElement start = event.asStartElement();
String elementName = start.getName().getLocalPart();
if (elementName.equals("Designate")) {
Attribute pidAttribute = start.getAttributeByName(new QName("pid"));
// Felix SCR Generator incorrectly generates both attributes "factoryPid" and "pid" for factories
Attribute pidAttribute = start.getAttributeByName(new QName("factoryPid"));
if (pidAttribute != null) {
result.name = pidAttribute.getValue();
result.factory = true;
} else {
pidAttribute = start.getAttributeByName(new QName("factoryPid"));
pidAttribute = start.getAttributeByName(new QName("pid");
if (pidAttribute != null) {
result.name = pidAttribute.getValue();
}
result.factory = true;
}
} else if (elementName.equals("AD")) {
String propName = start.getAttributeByName(new QName("id")).getValue();
Expand Down

0 comments on commit 9ece0cf

Please sign in to comment.