Skip to content
Snippets Groups Projects
Commit 05c36892 authored by Xin.Zh's avatar Xin.Zh Committed by GitHub
Browse files

Merge pull request #293 from pantianying/develop_generic_code_fix

Develop generic code fix
parents 14281690 4b7168a4
No related branches found
No related tags found
No related merge requests found
...@@ -47,22 +47,21 @@ type GenericFilter struct{} ...@@ -47,22 +47,21 @@ type GenericFilter struct{}
func (ef *GenericFilter) Invoke(invoker protocol.Invoker, invocation protocol.Invocation) protocol.Result { func (ef *GenericFilter) Invoke(invoker protocol.Invoker, invocation protocol.Invocation) protocol.Result {
if invocation.MethodName() == constant.GENERIC && len(invocation.Arguments()) == 3 { if invocation.MethodName() == constant.GENERIC && len(invocation.Arguments()) == 3 {
oldArguments := invocation.Arguments() oldArguments := invocation.Arguments()
var newParams []hessian.Object
if oldParams, ok := oldArguments[2].([]interface{}); ok { if oldParams, ok := oldArguments[2].([]interface{}); ok {
newParams := make([]hessian.Object, 0, len(oldParams))
for i := range oldParams { for i := range oldParams {
newParams = append(newParams, hessian.Object(struct2MapAll(oldParams[i]))) newParams = append(newParams, hessian.Object(struct2MapAll(oldParams[i])))
} }
} else { newArguments := []interface{}{
return invoker.Invoke(invocation) oldArguments[0],
} oldArguments[1],
newArguments := []interface{}{ newParams,
oldArguments[0], }
oldArguments[1], newInvocation := invocation2.NewRPCInvocation(invocation.MethodName(), newArguments, invocation.Attachments())
newParams, newInvocation.SetReply(invocation.Reply())
return invoker.Invoke(newInvocation)
} }
newInvocation := invocation2.NewRPCInvocation(invocation.MethodName(), newArguments, invocation.Attachments())
newInvocation.SetReply(invocation.Reply())
return invoker.Invoke(newInvocation)
} }
return invoker.Invoke(invocation) return invoker.Invoke(invocation)
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment