[jira] Created: (VELOCITY-579) Can not access a member of class X with modifiers "public" even if method is public

View: New views
7 Messages — Rating Filter:   Alert me  

[jira] Created: (VELOCITY-579) Can not access a member of class X with modifiers "public" even if method is public

by Velocity - Dev mailing list-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Can not access a member of class X with modifiers "public" even if method is public
-----------------------------------------------------------------------------------

                 Key: VELOCITY-579
                 URL: https://issues.apache.org/jira/browse/VELOCITY-579
             Project: Velocity
          Issue Type: Bug
          Components: Engine
    Affects Versions: 1.5
            Reporter: Eric Ballet Baz
            Priority: Blocker


When upgrading from 1.4 to 1.5 none of my template is working anymore.

For example :

  [javadoc]  ERROR [console:logVelocityMessage] - ASTMethod.execute() : exception invoking method 'tags' in class com.sun.tools.javadoc.MethodDocImpl
  [javadoc]  ERROR [console:logVelocityMessage] - java.lang.IllegalAccessException: Class org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl can not access a member of class com.sun.tools.javadoc.DocImpl with modifiers "public"

The method 'tags()' is public in com.sun.javadoc.Doc, but the implementation is package protected. So the java.lang.reflect.Method object is well returned by the org.apache.velocity.util.introspection.Introspector but not accessible from templates.
The same errors occured for example for javax.servlet.http.HttpSession Weblogic's implementation which is not public, but methods are !

It's not possible to wrap all objects javax.servlet.http.HttpSession into public implementations ...

The Introspector could call method.setAccessible(true) before returning Method object : if this method has been found, it is a public method !


--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


[jira] Commented: (VELOCITY-579) Can not access a member of class X with modifiers "public" even if method is public

by Velocity - Dev mailing list-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/VELOCITY-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12552773 ]

Will Glass-Husain commented on VELOCITY-579:
--------------------------------------------

Can you clarify?  Do you mean the method is public but the class is package protected?

> Can not access a member of class X with modifiers "public" even if method is public
> -----------------------------------------------------------------------------------
>
>                 Key: VELOCITY-579
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-579
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.5
>            Reporter: Eric Ballet Baz
>            Priority: Blocker
>
> When upgrading from 1.4 to 1.5 none of my template is working anymore.
> For example :
>   [javadoc]  ERROR [console:logVelocityMessage] - ASTMethod.execute() : exception invoking method 'tags' in class com.sun.tools.javadoc.MethodDocImpl
>   [javadoc]  ERROR [console:logVelocityMessage] - java.lang.IllegalAccessException: Class org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl can not access a member of class com.sun.tools.javadoc.DocImpl with modifiers "public"
> The method 'tags()' is public in com.sun.javadoc.Doc, but the implementation is package protected. So the java.lang.reflect.Method object is well returned by the org.apache.velocity.util.introspection.Introspector but not accessible from templates.
> The same errors occured for example for javax.servlet.http.HttpSession Weblogic's implementation which is not public, but methods are !
> It's not possible to wrap all objects javax.servlet.http.HttpSession into public implementations ...
> The Introspector could call method.setAccessible(true) before returning Method object : if this method has been found, it is a public method !

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


[jira] Commented: (VELOCITY-579) Can not access a member of class X with modifiers "public" even if method is public

by Velocity - Dev mailing list-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/VELOCITY-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12552867 ]

Nathan Bubna commented on VELOCITY-579:
---------------------------------------

Yeah, this isn't clear to me either.  Was this something that worked in Velocity 1.4 and stopped working in 1.5?

It sounds related to the discussion and fixes that happened in VELTOOLS-66.  Like maybe the changes made due to that bug report are what led to this?

It's just odd that this led to an IllegalAccessException if the public methods in question were not declared in either a public class or a public interface, then Velocity shouldn't have acknowledged them at all (i think), so that it would never try to call them and end up with an IllegalAccessException.  Or maybe i don't understand the problem?

Can you recreate the problem in small example that we could try out?

