Part of email discussion for the issue:
>The webpad demo showed the correct usage about FileContents, that's
>good. What I don't understand is, in FileHandler.java, in 'save' and
>'saveAs' methods, you used another writeToFile method to write the
>content to the file. This makes me lost.
>
>According to JNLP API docs, saveFileDialog and saveAsFileDialog will
>return FileContents if the save was success, that means, the content
>has been saved already. So why do you still need 'writeToFile' method
>to write the content to the file? That's a redundant IO operation.
>
>You can argue that, when user save the file for the second time, user
>will not get the 'Save File Dialog'. But,
>1. This is breaking the security expectation in the demo. I grant you
> first time save operation, but I didn't grant you all the following
> save operation.
>2. The 'Save As' command will always write the file twice.
>
>In summary,
>- The webpad demo showed some usage about FileContents used in saving file,
> but I don't agree (or not clear) why it's implemented in that way. Using
> 'writeToFile' will always cause an extra IO operation at least in saveAs
> function.
It does appear that the saveAs function does a redundant save. From this
example at least, I agree the usefulness of saveAsFileDialog (using
FileContents arg) is questionable. The saveAs method should probably use
the other form of saveFileDialog, and not call writeToFile, to avoid
the redundant save.
###@###.### 2002-02-12
>The webpad demo showed the correct usage about FileContents, that's
>good. What I don't understand is, in FileHandler.java, in 'save' and
>'saveAs' methods, you used another writeToFile method to write the
>content to the file. This makes me lost.
>
>According to JNLP API docs, saveFileDialog and saveAsFileDialog will
>return FileContents if the save was success, that means, the content
>has been saved already. So why do you still need 'writeToFile' method
>to write the content to the file? That's a redundant IO operation.
>
>You can argue that, when user save the file for the second time, user
>will not get the 'Save File Dialog'. But,
>1. This is breaking the security expectation in the demo. I grant you
> first time save operation, but I didn't grant you all the following
> save operation.
>2. The 'Save As' command will always write the file twice.
>
>In summary,
>- The webpad demo showed some usage about FileContents used in saving file,
> but I don't agree (or not clear) why it's implemented in that way. Using
> 'writeToFile' will always cause an extra IO operation at least in saveAs
> function.
It does appear that the saveAs function does a redundant save. From this
example at least, I agree the usefulness of saveAsFileDialog (using
FileContents arg) is questionable. The saveAs method should probably use
the other form of saveFileDialog, and not call writeToFile, to avoid
the redundant save.
###@###.### 2002-02-12