Skip to content
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

Open
wants to merge 1 commit into
base: 3.4.x-fixes
Choose a base branch
from

Conversation

garydgregory
Copy link
Member

No description provided.

@@ -50,6 +50,15 @@
boolean isFault;
Bus bus;

@Deprecated // CXF-8658
public TypeClassInitializer(ServiceInfo serviceInfo,
Copy link
Member

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

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Contributor

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);)

Copy link
Member

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).

Copy link
Contributor

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?

Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
super(serviceInfo);
this(BusFactory.getDefaultBus(), serviceInfo, model, allowWr);

I think this is the best we can do there ... :-\

Copy link
Member Author

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 ;-)

Copy link
Member

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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants