-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CXF-8658] CXF 3.4.5 breaks binary compatibility with 3.4.1 in TypeClassInitializer #908
base: 3.4.x-fixes
Are you sure you want to change the base?
Conversation
TypeClassInitializer.
@@ -50,6 +50,15 @@ | |||
boolean isFault; | |||
Bus bus; | |||
|
|||
@Deprecated // CXF-8658 | |||
public TypeClassInitializer(ServiceInfo serviceInfo, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@garydgregory we cannot do that, it will blow with NPE in the TypeClassInitializer::createFaultClass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or just sthg like (bus != null? bus.getExtension( ExceptionCreator.class) : new ExceptionCreator()).createExceptionClass(cls);
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So... what is the plan ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestions are in place:
a) change code (if possible)
b) use BusFactory.getDefaultBus()
No description provided.