[
https://issues.apache.org/jira/browse/CAMEL-6369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13660398#comment-13660398
]
Dietmar Schinnerl commented on CAMEL-6369:
------------------------------------------
You're welcome.
Patch... not really... :| but following workaround works, so I'm pretty sure
it's just the above mentioned if which is missing.
{code:java}
package org.apache.camel.component.gson;
import com.google.gson.Gson;
// Workaround for https://issues.apache.org/jira/browse/CAMEL-6369
public class WorkaroundGsonDataFormat extends GsonDataFormat {
Gson gson;
public WorkaroundGsonDataFormat(Gson gson, Class<?> unmarshalType) {
super(gson, unmarshalType);
this.gson = gson;
}
@Override
protected void doStart() throws Exception {
if (this.gson == null) {
super.doStart();
}
}
}
{code}
> GsonDataFormat doesn't use given Gson instance anymore
> ------------------------------------------------------
>
> Key: CAMEL-6369
> URL: https://issues.apache.org/jira/browse/CAMEL-6369
> Project: Camel
> Issue Type: Bug
> Components: camel-gson
> Affects Versions: 2.11.0
> Reporter: Dietmar Schinnerl
> Priority: Minor
> Fix For: 2.11.1, 2.12.0
>
>
> Before 2.11.0 it was possible to configure GsonDataFormat to use an
> externally created and configured Gson instance. (Which was especially
> necessary since it was not possible to configure via GsonDataFormat.) But in
> 2.11.0 GsonDataFormat implements ServiceSupport which breaks this. Because
> doStart _always_ creates a new Gson instance although one has been given by a
> constructor call.
> Probably a
> {code}
> if (this.gson == null) {
> // ... old doStart body ...
> }
> {code}
> could do in doStart method.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira