On Tuesday 20 November 2007 19:15, you wrote:
> +    private void storeBookmarks() {
> +        Logger.normal(this, "Attempting to save bookmarks to " + 
bookmarksFile.toString());
> +        SimpleFieldSet sfs;
> +        synchronized (bookmarks) {
> +            if (isSavingBookmarks) {
> +                return;
> +            }
> +            isSavingBookmarks = true;
> +            
> +            SimpleFieldSet toSave = MAIN_CATEGORY.toSimpleFieldSet();
> +            if(toSave.isEmpty()) {
> +                isSavingBookmarks = false;
> +                return;
> +            }
> +            sfs = toSave;
> +        }
> +        FileWriter fw = null;
> +        try {
> +            File tmp = File.createTempFile("bookmark", ".bak", 
bookmarksFile.getParentFile());
> +            fw = new FileWriter(tmp);
> +            sfs.writeTo(fw);
> +            if (!tmp.renameTo(bookmarksFile)) {
> +                Logger.error(this, "Unable to rename " + tmp.toString() + " 
to " + bookmarksFile.toString());
> +            }
> +        } catch (IOException ioe) {
> +            Logger.error(this, "An error has occured saving the bookmark 
file :" + ioe.getMessage(), ioe);
> +        } finally {
> +            try {
> +                if (fw != null) {
> +                    fw.close();
> +                }
> +            } catch (IOException e) {
> +            }
> +        }
> +
> +        synchronized (bookmarks) {
> +            isSavingBookmarks = false;
> +        }

Should this be in finally {} ?

> +    }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<https://emu.freenetproject.org/pipermail/devl/attachments/20071120/89c0ebd0/attachment.pgp>

Reply via email to