Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333660 - [implementation] FileStoreTextFileBuffer eats IOException on external file save
Summary: [implementation] FileStoreTextFileBuffer eats IOException on external file save
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.7 M5   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-06 10:26 EST by James Blackburn CLA
Modified: 2011-01-25 10:39 EST (History)
2 users (show)

See Also:


Attachments
potential fix (6.85 KB, patch)
2011-01-06 10:26 EST, James Blackburn CLA
no flags Details | Diff
further fix (1.14 KB, patch)
2011-01-07 04:26 EST, James Blackburn CLA
daniel_megert: iplog+
daniel_megert: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Blackburn CLA 2011-01-06 10:26:34 EST
Created attachment 186172 [details]
potential fix

FileStoreTextFileBuffer.java seems to incorrectly handle IOExceptions.

- If the file exists, #setFileContents is called. This method eats all IOExceptions.
- If the file doesn't exist the IOException is eaten on close() (can lead to a similar issue as described in Bug 332543)

Potential patch for the issue.  Make #setFileContents throw IOException and commitFileBufferContent re-throws the IOException as a CoreException. 

Existing tests in FileBuffersTestSuite pass.
Comment 1 Dani Megert CLA 2011-01-07 03:42:34 EST
Fixed without using the patch (FileStoreTextFileBuffer.java rev. 1.12).
Available in builds >= N20110107-2000.
Comment 2 James Blackburn CLA 2011-01-07 04:26:51 EST
Created attachment 186252 [details]
further fix

Thanks Dani.  

Unfortunately your fix still suffers from the issue in Bug 332543. You need to explicitly close() the outputstreams without disregarding the IOException, as some filesystems defer errors to close rather than on write.
Comment 3 James Blackburn CLA 2011-01-07 04:28:43 EST
Issue still exists on close()
Comment 4 Dani Megert CLA 2011-01-11 08:33:21 EST
Thanks James. Committed the patch to HEAD with the following addition to the copyright notice:
James Blackburn <jamesblackburn+eclipse@gmail.com> - [implementation] FileStoreTextFileBuffer eats IOException on external file save - https://bugs.eclipse.org/333660
Comment 5 Dani Megert CLA 2011-01-25 10:39:47 EST
Verified in I20110124-1800 through code inspection.