public void execute()

in src/main/java/org/apache/sling/feature/analyser/task/impl/CheckFeatureId.java [44:66]


    public void execute(AnalyserTaskContext ctx) throws Exception {
        Map<String, String> cfg = ctx.getConfiguration();
        String acceptedFeatureIds = cfg.get(CONFIG_KEY_ACCEPTED_FEATURE_IDS);
        if (acceptedFeatureIds == null) {
            // this is a comma-separated list of accepted
            throw new IllegalArgumentException("Missing 'accepted-feature-ids' configuration for feature-id analyser.");
        }
        Collection<ArtifactId> acceptedArtifactIds = new ArrayList<>();
        for (String acceptedFeatureId : acceptedFeatureIds.split(",")) {
            try {
                acceptedArtifactIds.add(ArtifactId.fromMvnId(acceptedFeatureId));
            } catch (IllegalArgumentException e) {
                throw new IllegalArgumentException(
                        "Invalid 'accepted-feature-ids' configuration for feature-id analyser, element '"
                                + acceptedFeatureId
                                + "' is not a valid maven coordinate string in format 'groupId:artifactId[:packaging[:classifier]]:version'",
                        e);
            }
        }
        if (!matchesAnyOf(ctx.getFeature().getId(), acceptedArtifactIds)) {
            ctx.reportError("Feature " + ctx.getFeature().getId() + " does not match any of the accepted feature ids ");
        }
    }