protected int updateItem(SyncItem item) throws SyncException {
   if (Log.isLoggable(Log.DEBUG)) {
     Log.debug(TAG_LOG, "updateItem");
   }
   JSONSyncItem jsonSyncItem = (JSONSyncItem) item;
   try {
     String fullName = getFileFullName(jsonSyncItem.getContentName());
     item.setKey(fullName);
     if (Log.isLoggable(Log.DEBUG)) {
       Log.debug(TAG_LOG, "key set to:" + fullName);
     }
     if (jsonSyncItem.isItemKeyUpdated()) {
       // Update the tracker of the renamed item
       // Must be done before renaming the file since the rename
       // event will be notified to the tracker itself
       getTracker()
           .removeItem(new SyncItem(jsonSyncItem.getOldKey(), null, SyncItem.STATE_DELETED, null));
       getTracker()
           .removeItem(new SyncItem(jsonSyncItem.getKey(), null, SyncItem.STATE_NEW, null));
     }
     if (jsonSyncItem.isItemContentUpdated()) {
       // The new content has been downloaded into a temporary file
       String sourceFileName = createTempFileName(jsonSyncItem.getContentName());
       renameTempFile(sourceFileName, fullName);
       if (jsonSyncItem.isItemKeyUpdated()) {
         // We shall remove the old file
         String oldFileName = jsonSyncItem.getOldKey();
         FileAdapter fa = new FileAdapter(oldFileName);
         fa.delete();
       }
     } else if (jsonSyncItem.isItemKeyUpdated()) {
       // This is just a rename
       String sourceFileName = jsonSyncItem.getOldKey();
       renameTempFile(sourceFileName, fullName);
     }
     super.updateItem(item);
     return SyncSource.SUCCESS_STATUS;
   } catch (IOException ioe) {
     Log.error(TAG_LOG, "Cannot rename temporary file", ioe);
     throw new SyncException(SyncException.CLIENT_ERROR, "Cannot rename temporary file");
   }
 }