JSP Expression Language (eg: "${resource.path}") to call the getPath() method
of a Resource object returned by ResourceResolver.findResources() result in
error.
----------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: SLING-1414
URL: https://issues.apache.org/jira/browse/SLING-1414
Project: Sling
Issue Type: Bug
Components: JCR
Environment: CQ5.2.1/CQ5.3
Reporter: zhangchunlong
Priority: Minor
Often in the JSPs, we call the ResourceResolver.findResources(query, "xpath")
method to return an Iterator<Resource> object, which we iterate through using
JSTL and EL syntax. When we attempt to access the getPath() method of each
Resource, the following exception is thrown:
java.lang.IllegalAccessException: Class javax.el.BeanELResolver can not access
a member of class
org.apache.sling.jcr.resource.internal.helper.jcr.JcrItemResource with
modifiers "public".
This works with CQ5.2.1 with no problem before. The issue happens on CQ5.3 GA
release.
Example codes to re-produce the error in CQ5.3.
Iterator<Resource> found = resourceResolver.findResources("//element(*,
nt:unstructured)","xpath");
while(found.hasNext()){
try{
Resource foundResource = found.next();
pageContext.setAttribute("foundResource", foundResource);
%>${foundResource.path}<%
}
catch(Exception e){
%><%=e.getMessage()%><%
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.