[CXF-8658] CXF 3.4.5 breaks binary compatibility with 3.4.1 in TypeClassInitializer#908
[CXF-8658] CXF 3.4.5 breaks binary compatibility with 3.4.1 in TypeClassInitializer#908garydgregory wants to merge 1 commit intoapache:3.4.x-fixesfrom
Conversation
TypeClassInitializer.
| Bus bus; | ||
|
|
||
| @Deprecated // CXF-8658 | ||
| public TypeClassInitializer(ServiceInfo serviceInfo, |
There was a problem hiding this comment.
@garydgregory we cannot do that, it will blow with NPE in the TypeClassInitializer::createFaultClass
There was a problem hiding this comment.
Well, crud :-( how do you propose fixing the binary break? Using the same kind of code from 3.4.1?
There was a problem hiding this comment.
There are a few options, the bus instance should be taken from somewhere, for example if we bring constructor back, we need to introduce setBus(Bus b) method which has to be called, not ideal but a solution nonetheless.
Another option - use the bus from the thread local context using BusFactory::getThreadDefaultBus, the caller context should make sure it is set.
There was a problem hiding this comment.
or just sthg like (bus != null? bus.getExtension( ExceptionCreator.class) : new ExceptionCreator()).createExceptionClass(cls);)
There was a problem hiding this comment.
@rmannibucau afaik does not exist anymore, ExceptionCreator is replaced by ExceptionClassGenerator which also needs bus ... (because of ASM Helper).
There was a problem hiding this comment.
Sounds like the bus is passed just for the extensions so replacing it by a Function<Class<?>, Object> (real extension "lookup") could make it trivial to replace wen bus is null, no?
There was a problem hiding this comment.
Correct, the bus is to lookup extensions (there is a chain of them). In the nutshell, whatever the fallback logic we come up with, it should lead to the equivalent of previously used new ExceptionCreator()).createExceptionClass(cls);. Creating the default bus is the simplest way to get there (not elegant but ...) since it will be initialized with extensions we need by default.
| public TypeClassInitializer(ServiceInfo serviceInfo, | ||
| S2JJAXBModel model, | ||
| boolean allowWr) { | ||
| super(serviceInfo); |
There was a problem hiding this comment.
| super(serviceInfo); | |
| this(BusFactory.getDefaultBus(), serviceInfo, model, allowWr); |
I think this is the best we can do there ... :-\
There was a problem hiding this comment.
So... what is the plan ;-)
There was a problem hiding this comment.
Suggestions are in place:
a) change code (if possible)
b) use BusFactory.getDefaultBus()
No description provided.