Changeset 1342 for trunk


Ignore:
Timestamp:
05/02/19 12:53:08 (5 years ago)
Author:
bln4
Message:

Following investigation I have figured out why the version zero check stops version conflicts from happenings. Here, and as a comment in the code, I have explained the details.

Q: Why do we ignore version conflicts if the saved version is zero?
A: Sometimes a Frame object in memory with a specified path is not 'connected'

to the file found at that specified path yet. This occurs if a frame object
has been created, its path assigned and saved to disk; with the intention
discarding this Frame object and later saving a different Frame object to
that File. One example of this is when @old frames are created.
The new Frame object that is created and saved only to be discarded, has a
version number of zero.
Therefore, if the file created from the discarded Frame has its modification
date compared to the modification date on the Frame object that will eventually
be used to overwrite that file, it causes a false positive conflict. Checking
for the zero version number fixes this.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/FrameIO.java

    r1341 r1342  
    10221022
    10231023        public static void DisableCache() {
     1024                System.err.println(" --------- Cache Disabled --------- ");
    10241025                _UseCache = false;
    10251026        }
    10261027
    10271028        public static void EnableCache() {
     1029                System.err.println(" --------- Cache Enabled --------- ");
    10281030                _UseCache = true;
    10291031        }
    10301032
    10311033        public static void SuspendCache() {
     1034                System.err.println("SuspendCache: _UseCache" + " was " + _UseCache);
    10321035                if (_UseCache) {
    10331036                        DisableCache();
     
    10361039                        _SuspendedCache = false;
    10371040                }
     1041                System.err.println("   Cache is suspended -> " + _SuspendedCache);
     1042                System.err.println("   _UseCache is -> " + _UseCache);
     1043                System.err.println();
    10381044        }
    10391045
    10401046        public static void ResumeCache() {
     1047                System.err.println("ResumeCache: _UseCache" + " was " + _UseCache);
    10411048                if (_SuspendedCache) {
    10421049                        EnableCache();
    10431050                        _SuspendedCache = false;
    10441051                }
     1052                System.err.println("   Cache is suspended -> " + _SuspendedCache);
     1053                System.err.println("   _UseCache is -> " + _UseCache);
     1054                System.err.println();
    10451055        }
    10461056
     
    12271237
    12281238                        // Check if we are trying to save an out of date version
     1239                        // Q:   Why do we ignore version conflicts if the saved version is zero?
     1240                        // A:   Sometimes a Frame object in memory with a specified path is not 'connected'
     1241                        //              to the file found at that specified path yet.  This occurs if a frame object
     1242                        //              has been created, its path assigned and saved to disk; with the intention
     1243                        //              discarding this Frame object and later saving a different Frame object to
     1244                        //              that File.  One example of this is when @old frames are created.
     1245                        //              The new Frame object that is created and saved only to be discarded, has a
     1246                        //              version number of zero. 
     1247                        //              Therefore, if the file created from the discarded Frame has its modification
     1248                        //              date compared to the modification date on the Frame object that will eventually
     1249                        //              be used to overwrite that file, it causes a false positive conflict.  Checking
     1250                        //              for the zero version number fixes this.
    12291251                        String framesetName = toSave.getFramesetName();
    12301252                        boolean isBayFrameset =
Note: See TracChangeset for help on using the changeset viewer.