Resolve Conflict Bug

Bug #1029349 reported by Guillermo Guerrero
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Syncany
New
Undecided
Unassigned

Bug Description

Hi,

I found another bug in remotewatcher/ChangeManager.java in function private void resolveConflict(CloneFile firstConflictingVersion, Update conflictUpdate)

When it renames the name of the firstConflictversion and laters versions, it needs to set a new FileId.
I fixed with this:

for (CloneFile cf : versionsToAdjust) {
            CloneFile cfclone = (CloneFile) cf.clone();

            // New filename
            String newFileName =
                    FileUtil.getBasename(cf.getName())
                    + " (" + config.getMachineName()
                    + (config.getMachineName().endsWith("s") ? "'" : "'s")
                    + " conflicting copy, "
                    + dateFormat.format(cfclone.getUpdated())
                    + ")" + FileUtil.getExtension(cf.getName(), true);

            // New file
            cfclone.setStatus(Status.NEW);
            cfclone.setName(newFileName);
            cfclone.setVersion(version);
            cfclone.setFileId(new Random().nextLong());

            newConflictingLocalFile = cfclone;

            logger.info("- Removing version " + cf + " from DB: " + cf.getAbsolutePath());
            em.remove(em.merge(cf));

            logger.info("- Adding adjusted version " + cfclone + " from DB: " + cfclone.getAbsolutePath());
            em.persist(cfclone);

            version++;
        }

Regards!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.