Skip to content

Commit 03b215a

Browse files
leaquigregturn
authored andcommitted
Properly close/flush TransportOutputStream.
Resolves #1207.
1 parent d2eda53 commit 03b215a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

spring-ws-core/src/main/java/org/springframework/ws/transport/TransportInputStream.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ private InputStream getInputStream() throws IOException {
4747

4848
@Override
4949
public void close() throws IOException {
50-
getInputStream().close();
50+
if (inputStream != null) {
51+
getInputStream().close();
52+
}
5153
}
5254

5355
@Override

spring-ws-core/src/main/java/org/springframework/ws/transport/TransportOutputStream.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,16 @@ private OutputStream getOutputStream() throws IOException {
4545

4646
@Override
4747
public void close() throws IOException {
48-
getOutputStream().close();
48+
if (outputStream != null) {
49+
getOutputStream().close();
50+
}
4951
}
5052

5153
@Override
5254
public void flush() throws IOException {
53-
getOutputStream().flush();
55+
if (outputStream != null) {
56+
getOutputStream().flush();
57+
}
5458
}
5559

5660
@Override

0 commit comments

Comments
 (0)