- Timestamp:
- 12/04/19 16:28:32 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/FrameIO.java
r1474 r1487 1093 1093 * True if the saved frames counter should be incremented, false otherwise. 1094 1094 * @param checkBackup 1095 * True if the frame should be checked for the back 1095 * True if the frame should be checked for the backup tag 1096 1096 */ 1097 1097 public static String SaveFrame(Frame toSave, boolean inc, boolean checkBackup) { … … 1103 1103 } 1104 1104 1105 // Don t save if the frame is protected and it exists1105 // Don't save if the frame is protected and it exists 1106 1106 if (checkBackup && toSave.isReadOnly()) { 1107 1107 _Cache.remove(toSave.getName().toLowerCase()); … … 1109 1109 } 1110 1110 1111 /* Don t save the frame if it has the noSave tag */1111 /* Don't save the frame if it has the noSave tag */ 1112 1112 if (toSave.hasAnnotation("nosave")) { 1113 1113 Actions.LegacyPerformActionCatchErrors(toSave, null, "Restore"); … … 1136 1136 // Check if the frame exists 1137 1137 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 1140 1139 checkBackup = false; 1141 1140 } … … 1145 1144 try { 1146 1145 // 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 1148 1153 if (toSave.getNumber() != AuthenticatorBrowser.CREDENTIALS_FRAME && 1149 1154 toSave.getEncryptionLabel() != null) { 1155 // *** wasted repeat of getEncryptionLabel() 1156 // does the order of the above if statement matter? 1150 1157 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 1151 1161 savedVersion = EncryptedExpReader.getVersion(fullPath); 1152 1162 } else { … … 1167 1177 } 1168 1178 1169 // Check if the frame doesn t exist1179 // Check if the frame doesn't exist 1170 1180 // if (savedVersion < 0) { 1171 1181 // /* … … 1193 1203 // be used to overwrite that file, it causes a false positive conflict. Checking 1194 1204 // 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 1199 1208 long fileLastModify = fullPath != null ? new File(fullPath).lastModified() : 0; 1200 1209 long frameLastModify = toSave.getLastModifyPrecise(); 1210 1201 1211 boolean fileModifyConflict = fileLastModify > frameLastModify && !isBayFrameset; 1202 1212 boolean versionConflict = savedVersion > toSave.getVersion() && !isBayFrameset; 1213 1203 1214 if ((fileModifyConflict || versionConflict) && savedVersion > 0) { 1204 1215 // remove this frame from the cache if it is there 1205 1216 // This will make sure links to the original are set correctly 1206 1217 _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 1209 1221 SuspendCache(); 1210 1222 Frame original = LoadFrame(toSave.getName()); 1211 1223 toSave.setFrameNumber(nextnum); 1212 1224 ResumeCache(); 1225 1213 1226 // Put the modified version in the cache 1214 1227 addToCache(toSave); … … 1239 1252 MessageBay.displayMessage(yourMessage); 1240 1253 EcosystemManager.getMiscManager().beep(); 1241 } else if (checkBackup1242 && ItemUtils.ContainsExactTag(toSave.getSortedItems(),1243 1254 } 1255 else if (checkBackup 1256 && ItemUtils.ContainsExactTag(toSave.getSortedItems(), ItemUtils.TAG_BACKUP)) { 1244 1257 SuspendCache(); 1245 1258 String oldFramesetName = toSave.getFramesetName() + "-old";
Note:
See TracChangeset
for help on using the changeset viewer.