You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "zhangchunlong (JIRA)" <ji...@apache.org> on 2010/03/01 10:14:05 UTC

[jira] Created: (SLING-1414) JSP Expression Language (eg: "${resource.path}") to call the getPath() method of a Resource object returned by ResourceResolver.findResources() result in error.

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.


[jira] Resolved: (SLING-1414) JSP Expression Language (eg: "${resource.path}") to call the getPath() method of a Resource object returned by ResourceResolver.findResources() result in error.

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-1414?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved SLING-1414.
--------------------------------------

    Fix Version/s: JCR Resource 2.0.8
       Resolution: Fixed

Fixed in Rev. 984374 by making the JcrNodeResource and JcrPropertyResource classes package private thus triggering the BeanELResolver to not take the shortcut but find a public class or interface in the class/interface tree providing the method. This would then ultimately be the Resource interface.

> 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
>    Affects Versions: JCR Resource 2.0.6
>         Environment: CQ5.2.1/CQ5.3
>            Reporter: zhangchunlong
>            Assignee: Felix Meschberger
>            Priority: Minor
>             Fix For: JCR Resource 2.0.8
>
>
> 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.


[jira] Updated: (SLING-1414) JSP Expression Language (eg: "${resource.path}") to call the getPath() method of a Resource object returned by ResourceResolver.findResources() result in error.

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-1414?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carsten Ziegeler updated SLING-1414:
------------------------------------

    Affects Version/s: JCR Resource 2.0.6

> 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
>    Affects Versions: JCR Resource 2.0.6
>         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.


[jira] Commented: (SLING-1414) JSP Expression Language (eg: "${resource.path}") to call the getPath() method of a Resource object returned by ResourceResolver.findResources() result in error.

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-1414?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12897220#action_12897220 ] 

Felix Meschberger commented on SLING-1414:
------------------------------------------

Hmm, I found the problem and I think it is really a bug in the Tomcat/Jasper implementation of the BeanELResolver.getMethod(Class, Method) method. This method contains a shortcut of the form:

       if (m == null || Modifier.isPublic(type.getModifiers())) {
            return m;
       }

Assuming that the method is declared in the type and if the type is public, the method may be called.

In our situation, the type is actually "JcrNodeResource" which in fact is public. But the method (m) is declared by the package private "JcrItemResource" class. So the short-cut should probably rather be:

       if (m == null || (Modifier.isPublic(type.getModifiers()) && m.getDeclaringClass() == type)) {
            return m;
       }

Not 100% sure though. On the other hand we can work around this problem here by making both JcrNodeResource and JcrItemResource (and also JcrPropertyResource) either public or package private.

I like package private more, because it is an internal detail of the JcrResourceProvider implementation also located in the same package.

> 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
>    Affects Versions: JCR Resource 2.0.6
>         Environment: CQ5.2.1/CQ5.3
>            Reporter: zhangchunlong
>            Assignee: Felix Meschberger
>            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.


[jira] Assigned: (SLING-1414) JSP Expression Language (eg: "${resource.path}") to call the getPath() method of a Resource object returned by ResourceResolver.findResources() result in error.

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-1414?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger reassigned SLING-1414:
----------------------------------------

    Assignee: Felix Meschberger

> 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
>    Affects Versions: JCR Resource 2.0.6
>         Environment: CQ5.2.1/CQ5.3
>            Reporter: zhangchunlong
>            Assignee: Felix Meschberger
>            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.