Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
22a7f0099
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2022
22a7f0099
Commits
61171b32
Commit
61171b32
authored
5 years ago
by
Patrick
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
08a246c8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
filter/impl/generic_service_filter.go
+9
-4
9 additions, 4 deletions
filter/impl/generic_service_filter.go
with
9 additions
and
4 deletions
filter/impl/generic_service_filter.go
+
9
−
4
View file @
61171b32
...
@@ -58,6 +58,7 @@ func (ef *GenericServiceFilter) Invoke(invoker protocol.Invoker, invocation prot
...
@@ -58,6 +58,7 @@ func (ef *GenericServiceFilter) Invoke(invoker protocol.Invoker, invocation prot
}
}
var
(
var
(
ok
bool
err
error
err
error
methodName
string
methodName
string
newParams
[]
interface
{}
newParams
[]
interface
{}
...
@@ -79,26 +80,30 @@ func (ef *GenericServiceFilter) Invoke(invoker protocol.Invoker, invocation prot
...
@@ -79,26 +80,30 @@ func (ef *GenericServiceFilter) Invoke(invoker protocol.Invoker, invocation prot
argsType
=
method
.
ArgsType
()
argsType
=
method
.
ArgsType
()
genericKey
=
invocation
.
AttachmentsByKey
(
constant
.
GENERIC_KEY
,
GENERIC_SERIALIZATION_DEFAULT
)
genericKey
=
invocation
.
AttachmentsByKey
(
constant
.
GENERIC_KEY
,
GENERIC_SERIALIZATION_DEFAULT
)
if
genericKey
==
GENERIC_SERIALIZATION_DEFAULT
{
if
genericKey
==
GENERIC_SERIALIZATION_DEFAULT
{
oldParams
=
invocation
.
Arguments
()[
2
]
.
([]
hessian
.
Object
)
oldParams
,
ok
=
invocation
.
Arguments
()[
2
]
.
([]
hessian
.
Object
)
}
else
{
}
else
{
logger
.
Errorf
(
"[Generic Service Filter] Don't support this generic: %s"
,
genericKey
)
logger
.
Errorf
(
"[Generic Service Filter] Don't support this generic: %s"
,
genericKey
)
return
&
protocol
.
RPCResult
{}
return
&
protocol
.
RPCResult
{}
}
}
if
!
ok
{
logger
.
Errorf
(
"[Generic Service Filter] wrong serialization"
)
return
&
protocol
.
RPCResult
{}
}
if
len
(
oldParams
)
!=
len
(
argsType
)
{
if
len
(
oldParams
)
!=
len
(
argsType
)
{
logger
.
Errorf
(
"[Generic Service Filter] method:%s invocation arguments number was wrong"
,
methodName
)
logger
.
Errorf
(
"[Generic Service Filter] method:%s invocation arguments number was wrong"
,
methodName
)
return
&
protocol
.
RPCResult
{}
return
&
protocol
.
RPCResult
{}
}
}
// oldParams convert to newParams
// oldParams convert to newParams
newParams
=
make
([]
interface
{},
len
(
oldParams
))
for
i
:=
range
argsType
{
for
i
:=
range
argsType
{
var
newParam
interface
{}
newParam
:=
reflect
.
New
(
argsType
[
i
])
.
Interface
()
newParam
=
reflect
.
New
(
argsType
[
i
])
.
Interface
()
err
=
mapstructure
.
Decode
(
oldParams
[
i
],
newParam
)
err
=
mapstructure
.
Decode
(
oldParams
[
i
],
newParam
)
newParam
=
reflect
.
ValueOf
(
newParam
)
.
Elem
()
.
Interface
()
newParam
=
reflect
.
ValueOf
(
newParam
)
.
Elem
()
.
Interface
()
if
err
!=
nil
{
if
err
!=
nil
{
logger
.
Errorf
(
"[Generic Service Filter] decode arguments map to struct wrong: error{%v}"
,
perrors
.
WithStack
(
err
))
logger
.
Errorf
(
"[Generic Service Filter] decode arguments map to struct wrong: error{%v}"
,
perrors
.
WithStack
(
err
))
return
&
protocol
.
RPCResult
{}
return
&
protocol
.
RPCResult
{}
}
}
newParams
=
append
(
newParams
,
newParam
)
newParams
[
i
]
=
newParam
}
}
newInvocation
:=
invocation2
.
NewRPCInvocation
(
methodName
,
newParams
,
invocation
.
Attachments
())
newInvocation
:=
invocation2
.
NewRPCInvocation
(
methodName
,
newParams
,
invocation
.
Attachments
())
newInvocation
.
SetReply
(
invocation
.
Reply
())
newInvocation
.
SetReply
(
invocation
.
Reply
())
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment