You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2020/01/04 17:53:17 UTC

[GitHub] [sling-org-apache-sling-installer-provider-file] kwin opened a new pull request #2: SLING-8419 write back configuration in OSGi JSON format

kwin opened a new pull request #2: SLING-8419 write back configuration in OSGi JSON format
URL: https://github.com/apache/sling-org-apache-sling-installer-provider-file/pull/2
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [sling-org-apache-sling-installer-provider-file] kwin merged pull request #2: SLING-8419 write back configuration in OSGi JSON format

Posted by GitBox <gi...@apache.org>.
kwin merged pull request #2: SLING-8419 write back configuration in OSGi JSON format
URL: https://github.com/apache/sling-org-apache-sling-installer-provider-file/pull/2
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [sling-org-apache-sling-installer-provider-file] sabberworm commented on a change in pull request #2: SLING-8419 write back configuration in OSGi JSON format

Posted by GitBox <gi...@apache.org>.
sabberworm commented on a change in pull request #2: SLING-8419 write back configuration in OSGi JSON format
URL: https://github.com/apache/sling-org-apache-sling-installer-provider-file/pull/2#discussion_r410448894
 
 

 ##########
 File path: src/main/java/org/apache/sling/installer/provider/file/impl/FileInstaller.java
 ##########
 @@ -191,23 +197,18 @@ private UpdateResult handleUpdate(final String resourceType,
             } else {
                 // add
                 final FileMonitor first = this.monitors.get(0);
-                path = first.getRoot().getAbsolutePath() + '/' + id + ".config";
+                path = first.getRoot().getAbsolutePath() + '/' + id + CONFIG_FILE_EXTENSION;
                 prefix = first.getListener().getScheme();
                 logger.debug("Add of {} at {}", resourceType, path);
             }
 
             final File file = new File(path);
             file.getParentFile().mkdirs();
-            final FileOutputStream fos = new FileOutputStream(file);
-            try {
-                fos.write("# Configuration created by Apache Sling File Installer\n".getBytes("UTF-8"));
-                ConfigurationHandler.write(fos, dict);
-            } finally {
-                try {
-                    fos.close();
-                } catch (final IOException ignore) {}
-            }
-
+            try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(file))) {
+                fos.write("# Configuration created by Apache Sling File Installer\n".getBytes(StandardCharsets.UTF_8));
 
 Review comment:
   I’m not sure the `#` character introduces a valid comment in JSON…
   Then again https://sling.apache.org/documentation/bundles/configuration-installer-factory.html mentions being allowed to use `//` comments, which also would not be valid JSON…

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services