When the user tries to "Quick Publish" a XF from the nagivation Menu, The servlet ExperienceFragmentsReferencesServlet is called, executing the function "writeJsonForReference" which check the cq:lastReplicated property must contain a date value which is newer than the date given in either the cq:lastModified or jcr:lastModified property. More info: https://github.com/Netcentric/aem-replication-metadata-validator/blob/main/README.md#fix-violations
This servlet throws a NPE if the property cq:lastModified is not available inside the jcr:content node below the XF policy reference because the function does not take into consideration whether the cq:lastModified property exists before comparing it.
String agentId) throws JSONException {
boolean published = false;
boolean outdated = false;
long lastPublished = 0L;
ReplicationStatus replStatus = null;
Resource resource = reference.getResource();
if (resource != null) {
LOG.debug("Analyzing reference for {}", resource.getPath());
replStatus = this.getReplicationStatus(resource, agentId);
if (replStatus != null) {
published = replStatus.isDelivered();
if (published) {
lastPublished = replStatus.getLastPublished().getTimeInMillis();
**outdated = lastPublished < reference.getLastModified();**
}
}
}
boolean considerReference = !published || outdated;
if (considerReference) {
LOG.debug("Considering reference at {} . Published: {}, outdated: {} ( lastPublished: {}, lastModified: {} )", new Object[]{reference.getResource().getPath(), published, outdated, new Date(lastPublished), new Date(reference.getLastModified())});
LOG.debug("Writing JSON entry for reference {} ({})", reference.getName(), reference.getType());
writer.object();
writer.key("type").value(reference.getType());
writer.key("path").value(reference.getResource().getPath());
writer.key("name").value(reference.getName());
writer.key("published").value(published);
writer.key("outdated").value(outdated);
writer.key("status").value(outdated ? "outdated" : "not available");
writer.key("disabled").value(!canReplicate(reference.getResource().getPath(), session));
writer.key("lastPublished").value(lastPublished);
writer.key("lastModified").value(reference.getLastModified());
writer.endObject();
} else {
LOG.debug("Not considering reference at {}", resource.getPath());
}
When the user tries to "Quick Publish" a XF from the nagivation Menu, The servlet ExperienceFragmentsReferencesServlet is called, executing the function "writeJsonForReference" which check the cq:lastReplicated property must contain a date value which is newer than the date given in either the cq:lastModified or jcr:lastModified property. More info: https://github.com/Netcentric/aem-replication-metadata-validator/blob/main/README.md#fix-violations
This servlet throws a NPE if the property cq:lastModified is not available inside the jcr:content node below the XF policy reference because the function does not take into consideration whether the cq:lastModified property exists before comparing it.
Please find attached the stacktrace. ExperienceFragmentsReferences_servlet_error.log