[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] Remote callable parameter order not preserved

Hi Marin,

On 10/9/2015 5:38 PM, Marin Orlić wrote:
> Hi,
>
> should the order of the method parameters in the service interface
correspond to the order of the parameters as they are defined for the
remote callable?

Yes.

>
> I have a method with the signature.
>
> createProject(String project_name, Collection<String>
project_requirements, String language, String annotation_format)
>
> The corresponding remote callable is built with:
>
> RemoteCallParameter.Builder parameterBuilder = new
RemoteCallParameter.Builder()
>             .addParameter("project_name")
>             .addParameter("project_requirements")
>             .addParameter("language")
>             .addParameter("annotation_format");
> RemoteCallable.Builder callableBuilder = new
RemoteCallable.Builder("createProject", "/server/project")
> .setDefaultParameters(parameterBuilder.build())
>             .setRequestType(new
HttpPostRequestType(HttpPostRequestType.STRING_REQUEST_ENTITY,
"application/json"));
> callableBuilder.build();
>
> Due to the HashMap in defaultParameters, there is a mismatch in the
ordering of default params and the actual params. This one maintains the
order:
>
> RemoteCallParameter.Builder()
>             .addParameter("phrase")
>             .addParameter("language")
>             .addParameter("annotation_format");
>
> But this one does not:
>
> RemoteCallParameter.Builder parameterBuilder = new
RemoteCallParameter.Builder()
>             .addParameter("project_name")
>             .addParameter("project_requirements")
>             .addParameter("language")
>             .addParameter("annotation_format");
>
> Is my assumption that the order should match correct? It seems to be
assumed in AbstractClientContainer.prepareParameters().

Yes, the order should match.  This is a bug.  Please open a bug report [1]
under 'ecf.remoteservices' component and I'll fix.

In the mean time, as a temporary work around you could create the
IRemoteCallParameter[] passed to setDefaultParameters 'by hand' (i.e.
rather than use RemoteCallParameter.Builder).

Thanks,

Scott

[1] https://bugs.eclipse.org/bugs/enter_bug.cgi?product=ECF