You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by si...@apache.org on 2019/08/30 13:34:53 UTC
[sling-org-apache-sling-feature-cpconverter] branch master updated:
[cp2fm] -SNAPSHOT sub content-packages are not overridden when extracting
them from the main package
This is an automated email from the ASF dual-hosted git repository.
simonetripodi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-cpconverter.git
The following commit(s) were added to refs/heads/master by this push:
new acc3e98 [cp2fm] -SNAPSHOT sub content-packages are not overridden when extracting them from the main package
acc3e98 is described below
commit acc3e9825730c86bfa92cb43ba210832fae0605e
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Fri Aug 30 15:34:44 2019 +0200
[cp2fm] -SNAPSHOT sub content-packages are not overridden when
extracting them from the main package
---
.../cpconverter/handlers/AbstractContentPackageHandler.java | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/main/java/org/apache/sling/feature/cpconverter/handlers/AbstractContentPackageHandler.java b/src/main/java/org/apache/sling/feature/cpconverter/handlers/AbstractContentPackageHandler.java
index 036713b..60fc01c 100644
--- a/src/main/java/org/apache/sling/feature/cpconverter/handlers/AbstractContentPackageHandler.java
+++ b/src/main/java/org/apache/sling/feature/cpconverter/handlers/AbstractContentPackageHandler.java
@@ -29,6 +29,8 @@ import org.apache.sling.feature.cpconverter.ContentPackage2FeatureModelConverter
public abstract class AbstractContentPackageHandler extends AbstractRegexEntryHandler {
+ private static final String SNAPSHOT_POSTFIX = "-SNAPSHOT";
+
private final File temporaryDir = new File(System.getProperty("java.io.tmpdir"), "sub-content-packages");
public AbstractContentPackageHandler() {
@@ -43,6 +45,16 @@ public abstract class AbstractContentPackageHandler extends AbstractRegexEntryHa
File temporaryContentPackage = new File(temporaryDir, entry.getName());
+ if (entry.getName().contains(SNAPSHOT_POSTFIX) && temporaryContentPackage.exists()) {
+ logger.debug("SNAPSHOT content-package detected, deleting previous version on {}...", temporaryContentPackage);
+ if (temporaryContentPackage.delete()) {
+ logger.debug("Previous SNAPSHOT content-package version on {} deleted", temporaryContentPackage);
+ } else {
+ logger.warn("Impossible to delete previous SNAPSHOT content-package version on {}, please check current user permissions",
+ temporaryContentPackage);
+ }
+ }
+
if (!temporaryContentPackage.exists()) {
logger.debug("Extracting sub-content package '{}' to {} for future analysis...", entry.getName(), temporaryContentPackage);