@Override public void updateDistantDatabase() { fireOnStart(); fireOnTaskChange(I18N.CONSTANTS.synchronizerOrganizationUpload_0()); final Factory factory = Factory.getInstance(); if (factory != null) { final Database database = factory.createDatabase(); database.open(OnlineMode.LOCAL_DATABASE_NAME); try { OrganizationDAO.truncateTables(database); fireOnComplete(); } catch (DatabaseException ex) { Log.debug("Error while removing the organization dto from the local database.", ex); fireOnFailure( false, I18N.CONSTANTS.synchronizerOrganizationUpload_0_failed() + ex.getMessage()); } finally { try { database.close(); } catch (DatabaseException ex) { Log.debug("Database closing error.", ex); fireOnFailure( false, I18N.CONSTANTS.synchronizerOrganizationUpload_0_failed() + ex.getMessage()); } } } else fireOnFailure( false, I18N.CONSTANTS.synchronizerOrganizationUpload_0_failed() + "Google Gears isn't available."); }