This is an automated email from the ASF dual-hosted git repository. matthiasblaesing pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push: new c200b96 [NETBEANS-5772] replace dashes with underscores added tests for bundles with dashes in symbolic name new 7a01cb3 Merge pull request #3000 from nigjo/osgi-names-with-dash c200b96 is described below commit c200b96c03604d88c47448c9b646d86decc4ec68 Author: Jens Hofschröer <apa...@nigjo.de> AuthorDate: Wed Jun 16 13:41:02 2021 +0200 [NETBEANS-5772] replace dashes with underscores added tests for bundles with dashes in symbolic name --- .../org/netbeans/nbbuild/MakeUpdateDesc.java | 2 +- .../org/netbeans/nbbuild/MakeUpdateDescTest.java | 56 ++++++++++++++++++++-- platform/autoupdate.services/manifest.mf | 2 +- .../updateprovider/AutoupdateInfoParser.java | 2 +- 4 files changed, 56 insertions(+), 6 deletions(-) diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/MakeUpdateDesc.java b/nbbuild/antsrc/org/netbeans/nbbuild/MakeUpdateDesc.java index e405a2f..019a385 100644 --- a/nbbuild/antsrc/org/netbeans/nbbuild/MakeUpdateDesc.java +++ b/nbbuild/antsrc/org/netbeans/nbbuild/MakeUpdateDesc.java @@ -772,7 +772,7 @@ public class MakeUpdateDesc extends MatchingTask { } m2.reset(); StringBuilder depSB = new StringBuilder(); - depSB.append(requiredBundleName); // dep CNB + depSB.append(requiredBundleName.replace('-', '_')); // dep CNB while (m2.find()) { if (!m2.group(1).equals("bundle-version")) { continue; diff --git a/nbbuild/test/unit/src/org/netbeans/nbbuild/MakeUpdateDescTest.java b/nbbuild/test/unit/src/org/netbeans/nbbuild/MakeUpdateDescTest.java index 3b870f5..7acc12f 100644 --- a/nbbuild/test/unit/src/org/netbeans/nbbuild/MakeUpdateDescTest.java +++ b/nbbuild/test/unit/src/org/netbeans/nbbuild/MakeUpdateDescTest.java @@ -46,7 +46,7 @@ public class MakeUpdateDescTest extends NbTestCase { "org.openide.actions;bundle-version=\"[6.15,100)\"," + "javax.xml.rpc;bundle-version=1.1.0, " + "javax.xml.rpc;bundle-version=1.1.0, " + - "org.apache.xerces;bundle-version=\"[2.8.0,3.0.0)\";resolution:=optional, " + + "org.apache.xerces;bundle-version=\"[2.8.0,3.0.0)\";resolution:=optional, " + "org.eclipse.osgi;bundle-version=\"[3.5.0,4.0.0)\";visibility:=reexport"); Properties localization = new Properties(); localization.setProperty("OpenIDE-Module-Name", "My Bundle"); @@ -81,10 +81,10 @@ public class MakeUpdateDescTest extends NbTestCase { //attr.putValue("Bundle-Name", "%OpenIDE-Module-Name"); //attr.putValue("Bundle-Category", "%OpenIDE-Module-Display-Category"); //attr.putValue("Bundle-Description", "%OpenIDE-Module-Short-Description"); - + // As generated by JarWithModuleAttributes: attr.putValue("Export-Package", "javaewah;version=0.5.6"); - + Properties localization = new Properties(); localization.setProperty("OpenIDE-Module-Name", "My Bundle"); localization.setProperty("OpenIDE-Module-Display-Category", "hello"); @@ -101,4 +101,54 @@ public class MakeUpdateDescTest extends NbTestCase { + " </module> ", baos.toString().replace('"', '\'').replaceAll("\\s+", " ")); } + public void testBundleWithDash() throws Exception { + Attributes attr = new Attributes(); + attr.putValue("Manifest-Version", "1.0"); + attr.putValue("Bundle-SymbolicName", "com.excample.dashed-bundle"); + attr.putValue("Bundle-Name", "%OpenIDE-Module-Name"); + attr.putValue("Bundle-Category", "%OpenIDE-Module-Display-Category"); + attr.putValue("Bundle-Description", "%OpenIDE-Module-Short-Description"); + // As generated by JarWithModuleAttributes: + Properties localization = new Properties(); + localization.setProperty("OpenIDE-Module-Name", "My Bundle"); + localization.setProperty("OpenIDE-Module-Display-Category", "hello"); + localization.setProperty("OpenIDE-Module-Short-Description", "Hello there!"); + Element e = MakeUpdateDesc.fakeOSGiInfoXml(attr, localization, new File(getWorkDir(), "something/some.jar")); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + XMLUtil.write(e, baos); + assertEquals("<module codenamebase='com.excample.dashed_bundle' distribution='' downloadsize='0' targetcluster='something'> <manifest " + + "AutoUpdate-Show-In-Client='false' " + + "OpenIDE-Module='com.excample.dashed_bundle' OpenIDE-Module-Display-Category='hello' " + + "OpenIDE-Module-Name='My Bundle' " + + "OpenIDE-Module-Short-Description='Hello there!' " + + "OpenIDE-Module-Specification-Version='0'/> " + + "</module> ", baos.toString().replace('"', '\'').replaceAll("\\s+", " ")); + } + + public void testBundleDepWithDash() throws Exception { + Attributes attr = new Attributes(); + attr.putValue("Manifest-Version", "1.0"); + attr.putValue("Bundle-SymbolicName", "bundle"); + attr.putValue("Bundle-Name", "%OpenIDE-Module-Name"); + attr.putValue("Bundle-Category", "%OpenIDE-Module-Display-Category"); + attr.putValue("Bundle-Description", "%OpenIDE-Module-Short-Description"); + attr.putValue("Require-Bundle", "com.excample.dashed-bundle;bundle-version=1.0"); + // As generated by JarWithModuleAttributes: + Properties localization = new Properties(); + localization.setProperty("OpenIDE-Module-Name", "My Bundle"); + localization.setProperty("OpenIDE-Module-Display-Category", "hello"); + localization.setProperty("OpenIDE-Module-Short-Description", "Hello there!"); + Element e = MakeUpdateDesc.fakeOSGiInfoXml(attr, localization, new File(getWorkDir(), "something/some.jar")); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + XMLUtil.write(e, baos); + assertEquals("<module codenamebase='bundle' distribution='' downloadsize='0' targetcluster='something'> <manifest " + + "AutoUpdate-Show-In-Client='false' " + + "OpenIDE-Module='bundle' OpenIDE-Module-Display-Category='hello' " + + "OpenIDE-Module-Module-Dependencies='com.excample.dashed_bundle > 1.0' " + + "OpenIDE-Module-Name='My Bundle' " + + "OpenIDE-Module-Recommends='cnb.com.excample.dashed_bundle' " + + "OpenIDE-Module-Short-Description='Hello there!' " + + "OpenIDE-Module-Specification-Version='0'/> " + + "</module> ", baos.toString().replace('"', '\'').replaceAll("\\s+", " ")); + } } diff --git a/platform/autoupdate.services/manifest.mf b/platform/autoupdate.services/manifest.mf index 24d5550..b8c2e3f 100644 --- a/platform/autoupdate.services/manifest.mf +++ b/platform/autoupdate.services/manifest.mf @@ -1,7 +1,7 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.modules.autoupdate.services OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/autoupdate/services/resources/Bundle.properties -OpenIDE-Module-Specification-Version: 1.67 +OpenIDE-Module-Specification-Version: 1.67.1 OpenIDE-Module-Layer: org/netbeans/modules/autoupdate/services/resources/layer.xml AutoUpdate-Show-In-Client: false AutoUpdate-Essential-Module: true diff --git a/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/updateprovider/AutoupdateInfoParser.java b/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/updateprovider/AutoupdateInfoParser.java index 6082f3a..0d5f6c4 100644 --- a/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/updateprovider/AutoupdateInfoParser.java +++ b/platform/autoupdate.services/src/org/netbeans/modules/autoupdate/updateprovider/AutoupdateInfoParser.java @@ -535,7 +535,7 @@ public class AutoupdateInfoParser extends DefaultHandler { if (b.length() > 0) { b.append(", "); } - b.append(requiredBundleName); // dep CNB + b.append(requiredBundleName.replace('-', '_')); // dep CNB while (m2.find()) { if (!m2.group(1).equals("bundle-version")) { continue; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists