[
https://issues.apache.org/jira/browse/SLING-9219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17062477#comment-17062477
]
Konrad Windszus edited comment on SLING-9219 at 3/19/20, 11:40 AM:
-------------------------------------------------------------------
It is supposed to be written in the JSON format as it has the least
restrictions and is the official OSGi format
(https://sling.apache.org/documentation/bundles/configuration-installer-factory.html#configuration-files-cfgjson).
Comments are supposed to be allowed through according to
https://osgi.org/specification/osgi.cmpn/7.0.0/service.configurator.html. But
obviously they must not start with {{#}} but rather with {{//}}.
was (Author: kwin):
It is supposed to be written in the JSON format as it has the least
restrictions and is the official OSGi format
(https://sling.apache.org/documentation/bundles/configuration-installer-factory.html#configuration-files-cfgjson).
Comments are supposed to be allowed though according to
https://osgi.org/specification/osgi.cmpn/7.0.0/service.configurator.html. But
obviously they must not start with {{#}} but rather with {{//}}.
> Comments in JSON Configuration
> ------------------------------
>
> Key: SLING-9219
> URL: https://issues.apache.org/jira/browse/SLING-9219
> Project: Sling
> Issue Type: Bug
> Components: Installer
> Affects Versions: JCR Installer 3.2.0
> Reporter: Dan Klco
> Assignee: Konrad Windszus
> Priority: Major
>
> With the latest version of JCR Installer, I'm seeing an exception when saving
> OSGi Configurations from the console:
>
> {{18.03.2020 19:57:44.565 *WARN* [JcrInstaller.2]
> org.apache.sling.installer.core.impl.OsgiInstallerImpl Cannot create
> InternalResource (resource will be ignored):InstallableResource,
> priority=200,
> id=/apps/sling/install/org.apache.sling.cms.core.internal.repository.RevisionCleanupScheduler.cfg.json}}{{javax.json.stream.JsonParsingException:
> Unexpected character '#' (Codepoint: 35) on [lineNumber=2, columnNumber=77,
> streamOffset=76]. Reason is [[Expected structural character or digit or 't'
> or 'n' or 'f' or '-']]}}{{at
> org.apache.johnzon.core.JsonStreamParserImpl.uexc(JsonStreamParserImpl.java:966)}}{{at
>
> org.apache.johnzon.core.JsonStreamParserImpl.uexc(JsonStreamParserImpl.java:972)}}{{at
>
> org.apache.johnzon.core.JsonStreamParserImpl.defaultHandling(JsonStreamParserImpl.java:422)}}{{at
>
> org.apache.johnzon.core.JsonStreamParserImpl.next(JsonStreamParserImpl.java:414)}}{{at
>
> org.apache.johnzon.core.JsonStreamParserImpl.next(JsonStreamParserImpl.java:353)}}{{at
>
> org.apache.johnzon.core.JsonReaderImpl.parseObject(JsonReaderImpl.java:131)}}{{at
>
> org.apache.johnzon.core.JsonReaderImpl.readValue(JsonReaderImpl.java:56)}}{{at
> org.apache.johnzon.core.JsonReaderImpl.read(JsonReaderImpl.java:42)}}{{at
> org.apache.felix.configurator.impl.json.JSONUtil.parseJSON(JSONUtil.java:331)
> [org.apache.sling.installer.core:3.10.2]}}{{at
> org.apache.felix.configurator.impl.json.JSONUtil.readJSON(JSONUtil.java:161)
> [org.apache.sling.installer.core:3.10.2]}}{{at
> org.apache.sling.installer.core.impl.InternalResource.readDictionary(InternalResource.java:274)
> [org.apache.sling.installer.core:3.10.2]}}{{at
> org.apache.sling.installer.core.impl.InternalResource.create(InternalResource.java:106)
> [org.apache.sling.installer.core:3.10.2]}}{{at
> org.apache.sling.installer.core.impl.OsgiInstallerImpl.createResources(OsgiInstallerImpl.java:385)
> [org.apache.sling.installer.core:3.10.2]}}{{at
> org.apache.sling.installer.core.impl.OsgiInstallerImpl.updateResources(OsgiInstallerImpl.java:425)
> [org.apache.sling.installer.core:3.10.2]}}{{at
> org.apache.sling.installer.provider.jcr.impl.JcrInstaller.runOneCycle(JcrInstaller.java:465)
> [org.apache.sling.installer.provider.jcr:3.2.0]}}{{at
> org.apache.sling.installer.provider.jcr.impl.JcrInstaller$StoppableThread.run(JcrInstaller.java:287)
> [org.apache.sling.installer.provider.jcr:3.2.0]}}
> The problem appears to be that the files are in JSON format, but contain a
> prefix comment: " # Configuration created by Apache Sling JCR Installer"
> This is due to the JCR Installer changing to write the configuration files in
> JSON format, but still including the comment from when the configurations
> were persisted as text files:
> [https://github.com/apache/sling-org-apache-sling-installer-provider-jcr/blame/master/src/main/java/org/apache/sling/installer/provider/jcr/impl/JcrInstaller.java#L695]
> The question [~kwin] it looks like there was a revert commit, so should the
> config files revert to TXT format or remove the comment and have the
> configurations in JSON format?
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)