[jira] [Comment Edited] (VELOCITY-984) Velocity calls method of abstract superclass leading to an IllegalAccessException

"Thomas Mortagne (Jira)" <[email protected]>
Newsgroups gmane.comp.jakarta.velocity.devel
Message-ID <[email protected]>
    [ https://issues.apache.org/jira/browse/VELOCITY-984?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17887792#comment-17887792 ] 

Thomas Mortagne edited comment on VELOCITY-984 at 10/9/24 7:07 AM:
-------------------------------------------------------------------

bq. I guess that should not be too hard indeed, I will try that quickly.

Ha but no, I keep forgetting that {{canAccess}} needs an instance of the class, so not easy to use it in the context of ClassMap/MethodMap. It would require quite a change of logic.

But {AccessibleObject#trySetAccessible()}} (Java 9+ too) might still be better in terms of performances than the current try/catch.


was (Author: tmortagne):
bq. I guess that should not be too hard indeed, I will try that quickly.

Ha but no, I keep forgetting that {{canAccess}} needs an instance of the class, so not easy to use it in the context of ClassMap/MethodMap. It would require quite a change of logic.

But AccessibleObject#trySetAccessible() (Java 9+ too) might still be better in terms of performances than the current try/catch.

> Velocity calls method of abstract superclass leading to an IllegalAccessException
> ---------------------------------------------------------------------------------
>
>                 Key: VELOCITY-984
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-984
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 2.4
>            Reporter: Christoph Lenggenhager
>            Assignee: Claude Brisson
>            Priority: Major
>         Attachments: Velocity952TestCase.java
>
>
> With the changes introduced in VELOCITY-952, our templates fail with an IllegalAccessException.
> The exception is caused by a template that has a variable of type StringBuilder and calls append on it. The introduced changes choose the implementation of the method of AbstractStringBuilder to be executed, which leads to the mentioned IllegalAccessExceptions.
> I've attached an extended version of Velocity952TestCase.java that reproduces the problem with an additional test.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.