public static synchronized void readRepositoryConfigurationFile() { // IPath configFile = getProductConfigurationCachePath(); if (cacheFileRead || repositoryConfigurationFile == null || !repositoryConfigurationFile.exists()) { return; } synchronized (repositoryConfigurations) { ObjectInputStream in = null; try { in = new ObjectInputStream(new FileInputStream(repositoryConfigurationFile)); int size = in.readInt(); for (int nX = 0; nX < size; nX++) { RepositoryConfiguration item = (RepositoryConfiguration) in.readObject(); if (item != null) { repositoryConfigurations.put(item.getRepositoryUrl(), item); } } } catch (Exception e) { log( new Status( IStatus.INFO, TargetProcessCorePlugin.ID_PLUGIN, ERROR_INCOMPATIBLE_CONFIGURATION)); try { if (in != null) { in.close(); } if (repositoryConfigurationFile != null && repositoryConfigurationFile.exists()) { if (repositoryConfigurationFile.delete()) { // successfully deleted } else { log( new Status( IStatus.ERROR, TargetProcessCorePlugin.ID_PLUGIN, 0, ERROR_DELETING_CONFIGURATION, e)); } } } catch (Exception ex) { log( new Status( IStatus.ERROR, TargetProcessCorePlugin.ID_PLUGIN, 0, ERROR_DELETING_CONFIGURATION, e)); } } finally { cacheFileRead = true; if (in != null) { try { in.close(); } catch (IOException e) { // ignore } } } } }
private static void internalAddConfiguration(RepositoryConfiguration config) { repositoryConfigurations.remove(config.getRepositoryUrl()); repositoryConfigurations.put(config.getRepositoryUrl(), config); }