Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Camel AmbiguousMethodCallException Abstract Classes

I've got three classes

public abstract FoundationReport
{
    public abstract FoundationDetails getDetails();
}

public abstract BaseReport extends FoundationReport
{
    public abstract BaseDetails getDetails();
}

public Report extends BaseReport
{

    ReportDetails reportDetails;

    public ReportDetails getDetails()
    {
        return reportDetails
    }
}

ReportDetails extends BaseDetails, BaseDetails extends FoundationDetails.

In my camel xml I've got a section:

<convertBodyTo type="path.to.Report" />
        <when>
            <simple>${body.details.type} == 'myself'</simple>
...

However the call to body.details.type results in:

Caused by: org.apache.camel.component.bean.AmbiguousMethodCallException:     
Ambiguous method invocations possible: 
[public path.to.ReportDetails  path.to.Report.getDetails(), 
public abstract path.to.BaseDetails path.to.BaseReport.getDetails(), 
public abstract path.to.FoundationDetails path.to.FoundationReport()]

I had assumed (incorrectly) that the only concrete implementation of getDetails in the Report class would be used. Why am I getting this exception and how do I work around?

like image 946
Airomega Avatar asked Feb 28 '26 01:02

Airomega


1 Answers

Its a bug in Apache Camel. I have reproduced it, and logged a ticket to get this fixed: https://issues.apache.org/jira/browse/CAMEL-9032

like image 135
Claus Ibsen Avatar answered Mar 02 '26 14:03

Claus Ibsen