Skip to content

Commit 1ddb13f

Browse files
committed
Merge branch 'feature/string-props-failsafe-parsing' into develop
2 parents 89d74cb + 7aa7a23 commit 1ddb13f

5 files changed

Lines changed: 18 additions & 8 deletions

File tree

changes.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 https://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
2424
<body>
2525

26+
<release version="1.14.2" date="not released">
27+
<action type="fix" dev="dtschentscher">
28+
Fix parsing content package properties with numeric values.
29+
</action>
30+
</release>
31+
2632
<release version="1.14.0" date="2020-12-21">
2733
<action type="add" dev="sseifert">
2834
conga-aem-maven-plugin:cloudmanager-all-package: Add "singlePackage" flag to alternatively build single "all" content package for all environments and nodes.

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/handlebars/helper/AemCryptoEncryptHelper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.security.GeneralSecurityException;
2929
import java.security.Key;
3030
import java.util.Map;
31+
import java.util.Objects;
3132

3233
import org.apache.commons.io.IOUtils;
3334
import org.apache.commons.lang3.BooleanUtils;
@@ -72,7 +73,7 @@ public Object apply(Object context, Options options, HelperContext pluginContext
7273
boolean cryptoSkip = false;
7374
Map<String, Object> aemPluginConfig = pluginContext.getGenericPluginConfig().get(PLUGIN_NAME);
7475
if (aemPluginConfig != null) {
75-
cryptoAesKeyUrl = (String)aemPluginConfig.get(PARAMETER_CRYPTO_AES_KEY_URL);
76+
cryptoAesKeyUrl = Objects.toString(aemPluginConfig.get(PARAMETER_CRYPTO_AES_KEY_URL), null);
7677
Object cryptoSkipObject = aemPluginConfig.get(PARAMETER_CRYPTO_SKIP);
7778
if (cryptoSkipObject != null) {
7879
if (cryptoSkipObject instanceof Boolean) {

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/validator/ContentPackageValidator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.util.Collections;
2828
import java.util.HashMap;
2929
import java.util.Map;
30+
import java.util.Objects;
3031

3132
import org.apache.commons.lang3.BooleanUtils;
3233
import org.apache.jackrabbit.filevault.maven.packaging.ValidatePackageMojo;
@@ -83,7 +84,7 @@ public Void apply(FileContext file, ValidatorContext context) throws ValidationE
8384
try {
8485
// validate package if a package type is defined
8586
// supported only within Maven
86-
String packageType = (String)ContentPackageProperties.get(file.getFile()).get(NAME_PACKAGE_TYPE);
87+
String packageType = Objects.toString(ContentPackageProperties.get(file.getFile()).get(NAME_PACKAGE_TYPE), null);
8788
if (packageType != null && context.getContainerContext() instanceof MavenContext) {
8889
validateContentPackage(file.getFile(), context, (MavenContext)context.getContainerContext());
8990
}

tooling/conga-aem-maven-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/maven/model/ContentPackageFile.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.Collections;
2929
import java.util.List;
3030
import java.util.Map;
31+
import java.util.Objects;
3132

3233
import io.wcm.devops.conga.plugins.aem.postprocessor.ContentPackagePropertiesPostProcessor;
3334

@@ -66,10 +67,10 @@ public final class ContentPackageFile {
6667
if (contentPackageProperties == null) {
6768
throw new IllegalArgumentException(ContentPackagePropertiesPostProcessor.MODEL_OPTIONS_PROPERTY + " missing.");
6869
}
69-
this.name = (String)contentPackageProperties.get(NAME_NAME);
70-
this.group = (String)contentPackageProperties.get(NAME_GROUP);
71-
this.version = (String)contentPackageProperties.get(NAME_VERSION);
72-
this.packageType = (String)contentPackageProperties.get(NAME_PACKAGE_TYPE);
70+
this.name = Objects.toString(contentPackageProperties.get(NAME_NAME), null);
71+
this.group = Objects.toString(contentPackageProperties.get(NAME_GROUP), null);
72+
this.version = Objects.toString(contentPackageProperties.get(NAME_VERSION), null);
73+
this.packageType = Objects.toString(contentPackageProperties.get(NAME_PACKAGE_TYPE), null);
7374

7475
this.variants = getVariants(roleData);
7576
}

tooling/conga-aem-maven-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/maven/model/ModelParser.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.util.LinkedHashSet;
3232
import java.util.List;
3333
import java.util.Map;
34+
import java.util.Objects;
3435
import java.util.Set;
3536
import java.util.stream.Collectors;
3637

@@ -81,7 +82,7 @@ public boolean hasRole(File nodeDir, String roleName) {
8182
Map<String, Object> data = getModelData(nodeDir);
8283
List<Map<String, Object>> roles = (List<Map<String, Object>>)data.get("roles");
8384
for (Map<String, Object> role : roles) {
84-
if (StringUtils.equals((String)role.get("role"), roleName)) {
85+
if (StringUtils.equals(Objects.toString(role.get("role"), null), roleName)) {
8586
return true;
8687
}
8788
}
@@ -165,7 +166,7 @@ private List<ContentPackageFile> collectPackages(Map<String, Object> data, File
165166

166167
private ContentPackageFile toContentPackageFile(Map<String, Object> fileData,
167168
Map<String, Object> roleData, File nodeDir) {
168-
String path = (String)fileData.get("path");
169+
String path = Objects.toString(fileData.get("path"), null);
169170
File file = new File(nodeDir, path);
170171
return new ContentPackageFile(file, fileData, roleData);
171172
}

0 commit comments

Comments
 (0)