[ 
https://issues.apache.org/jira/browse/KARAF-7389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17489417#comment-17489417
 ] 

Grzegorz Grzybek commented on KARAF-7389:
-----------------------------------------

The original config from the feature is:
{noformat}

# non secure connector configuration
org.osgi.service.http.enabled = true
org.osgi.service.http.port = 8181

# secure connector configuration
org.osgi.service.http.secure.enabled = false
#org.osgi.service.http.port.secure = 8443
#org.ops4j.pax.web.ssl.truststore = ${karaf.etc}/server.keystore
#org.ops4j.pax.web.ssl.truststore.password = passw0rd
#org.ops4j.pax.web.ssl.truststore.type = JKS
#org.ops4j.pax.web.ssl.keystore = ${karaf.etc}/server.keystore
#org.ops4j.pax.web.ssl.keystore.password = passw0rd
#org.ops4j.pax.web.ssl.keystore.type = JKS
#org.ops4j.pax.web.ssl.key.password = passw0rd
#org.ops4j.pax.web.ssl.key.alias = server
#org.ops4j.pax.web.ssl.clientauth.needed = false
#org.ops4j.pax.web.ssl.protocols.included = TLSv1.3
#org.ops4j.pax.web.ssl.protocol = TLSv1.3
#org.ops4j.pax.web.ssl.protocols.included = TLSv1.2 TLSv1.3
#org.ops4j.pax.web.ssl.ciphersuites.included = TLS_RSA_WITH_AES_128_CBC_SHA, 
TLS_RSA_WITH_AES_256_GCM_SHA384
#org.ops4j.pax.web.ssl.secureRandom.algorithm = NativePRNGNonBlocking
#org.ops4j.pax.web.ssl.renegotiationAllowed = true
#org.ops4j.pax.web.ssl.session.enabled = true

# external Jetty configuration file where Jetty-specific beans may be declared
#org.ops4j.pax.web.config.file = ${karaf.etc}/jetty.xml

# this is a root directory for all the context-specific directories managed by 
Pax Web
javax.servlet.context.tempdir = ${karaf.data}/pax-web/tmp
{noformat}

all the comments and commented properties are part of the 
{{org.apache.felix.utils.properties.Properties.Layout}} under 
{{javax.servlet.context.tempdir}} key in 
{{org.apache.felix.utils.properties.Properties#layout}} map.

I can't catch exactly the moment where the comment changes into keyless 
property, but these threads simply should be synchronized:

{{features-3-thread-1}} doing:
{code:java}
for (String key : storage.keySet())
{
    Layout l = layout.get(key);
    if (l != null && l.getCommentLines() != null)
    {
        for (String s : l.getCommentLines())
        {
            writer.writeln(s);
        }
    }
...
{code}

and {{CM Event Dispatcher (Fire ConfigurationEvent: pid=org.ops4j.pax.web)}} 
thread doing:
{code:xml}
protected void loadLayout(Reader in, boolean maybeTyped) throws IOException
{
    PropertiesReader reader = new PropertiesReader(in, maybeTyped);
    boolean hasProperty = false;
    while (reader.nextProperty())
    {
        hasProperty = true;
        storage.put(reader.getPropertyName(), reader.getPropertyValue());
        int idx = checkHeaderComment(reader.getCommentLines());
        layout.put(reader.getPropertyName(),
                new Layout(idx < reader.getCommentLines().size() ?
                                new 
ArrayList<String>(reader.getCommentLines().subList(idx, 
reader.getCommentLines().size())) :
                                null,
                           new ArrayList<String>(reader.getValueLines())));
    }
...
{code}

> Problem installing features with embedded config
> ------------------------------------------------
>
>                 Key: KARAF-7389
>                 URL: https://issues.apache.org/jira/browse/KARAF-7389
>             Project: Karaf
>          Issue Type: Bug
>            Reporter: Grzegorz Grzybek
>            Assignee: Grzegorz Grzybek
>            Priority: Major
>
> I've just seen this when installing Pax Web 8.0.1-SNAPSHOT features:
> {noformat}
> 2022-02-08T13:25:32,180 | INFO  | 
> fileinstall-/data/servers/apache-karaf-4.4.0-SNAPSHOT/etc | fileinstall       
>                | 17 - org.apache.felix.fileinstall - 3.7.4 | Updating 
> configuration {org.ops4j.pax.web} from 
> /data/servers/apache-karaf-4.4.0-SNAPSHOT/etc/org.ops4j.pax.web.cfg
> 2022-02-08T13:25:32,184 | ERROR | 
> fileinstall-/data/servers/apache-karaf-4.4.0-SNAPSHOT/etc | fileinstall       
>                | 17 - org.apache.felix.fileinstall - 3.7.4 | Failed to 
> install artifact: 
> /data/servers/apache-karaf-4.4.0-SNAPSHOT/etc/org.ops4j.pax.web.cfg
> java.lang.RuntimeException: java.lang.IllegalArgumentException: Key [] must 
> not be an empty string
>       at 
> org.apache.felix.fileinstall.internal.ConfigInstaller.update0(ConfigInstaller.java:649)
>  ~[!/:3.7.4]
>       at 
> org.apache.felix.fileinstall.internal.ConfigInstaller.setConfig(ConfigInstaller.java:411)
>  ~[!/:3.7.4]
>       at 
> org.apache.felix.fileinstall.internal.ConfigInstaller.install(ConfigInstaller.java:192)
>  ~[!/:3.7.4]
>       at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:950)
>  [!/:3.7.4]
>       at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:884)
>  [!/:3.7.4]
>       at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:489)
>  [!/:3.7.4]
>       at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
>  [!/:3.7.4]
>       at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)
>  [!/:3.7.4]
> Caused by: java.lang.IllegalArgumentException: Key [] must not be an empty 
> string
>       at 
> org.apache.felix.cm.impl.CaseInsensitiveDictionary.checkKey(CaseInsensitiveDictionary.java:269)
>  ~[?:?]
>       at 
> org.apache.felix.cm.impl.CaseInsensitiveDictionary.<init>(CaseInsensitiveDictionary.java:73)
>  ~[?:?]
>       at 
> org.apache.felix.cm.impl.ConfigurationImpl.update(ConfigurationImpl.java:452) 
> ~[?:?]
>       at 
> org.apache.felix.cm.impl.ConfigurationAdapter.updateIfDifferent(ConfigurationAdapter.java:204)
>  ~[?:?]
>       at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) ~[?:?]
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[?:1.8.0_312]
>       at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_312]
>       at 
> org.apache.felix.fileinstall.internal.ConfigInstaller.update0(ConfigInstaller.java:641)
>  ~[!/:3.7.4]
>       ... 7 more
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to