Properly close stream writer
[netconf.git] / restconf / restconf-nb-bierman02 / src / main / java / org / opendaylight / netconf / sal / rest / impl / RestconfDocumentedExceptionMapper.java
index 5561949f5e110ddd611ba4c90f06db29959411b2..ec2e9674960f511c5686e478abff755910c3d613 100644 (file)
@@ -276,6 +276,12 @@ public class RestconfDocumentedExceptionMapper implements ExceptionMapper<Restco
             LOG.warn("Error writing error response body", e);
         }
 
+        try {
+            streamWriter.close();
+        } catch (IOException e) {
+            LOG.warn("Failed to close stream writer", e);
+        }
+
         try {
             return outStream.toString(StandardCharsets.UTF_8.name());
         } catch (UnsupportedEncodingException e) {