[jira] [Commented] (CXF-7361) Java 9 support for CXFAuthenticator

2018-10-25 Thread Lukasz Lech (JIRA)


[ 
https://issues.apache.org/jira/browse/CXF-7361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16663447#comment-16663447
 ] 

Lukasz Lech commented on CXF-7361:
--

Wow, over a year and no reaction. Is the project dead?

Unfortunately, other Apache projects like Tika depends on it...

Java 10 tolerates such misuse with warnings, but with subsequent versions, it's 
likely not to work at all.

It should be reported as bug, not improvement.

> Java 9 support for CXFAuthenticator
> ---
>
> Key: CXF-7361
> URL: https://issues.apache.org/jira/browse/CXF-7361
> Project: CXF
>  Issue Type: Improvement
>Affects Versions: 3.1.11
>Reporter: Romain Manni-Bucau
>Priority: Major
>
> with java 9, Authenticator getDefault() should be used instead of field.get() 
>  (setAccessible fails)  + unsafe should be used to define the class instead 
> of the failing ClassLoader.defineClass.
> All that with reflection of course and in fallback mode probably since for 
> java 8 it is better to not do it (or it is not available - getDefault() 
> typically).
> Workaround ATM is to call CXFAuthenticator.addAuthenticator(); manually and 
> ignore the exception, it initializes the instance then it doesn't fail but 
> the feature is lost until it gets fixed as mentionned before.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CXF-7361) Java 9 support for CXFAuthenticator

2018-10-25 Thread Freeman Fang (JIRA)


[ 
https://issues.apache.org/jira/browse/CXF-7361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16664639#comment-16664639
 ] 

Freeman Fang commented on CXF-7361:
---

Since JDK 11 won't have Unsafe.defineClass anymore, we need to use 
MethodHandles.Lookup.defineClass instead 

> Java 9 support for CXFAuthenticator
> ---
>
> Key: CXF-7361
> URL: https://issues.apache.org/jira/browse/CXF-7361
> Project: CXF
>  Issue Type: Improvement
>Affects Versions: 3.1.11
>Reporter: Romain Manni-Bucau
>Assignee: Freeman Fang
>Priority: Major
>
> with java 9, Authenticator getDefault() should be used instead of field.get() 
>  (setAccessible fails)  + unsafe should be used to define the class instead 
> of the failing ClassLoader.defineClass.
> All that with reflection of course and in fallback mode probably since for 
> java 8 it is better to not do it (or it is not available - getDefault() 
> typically).
> Workaround ATM is to call CXFAuthenticator.addAuthenticator(); manually and 
> ignore the exception, it initializes the instance then it doesn't fail but 
> the feature is lost until it gets fixed as mentionned before.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CXF-7361) Java 9 support for CXFAuthenticator

2018-10-25 Thread Romain Manni-Bucau (JIRA)


[ 
https://issues.apache.org/jira/browse/CXF-7361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16664722#comment-16664722
 ] 

Romain Manni-Bucau commented on CXF-7361:
-

Or classloader defineClass which is used in EE libs. Works well for not named 
modules.

> Java 9 support for CXFAuthenticator
> ---
>
> Key: CXF-7361
> URL: https://issues.apache.org/jira/browse/CXF-7361
> Project: CXF
>  Issue Type: Improvement
>Affects Versions: 3.1.11
>Reporter: Romain Manni-Bucau
>Assignee: Freeman Fang
>Priority: Major
>
> with java 9, Authenticator getDefault() should be used instead of field.get() 
>  (setAccessible fails)  + unsafe should be used to define the class instead 
> of the failing ClassLoader.defineClass.
> All that with reflection of course and in fallback mode probably since for 
> java 8 it is better to not do it (or it is not available - getDefault() 
> typically).
> Workaround ATM is to call CXFAuthenticator.addAuthenticator(); manually and 
> ignore the exception, it initializes the instance then it doesn't fail but 
> the feature is lost until it gets fixed as mentionned before.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CXF-7361) Java 9 support for CXFAuthenticator

2018-10-25 Thread Freeman Fang (JIRA)


