Changeset 1487 for trunk


Ignore:
Timestamp:
12/04/19 16:28:32 (4 years ago)
Author:
davidb
Message:

Some comments added and comments tidy up

File:
1 edited

Legend:

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

    r1474 r1487  
    10931093         *              True if the saved frames counter should be incremented, false otherwise.
    10941094         * @param checkBackup
    1095          *              True if the frame should be checked for the back up tag
     1095         *              True if the frame should be checked for the backup tag
    10961096         */
    10971097        public static String SaveFrame(Frame toSave, boolean inc, boolean checkBackup) {
     
    11031103                }
    11041104
    1105                 // Dont save if the frame is protected and it exists
     1105                // Don't save if the frame is protected and it exists
    11061106                if (checkBackup && toSave.isReadOnly()) {
    11071107                        _Cache.remove(toSave.getName().toLowerCase());
     
    11091109                }
    11101110
    1111                 /* Dont save the frame if it has the noSave tag */
     1111                /* Don't save the frame if it has the noSave tag */
    11121112                if (toSave.hasAnnotation("nosave")) {
    11131113                        Actions.LegacyPerformActionCatchErrors(toSave, null, "Restore");
     
    11361136                // Check if the frame exists
    11371137                if (checkBackup && fullPath == null) {
    1138                         // The first time a frame with the backup tag is saved, dont back it
    1139                         // up
     1138                        // The first time a frame with the backup tag is saved, don't back it up
    11401139                        checkBackup = false;
    11411140                }
     
    11451144                try {
    11461145                        // if its a new frame or an existing Exp frame...
    1147                         if (fullPath == null || fullPath.endsWith(ExpReader.EXTENTION)) {                               
     1146                        if (fullPath == null || fullPath.endsWith(ExpReader.EXTENTION)) {       
     1147                               
     1148                                // *** Don't you need to take the *name* of the frame in to account????
     1149                                // *** to rule out the credentials frame?
     1150                                String framesetName = toSave.getFramesetName();
     1151                                String enryptionLabel = toSave.getEncryptionLabel();
     1152                               
    11481153                                if (toSave.getNumber() != AuthenticatorBrowser.CREDENTIALS_FRAME &&
    11491154                                                toSave.getEncryptionLabel() != null) {
     1155                                        // *** wasted repeat of getEncryptionLabel()
     1156                                        // does the order of the above if statement matter?
    11501157                                        writer = new EncryptedExpWriter(toSave.getEncryptionLabel());
     1158                                        // **** If this doesn't take an encryption label, then why bother
     1159                                        // making it explicitly the EcryptedExpReader, given that
     1160                                        // 'redirectTo()' below doesn't
    11511161                                        savedVersion = EncryptedExpReader.getVersion(fullPath);
    11521162                                } else {
     
    11671177                        }
    11681178                       
    1169                         // Check if the frame doesnt exist
     1179                        // Check if the frame doesn't exist
    11701180                        // if (savedVersion < 0) {
    11711181                        // /*
     
    11931203                        //              be used to overwrite that file, it causes a false positive conflict.  Checking
    11941204                        //              for the zero version number fixes this.
    1195                         String framesetName = toSave.getFramesetName();
    1196                         boolean isBayFrameset =
    1197                                         framesetName.equalsIgnoreCase(MessageBay.MESSAGES_FRAMESET_NAME) ||
    1198                                         framesetName.equalsIgnoreCase(MailBay.EXPEDITEE_MAIL_FRAMESET_NAME);
     1205                        //String framesetName = toSave.getFramesetName();
     1206                        boolean isBayFrameset = toSave.isBayFrameset();
     1207       
    11991208                        long fileLastModify = fullPath != null ? new File(fullPath).lastModified() : 0;
    12001209                        long frameLastModify = toSave.getLastModifyPrecise();
     1210
    12011211                        boolean fileModifyConflict = fileLastModify > frameLastModify && !isBayFrameset;
    12021212                        boolean versionConflict = savedVersion > toSave.getVersion() && !isBayFrameset;
     1213                       
    12031214                        if ((fileModifyConflict || versionConflict) && savedVersion > 0) {
    12041215                                // remove this frame from the cache if it is there
    12051216                                // This will make sure links to the original are set correctly
    12061217                                _Cache.remove(toSave.getName().toLowerCase());
    1207                                 int nextnum = ReadINF(toSave.getPath(), toSave
    1208                                                 .getFramesetName(), false) + 1;
     1218                               
     1219                                int nextnum = ReadINF(toSave.getPath(), toSave.getFramesetName(), false) + 1;
     1220                               
    12091221                                SuspendCache();
    12101222                                Frame original = LoadFrame(toSave.getName());
    12111223                                toSave.setFrameNumber(nextnum);
    12121224                                ResumeCache();
     1225                               
    12131226                                // Put the modified version in the cache
    12141227                                addToCache(toSave);
     
    12391252                                MessageBay.displayMessage(yourMessage);
    12401253                                EcosystemManager.getMiscManager().beep();
    1241                         } else if (checkBackup
    1242                                         && ItemUtils.ContainsExactTag(toSave.getSortedItems(),
    1243                                                         ItemUtils.TAG_BACKUP)) {
     1254                        }
     1255                        else if (checkBackup
     1256                                        && ItemUtils.ContainsExactTag(toSave.getSortedItems(), ItemUtils.TAG_BACKUP)) {
    12441257                                SuspendCache();
    12451258                                String oldFramesetName = toSave.getFramesetName() + "-old";
Note: See TracChangeset for help on using the changeset viewer.