diff --git a/assemblies/features/base/src/main/filtered-resources/resources/etc/config.properties b/assemblies/features/base/src/main/filtered-resources/resources/etc/config.properties index 6b418f2101e..1c538578a08 100644 --- a/assemblies/features/base/src/main/filtered-resources/resources/etc/config.properties +++ b/assemblies/features/base/src/main/filtered-resources/resources/etc/config.properties @@ -82,7 +82,8 @@ org.osgi.framework.system.packages= \ org.apache.karaf.jaas.boot.principal;uses:=javax.security.auth;version="@@karaf.osgi.version@@",\ org.apache.karaf.jaas.boot;uses:="javax.security.auth,javax.security.auth.callback,javax.security.auth.login,javax.security.auth.spi,org.osgi.framework";version="@@karaf.osgi.version@@",\ org.apache.karaf.info;version="@@karaf.osgi.version@@",\ - ${jre-${java.specification.version}} + ${jre-${java.specification.version}},\ + ${custom.org.osgi.framework.system.packages} # # Extra packages appended after standard packages @@ -91,12 +92,14 @@ org.osgi.framework.system.packages.extra= \ org.apache.karaf.branding, \ sun.misc, \ com.sun.jmx.remote.protocol, \ - com.sun.jmx.remote.protocol.jmxmp + com.sun.jmx.remote.protocol.jmxmp, \ + ${custom.org.osgi.framework.system.packages.extra} org.osgi.framework.system.capabilities= \ ${eecap-${java.specification.version}}, \ ${${karaf.framework}-capabilities}, \ - ${karaf-capabilities} + ${karaf-capabilities}, \ + ${custom-capabilities} karaf-capabilities= \ osgi.service;objectClass:List=org.apache.karaf.info.ServerInfo @@ -185,7 +188,8 @@ org.osgi.framework.bootdelegation=\ jdk.nashorn.*, \ sun.*, \ jdk.internal.reflect, \ - jdk.internal.reflect.* + jdk.internal.reflect.*, \ + ${custom.org.osgi.framework.bootdelegation} # jVisualVM support # in order to use Karaf with jvisualvm, the org.osgi.framework.bootdelegation property has to contain the org.netbeans.lib.profiler.server package @@ -195,7 +199,7 @@ org.osgi.framework.bootdelegation=\ # # YourKit support # in order to use Karaf with YourKit, the org.osgi.framework.bootdelegation property has to contain the com.yourkit.* packages -# and, so, it should look like: +# and, so, it should look like: # # org.osgi.framework.bootdelegation=org.apache.karaf.jaas.boot,org.apache.karaf.jaas.boot.principal,sun.*,com.sun.*,javax.transaction,javax.transaction.*,javax.xml.crypto,javax.xml.crypto.*,org.apache.xerces.jaxp.datatype,org.apache.xerces.stax,org.apache.xerces.parsers,org.apache.xerces.jaxp,org.apache.xerces.jaxp.validation,org.apache.xerces.dom,com.yourkit.* # diff --git a/assemblies/features/base/src/main/filtered-resources/resources/etc/jre.properties b/assemblies/features/base/src/main/filtered-resources/resources/etc/jre.properties index 2dcf885037b..b3d6e147f52 100644 --- a/assemblies/features/base/src/main/filtered-resources/resources/etc/jre.properties +++ b/assemblies/features/base/src/main/filtered-resources/resources/etc/jre.properties @@ -17,6 +17,8 @@ # ################################################################################ +${optionals} = custom.jre.properties + # # Java platform package export properties. # @@ -182,7 +184,8 @@ jre-1.6= \ org.w3c.dom.xpath, \ org.xml.sax, \ org.xml.sax.ext, \ - org.xml.sax.helpers + org.xml.sax.helpers, \ + ${custom.jre-1.6} # Standard package set. Note that: # - javax.transaction* is exported with a mandatory attribute @@ -338,7 +341,8 @@ jre-1.7= \ org.xml.sax, \ org.xml.sax.ext, \ org.xml.sax.helpers, \ - com.sun.nio.sctp + com.sun.nio.sctp, \ + ${custom.jre-1.7} # # A note about javax.transaction and javax.transaction.xa packages in JDK8 and JDK9+ @@ -571,7 +575,8 @@ jre-1.8= \ org.xml.sax, \ org.xml.sax.ext, \ org.xml.sax.helpers, \ - com.sun.nio.sctp + com.sun.nio.sctp, \ + ${custom.jre-8} jre-9= \ javax.accessibility, \ @@ -734,10 +739,11 @@ jre-9= \ com.sun.security.sasl, \ com.sun.security.sasl.digest, \ com.sun.security.sasl.ntlm, \ - com.sun.security.sasl.util + com.sun.security.sasl.util, \ + ${custom.jre-9} -jre-10 = ${jre-9} -jre-11 = ${jre-10} -jre-13 = ${jre-11} -jre-14 = ${jre-13} -jre-15 = ${jre-14} +jre-10 = ${jre-9}, ${custom.jre-10} +jre-11 = ${jre-10}, ${custom.jre-11} +jre-13 = ${jre-11}, ${custom.jre-13} +jre-14 = ${jre-13}, ${custom.jre-14} +jre-15 = ${jre-14}, ${custom.jre-15} diff --git a/main/src/main/java/org/apache/karaf/main/ConfigProperties.java b/main/src/main/java/org/apache/karaf/main/ConfigProperties.java index f3b35e55a44..3087197d3cb 100644 --- a/main/src/main/java/org/apache/karaf/main/ConfigProperties.java +++ b/main/src/main/java/org/apache/karaf/main/ConfigProperties.java @@ -230,6 +230,7 @@ public ConfigProperties() throws Exception { PropertiesLoader.loadSystemProperties(new File(karafEtc, SYSTEM_PROPERTIES_FILE_NAME)); this.props = PropertiesLoader.loadConfigProperties(new File(karafEtc, CONFIG_PROPERTIES_FILE_NAME)); + cleanup(this.props); this.securityProviders = getSecurityProviders(); this.defaultStartLevel = Integer.parseInt(props.getProperty(Constants.FRAMEWORK_BEGINNING_STARTLEVEL)); @@ -258,6 +259,24 @@ public ConfigProperties() throws Exception { System.setProperty(KARAF_DELAY_CONSOLE, Boolean.toString(this.delayConsoleStart)); } + private void cleanup(Properties props) { + cleanup(props, "org.osgi.framework.system.packages.extra"); + cleanup(props, "org.osgi.framework.system.packages"); + for (String key : props.keySet()) { + if (key.startsWith("jre-")) { + cleanup(props, key); + } + } + } + + private void cleanup(Properties props, String key) { + String propertyValue = props.get(key); + if (propertyValue != null) { + String cleanedUp = propertyValue.replaceAll(",\\s*,", ",").replace(",+$", ""); + props.put(key, cleanedUp); + } + } + public void performInit() throws Exception { File cleanAllIndicatorFile = new File(karafData, "clean_all"); File cleanCacheIndicatorFile = new File(karafData, "clean_cache"); diff --git a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/VerifyMojo.java b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/VerifyMojo.java index 1c3c3dfb0be..9c073872720 100644 --- a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/VerifyMojo.java +++ b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/VerifyMojo.java @@ -576,7 +576,7 @@ private Bundle getSystemBundle(Map if (configProps.containsKey("org.osgi.framework.system.packages.extra")) { exportPackages += "," + configProps.getProperty("org.osgi.framework.system.packages.extra"); } - exportPackages = exportPackages.replaceAll(",\\s*,", ","); + exportPackages = exportPackages.trim().replaceAll(",\\s*,", ",").replace(",+$", ""); attributes.putValue(Constants.EXPORT_PACKAGE, exportPackages); String systemCaps = configProps.getProperty("org.osgi.framework.system.capabilities");