You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by da...@apache.org on 2018/05/02 15:07:18 UTC
[sling-org-apache-sling-feature-modelconverter] branch master
updated: Dont use colons in converted file names if the feature name
contained a colon
This is an automated email from the ASF dual-hosted git repository.
davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-modelconverter.git
The following commit(s) were added to refs/heads/master by this push:
new cf07606 Dont use colons in converted file names if the feature name contained a colon
cf07606 is described below
commit cf076065096e46fb43b15798a6f633848ef18b1b
Author: David Bosschaert <bo...@adobe.com>
AuthorDate: Wed May 2 16:06:32 2018 +0100
Dont use colons in converted file names if the feature name contained a colon
---
.../apache/sling/feature/modelconverter/ProvisioningToFeature.java | 2 +-
.../org/apache/sling/feature/modelconverter/ModelConverterTest.java | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/sling/feature/modelconverter/ProvisioningToFeature.java b/src/main/java/org/apache/sling/feature/modelconverter/ProvisioningToFeature.java
index 4d3e4c5..fd2766d 100644
--- a/src/main/java/org/apache/sling/feature/modelconverter/ProvisioningToFeature.java
+++ b/src/main/java/org/apache/sling/feature/modelconverter/ProvisioningToFeature.java
@@ -84,7 +84,7 @@ public class ProvisioningToFeature {
if (id == null) {
id = f.getId().getArtifactId();
}
-
+ id = id.replaceAll("[:]","");
id = bareFileName + "_" + id;
File outFile = new File(outDir, id + ".json");
diff --git a/src/test/java/org/apache/sling/feature/modelconverter/ModelConverterTest.java b/src/test/java/org/apache/sling/feature/modelconverter/ModelConverterTest.java
index 15f6dbd..68a9848 100644
--- a/src/test/java/org/apache/sling/feature/modelconverter/ModelConverterTest.java
+++ b/src/test/java/org/apache/sling/feature/modelconverter/ModelConverterTest.java
@@ -25,8 +25,6 @@ import org.apache.sling.feature.io.ArtifactManager;
import org.apache.sling.feature.io.ArtifactManagerConfig;
import org.apache.sling.feature.io.IOUtils;
import org.apache.sling.feature.io.json.FeatureJSONReader.SubstituteVariables;
-import org.apache.sling.feature.modelconverter.FeatureToProvisioning;
-import org.apache.sling.feature.modelconverter.ProvisioningToFeature;
import org.apache.sling.provisioning.model.Artifact;
import org.apache.sling.provisioning.model.ArtifactGroup;
import org.apache.sling.provisioning.model.Configuration;
@@ -65,6 +63,7 @@ import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -190,6 +189,7 @@ public class ModelConverterTest {
for (File f : generated) {
String baseName = f.getName().substring(0, f.getName().length() - ".json".length());
+ assertFalse("File name cannot contain a colon", baseName.contains(":"));
File genFile = new File(tempDir.toFile(), baseName + ".txt");
allGenerateProvisioningModelFiles.add(genFile);
FeatureToProvisioning.convert(f, genFile.getAbsolutePath(), artifactManager);
--
To stop receiving notification emails like this one, please contact
davidb@apache.org.