> Can not access a member of class X with modifiers "public" even if method is public
> -----------------------------------------------------------------------------------
>
>                 Key: VELOCITY-579
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-579
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.5
>            Reporter: Eric Ballet Baz
>            Priority: Blocker
>
> When upgrading from 1.4 to 1.5 none of my template is working anymore.
> For example :
>   [javadoc]  ERROR [console:logVelocityMessage] - ASTMethod.execute() : exception invoking method 'tags' in class com.sun.tools.javadoc.MethodDocImpl
>   [javadoc]  ERROR [console:logVelocityMessage] - java.lang.IllegalAccessException: Class org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl can not access a member of class com.sun.tools.javadoc.DocImpl with modifiers "public"
> The method 'tags()' is public in com.sun.javadoc.Doc, but the implementation is package protected. So the java.lang.reflect.Method object is well returned by the org.apache.velocity.util.introspection.Introspector but not accessible from templates.
> The same errors occured for example for javax.servlet.http.HttpSession Weblogic's implementation which is not public, but methods are !
> It's not possible to wrap all objects javax.servlet.http.HttpSession into public implementations ...
> The Introspector could call method.setAccessible(true) before returning Method object : if this method has been found, it is a public method !

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


[jira] Commented: (VELOCITY-579) Can not access a member of class X with modifiers "public" even if method is public

by Velocity - Dev mailing list-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/VELOCITY-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12594595#action_12594595 ]

Eric Ballet Baz commented on VELOCITY-579:
------------------------------------------

Yes it worked in Velocity 1.4 and stopped working in 1.5.

To reproduce the problem :

1) Add to your classpath the library "tools.jar" which you can find in the lib directory of the Sun JDK

2) In your java test program add these two lines :

com.sun.javadoc.MethodDoc methodDoc = new com.sun.tools.javadoc.MethodDocImpl(null, null);
context.put("methodDoc", methodDoc);

3) In your .vm template simply define :

$methodDoc.tags()

4) Run your test program

You should see something like :

ASTMethod.execute() : exception invoking method 'tags' in class com.sun.tools.javadoc.MethodDocImpl
java.lang.IllegalAccessException: Class org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl can
 not access a member of class com.sun.tools.javadoc.DocImpl with modifiers "public"
        at sun.reflect.Reflection.ensureMemberAccess(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:295)
        at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:245)
        at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:203)
        at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:294)
        at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
        at org.apache.velocity.Template.merge(Template.java:254)
        at Example.<init>(Example.java:100)
        at Example.main(Example.java:129)


But the method tags() is very public ! it's defined in the following interface :
http://java.sun.com/j2se/1.5.0/docs/guide/javadoc/doclet/spec/com/sun/javadoc/Doc.html#tags()
and implemented as a public method in DocImpl.

The problem here is that the class DocImpl is not public even if she implements public methods, this class is package protected :

abstract class DocImpl implements Doc, Comparable

This is exactly the same problem with the Weblogic implementation of javax.servlet.http.HttpSession which is not a public class, even if its methods are public!

> Can not access a member of class X with modifiers "public" even if method is public
> -----------------------------------------------------------------------------------
>
>                 Key: VELOCITY-579
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-579
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.5
>            Reporter: Eric Ballet Baz
>            Priority: Blocker
>
> When upgrading from 1.4 to 1.5 none of my template is working anymore.
> For example :
>   [javadoc]  ERROR [console:logVelocityMessage] - ASTMethod.execute() : exception invoking method 'tags' in class com.sun.tools.javadoc.MethodDocImpl
>   [javadoc]  ERROR [console:logVelocityMessage] - java.lang.IllegalAccessException: Class org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl can not access a member of class com.sun.tools.javadoc.DocImpl with modifiers "public"
> The method 'tags()' is public in com.sun.javadoc.Doc, but the implementation is package protected. So the java.lang.reflect.Method object is well returned by the org.apache.velocity.util.introspection.Introspector but not accessible from templates.
> The same errors occured for example for javax.servlet.http.HttpSession Weblogic's implementation which is not public, but methods are !
> It's not possible to wrap all objects javax.servlet.http.HttpSession into public implementations ...
> The Introspector could call method.setAccessible(true) before returning Method object : if this method has been found, it is a public method !

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


[jira] Resolved: (VELOCITY-579) Can not access a member of class X with modifiers "public" even if method is public

by Velocity - Dev mailing list-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/VELOCITY-579?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nathan Bubna resolved VELOCITY-579.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.6

Appears to have been fixed in 1.6, since i cannot replicate this anymore with testcase or following Eric's instructions.

