This is an automated email from the ASF dual-hosted git repository.
simonetripodi pushed a commit to branch SLING-8251
in repository
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-analyser.git
The following commit(s) were added to refs/heads/SLING-8251 by this push:
new 315abcc SLING-8251 - Support checking dependencies for content
packages
315abcc is described below
commit 315abccfdb8888203dbd643af6342dfc6a146a17
Author: Simo Tripodi <[email protected]>
AuthorDate: Wed Jun 12 17:45:26 2019 +0200
SLING-8251 - Support checking dependencies for content packages
avoid to throw an exception if a content-package file does not exist or
it is not a file, but rather track it in the context
---
.../analyser/task/impl/CheckContentPackagesDependencies.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git
a/src/main/java/org/apache/sling/feature/analyser/task/impl/CheckContentPackagesDependencies.java
b/src/main/java/org/apache/sling/feature/analyser/task/impl/CheckContentPackagesDependencies.java
index 937472a..20e5a15 100644
---
a/src/main/java/org/apache/sling/feature/analyser/task/impl/CheckContentPackagesDependencies.java
+++
b/src/main/java/org/apache/sling/feature/analyser/task/impl/CheckContentPackagesDependencies.java
@@ -16,6 +16,7 @@
*/
package org.apache.sling.feature.analyser.task.impl;
+import java.io.File;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
@@ -66,7 +67,13 @@ public class CheckContentPackagesDependencies implements
AnalyserTask {
}
private void onDescriptor(AnalyserTaskContext ctx, ArtifactDescriptor
descriptor, Map<PackageId, Dependency[]> dependenciesMap) throws Exception {
- try (VaultPackage vaultPackage =
packageManager.open(descriptor.getArtifactFile(), true)) {
+ File artifactFile = descriptor.getArtifactFile();
+ if (!artifactFile.exists() || !artifactFile.isFile()) {
+ ctx.reportError("Artifact file " + artifactFile + " does not exist
or it is not a file");
+ return;
+ }
+
+ try (VaultPackage vaultPackage = packageManager.open(artifactFile,
true)) {
PackageId packageId = vaultPackage.getId();
dependenciesMap.put(packageId, vaultPackage.getDependencies());