Closed esodot closed 2 years ago
Our class which seems to case the error looks like this:
package aem.zeppelin.commons.model;
import aem.zeppelin.commons.config.AppConstants;
import aem.zeppelin.commons.handler.link.LinkHandler;
import aem.zeppelin.commons.utils.PageUtils;
import aem.zeppelin.filters.pojo.ZBMFilter;
import com.day.cq.wcm.api.Page;
import com.day.text.Text;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.models.annotations.injectorspecific.ScriptVariable;
import org.apache.sling.models.annotations.injectorspecific.Self;
import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.List;
/**
* Sling Model for the Used Machine Filter component
*/
@Slf4j
@Model(adaptables = { SlingHttpServletRequest.class })
public class FilterUsedMachineHomepageModel {
@ScriptVariable
private Page currentPage;
@Self
private LinkHandler linkHandler;
@Getter
private List<Category> categories = new ArrayList<>();
@Getter
private Category defaultCategory;
@PostConstruct
protected void activate() {
List<Page> categoryPages = getCategoryPages();
for (Page categoryPage : categoryPages) {
Category category = new Category(getUrlFromPath(categoryPage), categoryPage.getTitle());
if (PageUtils.isAllCategoryPage(categoryPage)) {
this.defaultCategory = category;
} else {
categories.add(category);
}
}
}
private List<Page> getCategoryPages() {
String sgePath = Text.getAbsoluteParent(currentPage.getPath(), AppConstants.SGE_LEVEL);
String categoriesRoot = sgePath + "/gebrauchtmaschinen";
Page categoriesRootPage = currentPage.getPageManager().getPage(categoriesRoot);
return Lists.newArrayList(categoriesRootPage.listChildren());
}
public String getManufacturerFilterId() {
return ZBMFilter.MANUFACTURER.id;
}
public String getLocationFilterId() {
return ZBMFilter.LOCATION.id;
}
private String getUrlFromPath(Page categoryPage) {
return linkHandler.build(categoryPage).getUrl();
}
@Getter
@AllArgsConstructor
public static class Category {
private String url;
private String label;
}
}
Hi, sorry I missed this. The stack trace mentions a null pointer exception in a class from the com.adobe.platform.experience.selfservice.cqrules.checks.java
package, which isn't part of this plugin.
I know Adobe themselves have been developing custom rules to integrate into the Cloud Manager pipeline. This may be related but I'm not sure. I don't think that code has been open-sourced.
Please contact Adobe if this is still an issue.
Hello, we are running the Sonar check on Adobe Experience Manager Custom Application and getting a Sonar NPE