Return SYNC for getSyncType() in HttpSyncEndpoint #855
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I wrote a
HttpSyncEndpoint
subclass that overridesneedsBodyBuffered()
to returntrue
. After running the filter, I get an NPE thrown in Zuul's internals, and the endpoint returns 500. The NPE stack trace is:After doing a bit of digging, I found that the filter runner was calling
getSyncType()
on my filter, which was returningASYNC
, so it was reaching the bottom ofBaseZuulFilterRunner.filter(ZuulFilter, ZuulMessage)
which returnsnull
. Unfortunately, the caller wasZuulEndpointRunner.filter(HttpRequestMessage, HttpContent)
, which was callinginvokeNextStage(filter(endpoint, zuulReq))
.invokeNextStage()
is not set up to handlenull
as its argument. It callsaddPerfMarkTags()
with that argument, which attempts to call.getContext()
on it, which throws an NPE.Having my filter report that it's a sync filter fixes the issue for me, though I'm not sure if this is the right approach for all
HttpSyncFilter
s or not.