Skip to content

Commit

Permalink
Fix case of lost TCCL in dev-mode when RESTEasy Reactive reads the HT…
Browse files Browse the repository at this point in the history
…TP body

Fixes: quarkusio#17359
(cherry picked from commit 6977868)
  • Loading branch information
geoand authored and gsmet committed May 20, 2021
1 parent 59ed900 commit 7971e40
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ public class InputHandler implements ServerRestHandler {
final long maxBufferSize;
private volatile Executor executor;
private final Supplier<Executor> supplier;
private final ClassLoader originalTCCL;

public InputHandler(long maxBufferSize, Supplier<Executor> supplier) {
this.maxBufferSize = maxBufferSize;
this.supplier = supplier;
// capture the proper TCCL in order to avoid losing it to Vert.x in dev-mode
this.originalTCCL = Thread.currentThread().getContextClassLoader();

}

@Override
Expand Down Expand Up @@ -76,6 +80,7 @@ public void done() {
count += remaining;
}
context.setInputStream(new ByteArrayInputStream(ar));
Thread.currentThread().setContextClassLoader(originalTCCL);
context.resume();
}

Expand Down

0 comments on commit 7971e40

Please sign in to comment.