String () { String installationId = null; try { final ApplicationInfoEx appInfo = ApplicationInfoImpl.getShadowInstance(); final Preferences oldPrefs = Preferences.userRoot(); final String oldValue = appInfo.isVendorJetBrains()? oldPrefs.get(OLD_USER_ON_MACHINE_ID_KEY, null) : null; // compatibility with previous versions final String companyName = appInfo.getShortCompanyName(); final Preferences prefs = Preferences.userRoot().node(StringUtil.isEmptyOrSpaces(companyName)? "jetbrains" : StringUtil.toLowerCase(companyName)); installationId = prefs.get(INSTALLATION_ID_KEY, null); if (StringUtil.isEmptyOrSpaces(installationId)) { installationId = !StringUtil.isEmptyOrSpaces(oldValue) ? oldValue : UUID.randomUUID().toString(); prefs.put(INSTALLATION_ID_KEY, installationId); } if (!appInfo.isVendorJetBrains()) { return installationId; } // for Windows attempt to use PermanentUserId, so that DotNet products and IDEA would use the same ID. if (SystemInfo.isWindows) { installationId = syncWithSharedFile("PermanentUserId", installationId, prefs, INSTALLATION_ID_KEY); } // make sure values in older location and in the new location are the same if (!installationId.equals(oldValue)) { oldPrefs.put(OLD_USER_ON_MACHINE_ID_KEY, installationId); } } catch (Throwable ex) { // should not happen LOG.info("Unexpected error initializing Installation ID", ex); } return installationId == null? UUID.randomUUID().toString() : installationId; }