|
58 | 58 | import jakarta.xml.ws.WebServiceException; |
59 | 59 | import jakarta.xml.ws.WebServiceFeature; |
60 | 60 | import jakarta.xml.ws.soap.SOAPBinding; |
| 61 | +import java.io.InputStream; |
61 | 62 | import java.lang.reflect.InvocationHandler; |
62 | 63 | import java.lang.reflect.Method; |
63 | 64 | import java.lang.reflect.Modifier; |
64 | 65 | import java.security.PrivilegedActionException; |
65 | 66 | import java.security.PrivilegedExceptionAction; |
66 | 67 | import java.util.concurrent.ExecutorService; |
67 | 68 | import java.util.concurrent.Future; |
| 69 | +import java.util.Iterator; |
| 70 | +import java.util.Map; |
68 | 71 |
|
69 | 72 | /** |
70 | 73 | * ProxyHandler is the java.lang.reflect.InvocationHandler implementation. When a JAX-WS client |
@@ -567,13 +570,36 @@ protected Object createResponse(Method method, Object[] args, MessageContext res |
567 | 570 | // Free incoming stream |
568 | 571 | try { |
569 | 572 | responseContext.freeInputStream(); |
| 573 | + closeInputStream(responseContext); |
570 | 574 | } |
571 | 575 | catch (Throwable t) { |
572 | 576 | throw ExceptionFactory.makeWebServiceException(t); |
573 | 577 | } |
574 | 578 | } |
575 | 579 | } |
576 | 580 |
|
| 581 | + private void closeInputStream(MessageContext responseContext) { |
| 582 | + // accessing the input stream is not possible via get |
| 583 | + // workaround using entry set |
| 584 | + Iterator var2 = responseContext.getMEPContext().entrySet().iterator(); |
| 585 | + |
| 586 | + while(var2.hasNext()) { |
| 587 | + Object entry = var2.next(); |
| 588 | + if (entry instanceof Map.Entry && "TRANSPORT_IN".equals(((Map.Entry)entry).getKey())) { |
| 589 | + Object prop = ((Map.Entry)entry).getValue(); |
| 590 | + if (prop instanceof InputStream) { |
| 591 | + try { |
| 592 | + InputStream inputStream = (InputStream)prop; |
| 593 | + inputStream.close(); |
| 594 | + } catch (Exception var6) { |
| 595 | + log.error(var6.getMessage(), var6); |
| 596 | + } |
| 597 | + } |
| 598 | + break; |
| 599 | + } |
| 600 | + } |
| 601 | + } |
| 602 | + |
577 | 603 | protected static Throwable getFaultResponse(MessageContext msgCtx, |
578 | 604 | OperationDescription opDesc) { |
579 | 605 | Message msg = msgCtx.getMessage(); |
|
0 commit comments