object.class.forName() not working

René Kray March 23, 2021

Hi folks:

I've found a lot of examples in the internet how to access any kind of java classes via .class.forName. I've tested this in my user macro:

#set ($string="")
#set ($base64=$string.class.forName('java.util.Base64'))
<pre>
base64: $base64.getClass()
</pre>

that results in "$base64.getClass()" and not as expected in "java.util.Base64".

An implicit initialization with "newInstance()" has changed nothing.

#set ($base64=$string.class.forName('java.util.Base64').newInstance())

Has someone an idea, what's wrong here?

I'm using Confluence 7.4.0 Server.

Thanks

1 answer

0 votes
Ulrik Schoth November 3, 2021

Hi René,

I just ran across the same problem. Have you found a solution in the meantime?

Regards,
Ulrik

René Kray November 3, 2021

Hi Ulrik:

Unfortunately not. The java support in confluence macros does not work as well as expected.

Regards, René

Ulrik Schoth November 3, 2021

Hi René,

meanwhile, I found a posting that gave me the impression that the option of using "object.class.forName()" has gone for security reasons. :-(

Regards,
Ulrik

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events