Bruno Gonçalves created CXF-8411:
------------------------------------

             Summary: Improve FastInfoset interceptors' compatibility with 
GraalVM native compilation
                 Key: CXF-8411
                 URL: https://issues.apache.org/jira/browse/CXF-8411
             Project: CXF
          Issue Type: Improvement
          Components: Core
    Affects Versions: 3.4.2
            Reporter: Bruno Gonçalves


The FastInfoset jar is an optional dependency of CXF which means most 
applications will not have it on their classpath. When that is the case,  the 
GraalVM native compilation of {{FIStaxInInterceptor}} and 
{{FIStaxOutInterceptor}} will fail. That in itself is not a big deal as it 
would be trivial to apply some substitutions however, the fact that the two 
interceptors use classes from FastInfoset in the return values of some of their 
methods makes them impossible to substitute.

The two offending methods are:
{{FIStaxInInterceptor}} -> {{private StAXDocumentParser getParser(InputStream 
in)}}
{{FIStaxOutInterceptor}} - > {{private StAXDocumentSerializer 
getOutput(OutputStream out)}}

I suggest replacing the FastInfoset classes in the return values with the 
appropriate StAX interfaces: {{XMLStreamReader}} and {{XMLStreamWriter}} 
respectively. There's also a variable in {{FIStaxOutInterceptor}} whose type 
could be changed in the same way. These few changes would make the two 
interceptors trivial to substitute when FastInfoset is not present at native 
compilation time.

If there's interest in this change, I can offer a PR pretty quickly.

An alternative to these changes could be to turn the FastInfoset support into 
an extension which could then be disabled during native compilation. However, 
the implications of that kind of change are not something I can properly 
appreciate with my limited knowledge of the CXF codebase.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to