Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges


How to create custom pathbrowser predicate?


Level 3
Here is part of the dialog <path jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/pathbrowser" fieldDescription="Select media list item link" fieldLabel="Media List Item link" name="./path" predicate="predicate" rootPath="/content"> </path> import org.apache.commons.collections.Predicate; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Properties; import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.Service; import; import; import; @Component(label = "Content-page Predicate", description = "This predicate is used to restricted to allow selection of pages that have template content-page") @Service(value = Predicate.class) @Properties({ @Property(label = "Predicate Name", name = "", value = "predicate", propertyPrivate = true) }) public class ContentPagePredicate extends AbstractResourcePredicate { private static final String CQ_TEMPLATE_CONTENT = "/conf/pattern-lab/settings/wcm/templates/content-page"; @Override public boolean evaluate(Resource resource) { if (null != resource) { if (!resource.getResourceType().equals("cq:Page")) { return false; } Page page = resource.adaptTo(Page.class); return page.getTemplate().getName().equals(CQ_TEMPLATE_CONTENT); } return false; } }

Caused by: java.lang.VerifyError: Constructor must call super() or this() before return
Exception Details:
    com/day/cq/commons/predicate/AbstractResourcePredicate.<init>()V @1: return
    Error exists in the bytecode
    0x0000000: 2ab1  


any ideas?

1 Accepted Solution


Correct answer by
Community Advisor
1 Reply


Correct answer by
Community Advisor