diff -r 82b7293135ab o.n.bootstrap/src/org/netbeans/Util.java --- a/o.n.bootstrap/src/org/netbeans/Util.java Wed Apr 11 14:35:13 2012 -0400 +++ b/o.n.bootstrap/src/org/netbeans/Util.java Wed Apr 11 23:37:56 2012 +0200 @@ -49,6 +49,8 @@ import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.openide.util.*; import org.openide.modules.*; @@ -340,6 +342,28 @@ } } } + // #206365: handle specially OSGi bundles + if (m.getManifest().getMainAttributes().getValue("Bundle-SymbolicName") != null) { + String requireBundle; + if ((requireBundle = m.getManifest().getMainAttributes().getValue("Require-Bundle")) != null) { + StringBuilder sb = new StringBuilder(); + // http://stackoverflow.com/questions/1757065/java-splitting-a-comma-separated-string-but-ignoring-commas-in-quotes + for (String dep : requireBundle.split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)")) { + Matcher matcher = Pattern.compile("([^;]+)(.*)").matcher(dep); + if (!matcher.matches()) { + throw new IllegalStateException("Could not parse dependency: " + dep + " in " + m); + } + String requiredBundleName = matcher.group(1); // dep CNB + if (requiredBundleName != null && requiredBundleName.length() > 0) { + Module m2 = modulesByName.get(requiredBundleName); + if (m2 != null) { + s.add(m2); + } + } + } + } + } + // end of #206365 s.remove(m); if (transitive) { Set toAdd;