> Can not access a member of class X with modifiers "public" even if method is public
> -----------------------------------------------------------------------------------
>
>                 Key: VELOCITY-579
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-579
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.5
>            Reporter: Eric Ballet Baz
>            Priority: Blocker
>             Fix For: 1.6
>
>
> When upgrading from 1.4 to 1.5 none of my template is working anymore.
> For example :
>   [javadoc]  ERROR [console:logVelocityMessage] - ASTMethod.execute() : exception invoking method 'tags' in class com.sun.tools.javadoc.MethodDocImpl
>   [javadoc]  ERROR [console:logVelocityMessage] - java.lang.IllegalAccessException: Class org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl can not access a member of class com.sun.tools.javadoc.DocImpl with modifiers "public"
> The method 'tags()' is public in com.sun.javadoc.Doc, but the implementation is package protected. So the java.lang.reflect.Method object is well returned by the org.apache.velocity.util.introspection.Introspector but not accessible from templates.
> The same errors occured for example for javax.servlet.http.HttpSession Weblogic's implementation which is not public, but methods are !
> It's not possible to wrap all objects javax.servlet.http.HttpSession into public implementations ...
> The Introspector could call method.setAccessible(true) before returning Method object : if this method has been found, it is a public method !

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


[jira] Reopened: (VELOCITY-579) Can not access a member of class X with modifiers "public" even if method is public

by Velocity - Dev mailing list-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/VELOCITY-579?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nathan Bubna reopened VELOCITY-579:
-----------------------------------


@#%!  So, in hopes of creating a beta1 test build, i switch to java 1.4.2 and tried running things.  apart from the various 1.5-isms that snuck past me, i also discovered that the test case for this bugger fails in Java 1.4.x.

Testcase: testPublicMethodInheritedFromPrivateClass took 0.031 sec
        FAILED
expected:<bar> but was:<$bar.bar()>
junit.framework.ComparisonFailure: expected:<bar> but was:<$bar.bar()>
        at org.apache.velocity.test.BaseEvalTestCase.assertEvalEquals(BaseEvalTestCase.java:85)
        at org.apache.velocity.test.issues.Velocity579TestCase.testPublicMethodInheritedFromPrivateClass(Velocity579TestCase.java:45)

lame.  so why do we still support java 1.4, again?

> Can not access a member of class X with modifiers "public" even if method is public
> -----------------------------------------------------------------------------------
>
>                 Key: VELOCITY-579
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-579
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.5
>            Reporter: Eric Ballet Baz
>            Priority: Blocker
>             Fix For: 1.6
>
>
> When upgrading from 1.4 to 1.5 none of my template is working anymore.
> For example :
>   [javadoc]  ERROR [console:logVelocityMessage] - ASTMethod.execute() : exception invoking method 'tags' in class com.sun.tools.javadoc.MethodDocImpl
>   [javadoc]  ERROR [console:logVelocityMessage] - java.lang.IllegalAccessException: Class org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl can not access a member of class com.sun.tools.javadoc.DocImpl with modifiers "public"
> The method 'tags()' is public in com.sun.javadoc.Doc, but the implementation is package protected. So the java.lang.reflect.Method object is well returned by the org.apache.velocity.util.introspection.Introspector but not accessible from templates.
> The same errors occured for example for javax.servlet.http.HttpSession Weblogic's implementation which is not public, but methods are !
> It's not possible to wrap all objects javax.servlet.http.HttpSession into public implementations ...
> The Introspector could call method.setAccessible(true) before returning Method object : if this method has been found, it is a public method !

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


[jira] Resolved: (VELOCITY-579) Can not access a member of class X with modifiers "public" even if method is public

by Velocity - Dev mailing list-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/VELOCITY-579?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nathan Bubna resolved VELOCITY-579.
-----------------------------------

    Resolution: Fixed

Sorry.  Quasi-false alarm.  It was the test for VELOCITY-70 that failed...

> Can not access a member of class X with modifiers "public" even if method is public
> -----------------------------------------------------------------------------------
>
>                 Key: VELOCITY-579
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-579
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.5
>            Reporter: Eric Ballet Baz
>            Priority: Blocker
>             Fix For: 1.6
>
>
> When upgrading from 1.4 to 1.5 none of my template is working anymore.
> For example :
>   [javadoc]  ERROR [console:logVelocityMessage] - ASTMethod.execute() : exception invoking method 'tags' in class com.sun.tools.javadoc.MethodDocImpl
>   [javadoc]  ERROR [console:logVelocityMessage] - java.lang.IllegalAccessException: Class org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl can not access a member of class com.sun.tools.javadoc.DocImpl with modifiers "public"
> The method 'tags()' is public in com.sun.javadoc.Doc, but the implementation is package protected. So the java.lang.reflect.Method object is well returned by the org.apache.velocity.util.introspection.Introspector but not accessible from templates.
> The same errors occured for example for javax.servlet.http.HttpSession Weblogic's implementation which is not public, but methods are !
> It's not possible to wrap all objects javax.servlet.http.HttpSession into public implementations ...
> The Introspector could call method.setAccessible(true) before returning Method object : if this method has been found, it is a public method !

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...

LightInTheBox - Buy quality products at wholesale price