Closed Bug 359472 Opened 18 years ago Closed 17 years ago

RDF should use nsISafeOutputStream

Categories

(Core Graveyard :: RDF, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED DUPLICATE of bug 375102

People

(Reporter: ian, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.5) Gecko/20060731 Firefox/1.5.0.5 Flock/0.7.4.1
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.5) Gecko/20060731 Firefox/1.5.0.5 Flock/0.7.4.1

Right now the nsRDFXMLDataSource will leave its RDF/XML file in a bad state if writes fail or the application terminates during serialization. The good news is that the platform supports nsSafeFileOutputStream which is used in a bunch of places, including bookmarks to provide this behaviour in a cross-platform way.

I made this change in Flock since we currently use RDF/XML files fairly heavilly, it seems to work well. I'll attach my patch.

Reproducible: Always
Status: UNCONFIRMED → NEW
Ever confirmed: true
And there's a typo fix in there too.
Attachment #244645 - Flags: review?
Attachment #244645 - Flags: review? → review?(axel)
Comment on attachment 244645 [details] [diff] [review]
This patch uses the same technique as the bookmarks service

Sorry for the lag. r- on this one, we shouldn't carry the logic bugs through.

Could you add an early return for the failures? This code looks weird, checking for stuff that failed ages ago, but differently than before. Like, one part checks if (out), and in the end, you check NS_SUCCEEDED(rv).

And I'd like to have {}, even for single line ifs, and no indention whitespace on empty lines.

I'll try to not let another patch lag this bad.
Attachment #244645 - Flags: review?(axel) → review-
This is a duplicate of bug #375102.
Well, not a duplicate in the strict sense, but the other bug has a landed patch, so yes, closing DUPE.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: