Usage of file handles/file streams in GWT source code

53 views
Skip to first unread message

mr.g...@gmail.com

unread,
Jun 11, 2017, 3:35:30 PM6/11/17
to GWT Users
Reading and writing of files should only be done using try-with-resources. This might not be an issue on Linux, but it is a serious issue on Windows where I repeatedly get conflicts with GWT DevMode server not releasing file handles, ie. resulting in situations where it cannot even read its own cache files.

One example: Output.openSourceFile returns a file input stream. SourceHandler.makeSourcePage then does

return Responses.newBinaryStreamResponse("text/plain", pageBytes);

where it eventually might get closed if no error happens... and on top of that the stream is kept open as long as the client wishes to stall reading the response data.

I suggest setting up a GWT-internal standard for handling file resources. My recommendation would be to use try-with-resources and processing a file copy that is stored fully in RAM.


Thomas Broyer

unread,
Jun 12, 2017, 5:30:56 AM6/12/17
to GWT Users

Gražvydas Valeika

unread,
Jun 12, 2017, 5:59:03 AM6/12/17
to google-we...@googlegroups.com

On Mon, Jun 12, 2017 at 12:30 PM, Thomas Broyer <t.br...@gmail.com> wrote:
oving discussion to GWT Con


Reply all
Reply to author
Forward
0 new messages