kwin commented on a change in pull request #2:
URL: 
https://github.com/apache/sling-org-apache-sling-installer-provider-file/pull/2#discussion_r411267445



##########
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:
       The first issue was reported and solved in the context of 
https://issues.apache.org/jira/browse/SLING-9218.
   
   Comments are allowed though, as specified in 
https://osgi.org/specification/osgi.cmpn/7.0.0/service.configurator.html#d0e131566:
   
   > Comments in the form of [2] JSMin (The JavaScript Minifier) comments are 
supported, that is, any text on the same line after // is ignored and any text 
between /* */ is ignored.
   
   In any case this PR has already been merged. If you find any issue feel free 
to report it via https://issues.apache.org/jira/browse/SLING!




----------------------------------------------------------------
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:
[email protected]


Reply via email to