You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2015/04/17 11:46:46 UTC

svn commit: r1674245 - /sling/trunk/installer/providers/file/src/main/java/org/apache/sling/installer/provider/file/impl/FileInstaller.java

Author: cziegeler
Date: Fri Apr 17 09:46:46 2015
New Revision: 1674245

URL: http://svn.apache.org/r1674245
Log:
SLING-4632 : File installer does not support moving Sling directory

Modified:
    sling/trunk/installer/providers/file/src/main/java/org/apache/sling/installer/provider/file/impl/FileInstaller.java

Modified: sling/trunk/installer/providers/file/src/main/java/org/apache/sling/installer/provider/file/impl/FileInstaller.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/providers/file/src/main/java/org/apache/sling/installer/provider/file/impl/FileInstaller.java?rev=1674245&r1=1674244&r2=1674245&view=diff
==============================================================================
--- sling/trunk/installer/providers/file/src/main/java/org/apache/sling/installer/provider/file/impl/FileInstaller.java (original)
+++ sling/trunk/installer/providers/file/src/main/java/org/apache/sling/installer/provider/file/impl/FileInstaller.java Fri Apr 17 09:46:46 2015
@@ -73,9 +73,13 @@ public class FileInstaller
 
     public void start(final OsgiInstaller installer, final SlingSettingsService settings) {
         for(final ScanConfiguration config : this.scanConfigurations) {
+            String key = config.directory;
+            if ( key.startsWith(settings.getSlingHomePath() + File.separator) ) {
+                key = "${sling.home}" + key.substring(settings.getSlingHomePath().length());
+            }
             logger.debug("Starting monitor for {}", config.directory);
             this.monitors.add(new FileMonitor(new File(config.directory),
-                    config.scanInterval, new Installer(installer, settings, config.directory, hash(config.directory))));
+                    config.scanInterval, new Installer(installer, settings, config.directory, hash(key))));
         }
     }
 
@@ -216,13 +220,13 @@ public class FileInstaller
     /**
      * Hash the string
      */
-    private static String hash(String value) {
+    private static String hash(final String value) {
         try {
             final MessageDigest d = MessageDigest.getInstance("MD5");
             d.update(value.getBytes("UTF-8"));
             final BigInteger bigInt = new BigInteger(1, d.digest());
             return new String(bigInt.toString(16));
-        } catch (Exception ignore) {
+        } catch (final Exception ignore) {
             // if anything goes wrong we just return the value
             return value;
         }