holodeck-b2b / Holodeck-B2B

Holodeck B2B is an AS4 system-to-system messaging solution that implements the OASIS specifications for ebMS3 and it's AS4 profile. For more information visit the project website
http://holodeck-b2b.org
GNU General Public License v3.0
71 stars 36 forks source link

Resource leak due to unclosed Base64 writer #79

Closed radlewand closed 6 years ago

radlewand commented 6 years ago

There is a bug in the SingleXMLDeliverer class which may result in loss of some characters at the end of the payload messages (in my case some EDI messages were missing ending characters therefore couldn't be parsed). The problem is in the method writeEncodedPayload where you call b64os.flush() but forget about b64os.close(). Please note that lack of close() generates warning "resource leak" but it was somehow ignored in the code.

sfieten commented 6 years ago

There indeed was an issue with the base64 encoding not being completed correctly. This is now fixed in version 3.1.0. Calling b64os.close() doesn't work since it would also close the underlying output stream. But that needs to stay open to write further payloads and closing tags to the file.