BufferedWriter.write does not throw exception if it is already closed. (original) (raw)
Alan Bateman Alan.Bateman at oracle.com
Fri Jan 28 10:55:05 UTC 2011
- Previous message: BufferedWriter.write does not throw exception if it is already closed.
- Next message: BufferedWriter.write does not throw exception if it is already closed.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Jing LV wrote:
Hi Alan,
(Sorry for late reply that it seems my mail-box has some trouble that I cannot send my mail yesterday). I agreed with you that the document may be changed. However as you see another problem is that the write method is unstable, it may or may not throw the exception, only depends on its buffer size, I think we'd better at least fix this unpredictable behaviour? I think this is part of the same issue. BufferedWriter#close is failing because the underlying Writer's close is failing. This leaves the BufferedWriter "open" and the underlying Writer "closed". If you continue writing then the BufferedWriter may continue to buffer characters but if it has to flush to the underlying Writer then it will fail. This is clearly undesirable and it may be best to clarify the spec so that stream will be considered to be closed even if the close fails (as the current behavior is long standing behavior we would just need to think through any implications/side-effects). We can easily the implementation too, and in addition the suppressed exception support gives us the opportunity to fix a few other issues in these classes. I'll create a bug for this today.
-Alan.
- Previous message: BufferedWriter.write does not throw exception if it is already closed.
- Next message: BufferedWriter.write does not throw exception if it is already closed.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]