[ 
https://issues.apache.org/jira/browse/CXF-7361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16664731#comment-16664731
 ] 

Freeman Fang commented on CXF-7361:
---

Hi Romain,

I'm a little bit confused.

Currently CXFAuthenticator just use Classloader defineClass, but you mentioned
{code}
unsafe should be used to define the class instead of the failing 
ClassLoader.defineClass.
{code}
when you reported this problem.

Could you please elaborate it?

Thanks!
Freeman




> Java 9 support for CXFAuthenticator
> ---
>
> Key: CXF-7361
> URL: https://issues.apache.org/jira/browse/CXF-7361
> Project: CXF
>  Issue Type: Improvement
>Affects Versions: 3.1.11
>Reporter: Romain Manni-Bucau
>Assignee: Freeman Fang
>Priority: Major
>
> with java 9, Authenticator getDefault() should be used instead of field.get() 
>  (setAccessible fails)  + unsafe should be used to define the class instead 
> of the failing ClassLoader.defineClass.
> All that with reflection of course and in fallback mode probably since for 
> java 8 it is better to not do it (or it is not available - getDefault() 
> typically).
> Workaround ATM is to call CXFAuthenticator.addAuthenticator(); manually and 
> ignore the exception, it initializes the instance then it doesn't fail but 
> the feature is lost until it gets fixed as mentionned before.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CXF-7361) Java 9 support for CXFAuthenticator

2018-10-26 Thread Romain Manni-Bucau (JIRA)


[ 
https://issues.apache.org/jira/browse/CXF-7361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16664837#comment-16664837
 ] 

Romain Manni-Bucau commented on CXF-7361:
-

On Java 11 with last CXF version, CXFAuthenticator passes. Things changed quite 
a bit since java 9 so not 100% sure why but I guess while CXF is an unnamed 
module we are fine.

> Java 9 support for CXFAuthenticator
> ---
>
> Key: CXF-7361
> URL: https://issues.apache.org/jira/browse/CXF-7361
> Project: CXF
>  Issue Type: Improvement
>Affects Versions: 3.1.11
>Reporter: Romain Manni-Bucau
>Assignee: Freeman Fang
>Priority: Major
>
> with java 9, Authenticator getDefault() should be used instead of field.get() 
>  (setAccessible fails)  + unsafe should be used to define the class instead 
> of the failing ClassLoader.defineClass.
> All that with reflection of course and in fallback mode probably since for 
> java 8 it is better to not do it (or it is not available - getDefault() 
> typically).
> Workaround ATM is to call CXFAuthenticator.addAuthenticator(); manually and 
> ignore the exception, it initializes the instance then it doesn't fail but 
> the feature is lost until it gets fixed as mentionned before.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CXF-7361) Java 9 support for CXFAuthenticator

2018-10-26 Thread Freeman Fang (JIRA)


[ 
https://issues.apache.org/jira/browse/CXF-7361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16664861#comment-16664861
 ] 

Freeman Fang commented on CXF-7361:
---

Yep, it can pass with 
{code}
WARNING: Illegal reflective access
{code}

I'm trying to fix the WARNING. 
CXF-7838 tracked this.

I will close this issue for now.

> Java 9 support for CXFAuthenticator
> ---
>
> Key: CXF-7361
> URL: https://issues.apache.org/jira/browse/CXF-7361
> Project: CXF
>  Issue Type: Improvement
>Affects Versions: 3.1.11
>Reporter: Romain Manni-Bucau
>Assignee: Freeman Fang
>Priority: Major
>
> with java 9, Authenticator getDefault() should be used instead of field.get() 
>  (setAccessible fails)  + unsafe should be used to define the class instead 
> of the failing ClassLoader.defineClass.
> All that with reflection of course and in fallback mode probably since for 
> java 8 it is better to not do it (or it is not available - getDefault() 
> typically).
> Workaround ATM is to call CXFAuthenticator.addAuthenticator(); manually and 
> ignore the exception, it initializes the instance then it doesn't fail but 
> the feature is lost until it gets fixed as mentionned before.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)