File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
google-http-client/src/main/java/com/google/api/client/http/javanet Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -75,10 +75,21 @@ public LowLevelHttpResponse execute() throws IOException {
75
75
connection .setChunkedStreamingMode (0 );
76
76
}
77
77
OutputStream out = connection .getOutputStream ();
78
+ boolean threw = true ;
78
79
try {
79
80
getStreamingContent ().writeTo (out );
81
+ threw = false ;
80
82
} finally {
81
- out .close ();
83
+ try {
84
+ out .close ();
85
+ } catch (IOException exception ) {
86
+ // When writeTo() throws an exception, chances are that the close call will also fail.
87
+ // In such case, swallow exception from close call so that the underlying cause can
88
+ // propagate.
89
+ if (!threw ) {
90
+ throw exception ;
91
+ }
92
+ }
82
93
}
83
94
} else {
84
95
// cannot call setDoOutput(true) because it would change a GET method to POST
You can’t perform that action at this time.
0 commit comments