[icedtea-web][rfc] Fix of backup of deployment.properties on some OSs

Jiri Vanek jvanek at redhat.com
Thu May 9 01:59:11 PDT 2013


On 05/07/2013 05:50 PM, Jacob Wisor wrote:
> "Jacob Wisor"<gitne at excite.co.jp> wrote:
>> Hello!
>>
>> Some OSs (e.g. Windows) or file systems do not allow to overwrite while renaming or moving files. It could also depend on the implementation of java.io.File.renameTo(java.io.File), as its specification leaves open the exact semantics.
>>
>> Although the proposed fix is not really elegant, it should work on the majority of systems. Maybe the whole idea of renaming deployment.properties to always have a safe backup is just 

agree

>> redundant on modern operating and file systems, since most of them feature journaled or transactional file systems, so there should always be a safe copy having integrity available.
>>
>> Happy reviewing!
>> Jacob
> 
> Sorry, the webmailer keeps dropping attachements at random...
> 
Hi! The patch looks ok, however I'm in doubts whether this quite complex solution is necessary.
What I have in mind is:
1) Does .old file exists? If yes, delete it. (if it is directory then... ??? :))  I think we can
ignore this case. If Deletion failed, warn user and log exception(if none, then jsut some stderr
stuff)  (there would be nice some better error reporting - in comamndline mode[1] just print
exception, whether in gui[2] mode also show dialogue, but do not throw exception out - but it is
probably work for different changeset)
2)Rename current properties to .old  - if it failed - again warn, but do not fail - maybe ask the
user to continue - not continue (in gui mode).
3) save  new properties - if this failed - then this is the only reason for fatal exception imho.

What do you think?

If you agree, then for now only the parts without the "user interactions" are worthy. But of course
if you are wiling to fix also the interaction then we will be more then happy (but please as
different changeset)

Thank you for checking this!

J.


[1]
http://icedtea.classpath.org/hg/icedtea-web/file/9f2d8381f5f1/netx/net/sourceforge/jnlp/controlpanel/CommandLine.java
[2]
http://icedtea.classpath.org/hg/icedtea-web/file/9f2d8381f5f1/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java



More information about the distro-pkg-dev mailing list