Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
273,500
int (@NotNull String version) { try { return Integer.parseInt(version); } catch (NumberFormatException e) { return 0; } }
tryParseInt
273,501
int (@NotNull EventLogMajorVersion o) { int[] c1 = myComponents; int[] c2 = o.myComponents; for (int i = 0; i < Math.min(c1.length, c2.length); i++) { if (c1[i] == c2[i] && c1[i] == SNAPSHOT_VALUE) return 0; if (c1[i] == SNAPSHOT_VALUE) return 1; if (c2[i] == SNAPSHOT_VALUE) return -1; int result = c1[i] - c2[i]; if (result != 0) return result; } return c1.length - c2.length; }
compareTo
273,502
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; EventLogMajorVersion number = (EventLogMajorVersion)o; return Arrays.equals(myComponents, number.myComponents); }
equals
273,503
int () { return Arrays.hashCode(myComponents); }
hashCode
273,504
String (@NotNull String recorderId) { return isBaseRecorder(recorderId) ? DEVICE_ID_PREFERENCE_KEY : StringUtil.toLowerCase(recorderId) + "_" + DEVICE_ID_PREFERENCE_KEY; }
getPreferenceKey
273,505
boolean (@NotNull String recorderId) { return "FUS".equals(recorderId); }
isBaseRecorder
273,506
boolean (@NotNull String recorderId) { return UNDEFINED.equals(recorderId); }
isUndefinedRecorder
273,507
String (@NotNull String fileName, @NotNull String installationId, @NotNull Preferences prefs, @NotNull String prefsKey) { final String appdata = System.getenv("APPDATA"); if (appdata != null) { final File dir = new File(appdata, "JetBrains"); if (dir.exists() || dir.mkdirs()) { final File permanentIdFile = new File(dir, fileName); try { String fromFile = ""; if (permanentIdFile.exists()) { fromFile = loadFromFile(permanentIdFile).trim(); } if (!fromFile.isEmpty()) { if (!fromFile.equals(installationId)) { installationId = fromFile; prefs.put(prefsKey, installationId); } } else { writeToFile(permanentIdFile, installationId); } } catch (IOException ignored) { } } } return installationId; }
syncWithSharedFile
273,508
void (@NotNull String fileName) { try { String appdata = System.getenv("APPDATA"); if (appdata != null) { File dir = new File(appdata, "JetBrains"); if (dir.exists()) { File permanentIdFile = new File(dir, fileName); if (permanentIdFile.exists()) { //noinspection ResultOfMethodCallIgnored permanentIdFile.delete(); } } } } catch (Exception ignored) { } }
deleteLegacySharedFile
273,509
Preferences (@NotNull ApplicationInfoEx appInfo) { String companyName = appInfo.getShortCompanyName(); String name = StringUtil.isEmptyOrSpaces(companyName) ? "jetbrains" : companyName.toLowerCase(Locale.US); return Preferences.userRoot().node(name); }
getPreferences
273,510
String (@NotNull Calendar calendar, char OSChar) { int year = calendar.get(Calendar.YEAR); if (year < 2000) year = 2000; if (year > 2099) year = 2099; calendar.set(Calendar.YEAR, year); return new SimpleDateFormat("ddMMyy", Locale.ENGLISH).format(calendar.getTime()) + OSChar + UUID.randomUUID(); }
generateId
273,511
char () { if (SystemInfo.isWindows) return '1'; else if (SystemInfo.isMac) return '2'; else if (SystemInfo.isLinux) return '3'; return '0'; }
getOSChar
273,512
boolean (@NotNull String recorderId) { return ContainerUtil.find(BUILT_IN_RECORDERS, it -> it.equals(recorderId)) != null; }
isBuildInRecorder
273,513
boolean () { if (ApplicationManager.getApplication().isInternal()) { return isFusInternalTestMode() || !StringUtil.isEmptyOrSpaces(System.getProperty(IDEA_RECORDER_INTERNAL_MODE)); } return false; }
isAnyTestModeEnabled
273,514
List<String> () { if (isAnyTestModeEnabled()) { if (isFusInternalTestMode()) { return ContainerUtil.map(StatisticsEventLogProviderUtil.getEventLogProviders(), it -> it.getRecorderId()); } List<String> custom = getCustomTestModeRecorders(); if (!custom.isEmpty()) { return custom; } } return Collections.emptyList(); }
getRecordersInTestMode
273,515
boolean (@NotNull String recorderId) { if (isAnyTestModeEnabled()) { if (isFusInternalTestMode()) { return true; } return getCustomTestModeRecorders().contains(recorderId); } return false; }
isTestModeEnabled
273,516
boolean (@NotNull String recorderId) { return StatisticsEventLogProviderUtil.getEventLogProvider(recorderId).isCharsEscapingRequired(); }
isCharsEscapingRequired
273,517
List<String> () { String additional = System.getProperty(IDEA_RECORDER_INTERNAL_MODE); if (!StringUtil.isEmptyOrSpaces(additional)) { String[] split = additional.split(";"); return ContainerUtil.mapNotNull(split, item -> StringUtil.nullize(item.trim())); } return Collections.emptyList(); }
getCustomTestModeRecorders
273,518
boolean () { return Boolean.getBoolean(IDEA_FUS_RECORDER_INTERNAL_MODE); }
isFusInternalTestMode
273,519
boolean () { if (isSuppressStatisticsReport() || isLocalStatisticsWithoutReport()) { return false; } if (ApplicationManager.getApplication().isHeadlessEnvironment()) { return isHeadlessStatisticsEnabled(); } UsageStatisticsPersistenceComponent settings = UsageStatisticsPersistenceComponent.getInstance(); return settings != null && settings.isAllowed(); }
isSendAllowed
273,520
boolean () { if (ApplicationManager.getApplication().isHeadlessEnvironment()) { return isHeadlessStatisticsEnabled(); } if (!isDisableCollectStatistics() && !isCollectionForceDisabled()) { UsageStatisticsPersistenceComponent settings = UsageStatisticsPersistenceComponent.getInstance(); if ((settings != null && settings.isAllowed()) || isLocalStatisticsWithoutReport()) { return true; } } return false; }
isCollectAllowed
273,521
boolean () { ExternalEventLogSettings externalEventLogSettings = StatisticsEventLogProviderUtil.getExternalEventLogSettings(); return externalEventLogSettings != null && externalEventLogSettings.forceLoggingAlwaysEnabled(); }
isForceCollectEnabled
273,522
boolean () { return isCollectAllowed() || isForceCollectEnabled(); }
isCollectAllowedOrForced
273,523
boolean () { ExternalEventLogSettings externalEventLogSettings = StatisticsEventLogProviderUtil.getExternalEventLogSettings(); if (externalEventLogSettings != null) return externalEventLogSettings.isSendAllowedOverride(); else return false; }
getSendAllowedOverride
273,524
boolean () { ExternalEventLogSettings externalEventLogSettings = StatisticsEventLogProviderUtil.getExternalEventLogSettings(); return externalEventLogSettings != null && externalEventLogSettings.isCollectAllowedOverride(); }
getCollectAllowedOverride
273,525
boolean () { ExternalEventLogSettings externalEventLogSettings = StatisticsEventLogProviderUtil.getExternalEventLogSettings(); return externalEventLogSettings != null && externalEventLogSettings.forceDisableCollectionConsent(); }
isCollectionForceDisabled
273,526
boolean () { return Boolean.getBoolean(IDEA_HEADLESS_ENABLE_STATISTICS); }
isHeadlessStatisticsEnabled
273,527
boolean () { return isLocalStatisticsWithoutReport() || isTeamcityDetected() || isUseTestStatisticsSendEndpoint() || isUseTestStatisticsConfig(); }
isTestStatisticsEnabled
273,528
StatisticsService (@NotNull String recorderId) { EventLogSendListener listener = new EventLogSendListener() { @Override public void onLogsSend(@NotNull List<String> successfullySentFiles, @NotNull List<Integer> errors, int totalLocalFiles) { int success = successfullySentFiles.size(); int failed = errors.size(); EventLogSystemLogger.logFilesSend( recorderId, totalLocalFiles, success, failed, false, successfullySentFiles, errors ); } }; return new EventLogStatisticsService( EventLogInternalSendConfig.createByRecorder(recorderId, true), new EventLogInternalApplicationInfo(isUseTestStatisticsConfig(), isUseTestStatisticsSendEndpoint()), listener ); }
getEventLogStatisticsService
273,529
void (@NotNull List<String> successfullySentFiles, @NotNull List<Integer> errors, int totalLocalFiles) { int success = successfullySentFiles.size(); int failed = errors.size(); EventLogSystemLogger.logFilesSend( recorderId, totalLocalFiles, success, failed, false, successfullySentFiles, errors ); }
onLogsSend
273,530
EventLogUploadSettingsService (@NotNull String recorderId, boolean isTestConfig, boolean isTestSendEndpoint, long cacheTimeoutMs) { return new EventLogUploadSettingsService(recorderId, new EventLogInternalApplicationInfo(isTestConfig, isTestSendEndpoint), cacheTimeoutMs); }
createExternalSettings
273,531
boolean () { return Strings.isNotEmpty(System.getenv("TEAMCITY_VERSION")); }
isTeamcityDetected
273,532
boolean () { return Boolean.getBoolean(IDEA_SUPPRESS_REPORT_STATISTICS); }
isSuppressStatisticsReport
273,533
boolean () { return Boolean.getBoolean(ENABLE_LOCAL_STATISTICS_WITHOUT_REPORT); }
isLocalStatisticsWithoutReport
273,534
boolean () { return Boolean.getBoolean(USE_TEST_STATISTICS_SEND_ENDPOINT); }
isUseTestStatisticsSendEndpoint
273,535
boolean () { return Boolean.getBoolean(USE_TEST_STATISTICS_CONFIG); }
isUseTestStatisticsConfig
273,536
boolean () { return Boolean.getBoolean(DISABLE_COLLECT_STATISTICS); }
isDisableCollectStatistics
273,537
long () { return mySentTime; }
getLastTimeSent
273,538
void (long time) { mySentTime = time; }
setSentTime
273,539
UsageStatisticsPersistenceComponent () { return ApplicationManager.getApplication().getService(UsageStatisticsPersistenceComponent.class); }
getInstance
273,540
void (@NotNull final Element element) { try { setSentTime(Long.parseLong(element.getAttributeValue(LAST_TIME_ATTR, "0"))); } catch (NumberFormatException e) { setSentTime(0); } final String isAllowedEapValue = element.getAttributeValue(IS_ALLOWED_EAP_ATTR, "true"); isAllowedForEAP = (isAllowedEapValue == null || isAllowedEapValue.isBlank()) || Boolean.parseBoolean(isAllowedEapValue); // compatibility: if was previously allowed, transfer the setting to the new place final String isAllowedValue = element.getAttributeValue(IS_ALLOWED_ATTR); if (isAllowedValue != null && !isAllowedValue.isBlank() && Boolean.parseBoolean(isAllowedValue)) { final ConsentOptionsProvider options = getConsentOptionsProvider(); if (options != null) { options.setSendingUsageStatsAllowed(true); } } String isShowNotificationValue = element.getAttributeValue(SHOW_NOTIFICATION_ATTR); setShowNotification((isShowNotificationValue == null || isShowNotificationValue.isBlank()) || Boolean.parseBoolean(isShowNotificationValue)); myRecorderToSystemEventIds.clear(); for (Element path : element.getChildren(SYSTEM_EVENT_ATTR)) { String recorder = path.getAttributeValue(RECORDER_ATTR); if (recorder != null && !recorder.isEmpty()) { try { long eventId = Long.parseLong(path.getAttributeValue(EVENT_ID_ATTR, "0")); myRecorderToSystemEventIds.put(recorder, eventId); } catch (NumberFormatException ignored) { } } } }
loadState
273,541
Element () { Element element = new Element("state"); long lastTimeSent = getLastTimeSent(); if (lastTimeSent > 0) { element.setAttribute(LAST_TIME_ATTR, String.valueOf(lastTimeSent)); } if (!isShowNotification()) { element.setAttribute(SHOW_NOTIFICATION_ATTR, "false"); } if (!isAllowedForEAP) { element.setAttribute(IS_ALLOWED_EAP_ATTR, "false"); } for (Map.Entry<String, Long> entry : myRecorderToSystemEventIds.entrySet()) { final Element event = new Element(SYSTEM_EVENT_ATTR); event.setAttribute(RECORDER_ATTR, entry.getKey()); event.setAttribute(EVENT_ID_ATTR, String.valueOf(entry.getValue())); element.addContent(event); } return element; }
getState
273,542
void (boolean allowed) { final ConsentOptionsProvider options = getConsentOptionsProvider(); if (options != null) { if (options.isEAP()) { isAllowedForEAP = allowed; } else { options.setSendingUsageStatsAllowed(allowed); } } }
setAllowed
273,543
boolean () { final ConsentOptionsProvider options = getConsentOptionsProvider(); if (options == null) { return false; } return options.isEAP() ? isAllowedForEAP : options.isSendingUsageStatsAllowed(); }
isAllowed
273,544
void (boolean showNotification) { isShowNotification = showNotification; }
setShowNotification
273,545
boolean () { return isShowNotification && !ApplicationManager.getApplication().isInternal(); }
isShowNotification
273,546
ConsentOptionsProvider () { return ApplicationManager.getApplication().getService(ConsentOptionsProvider.class); }
getConsentOptionsProvider
273,547
long (@NotNull String recorderId) { Long eventId = myRecorderToSystemEventIds.get(recorderId); return eventId != null ? eventId : 0; }
getSystemEventId
273,548
void (@NotNull String recorderId, long eventId) { myRecorderToSystemEventIds.put(recorderId, eventId); }
setSystemEventId
273,549
String () { return "plugin"; }
getRuleId
273,550
ValidationResultType (@NotNull String data, @NotNull EventContext context) { return isPluginFromPluginRepository(data) ? ValidationResultType.ACCEPTED : ValidationResultType.REJECTED; }
doValidate
273,551
void (@NotNull ActionCustomPlaceAllowlist extension, @NotNull PluginDescriptor pluginDescriptor) { registerCustomPlaces(extension.places); }
extensionAdded
273,552
void (@Nullable String place) { if (Strings.isNotEmpty(place)) { if (!place.contains(";")) { ourCustomPlaces.add(place); } else { ourCustomPlaces.addAll(StringUtil.split(place, ";")); } } }
registerCustomPlaces
273,553
boolean (@NotNull String place) { return ourCustomPlaces.contains(place); }
isCustomActionPlace
273,554
String () { return "lang"; }
getRuleId
273,555
ValidationResultType (@NotNull String data, @NotNull EventContext context) { if (isThirdPartyValue(data)) return ValidationResultType.ACCEPTED; final Language language = Language.findLanguageByID(data); if (language == null) { return ValidationResultType.REJECTED; } return PluginInfoDetectorKt.getPluginInfo(language.getClass()).isSafeToReport() ? ValidationResultType.ACCEPTED : ValidationResultType.THIRD_PARTY; }
doValidate
273,556
String () { return "class_name"; }
getRuleId
273,557
boolean (@Nullable String ruleId) { return "dialog_class".equals(ruleId) || "quick_fix_class_name".equals(ruleId) || getRuleId().equals(ruleId); }
acceptRuleId
273,558
ValidationResultType (@NotNull String data, @NotNull EventContext context) { if (isThirdPartyValue(data)) return ValidationResultType.ACCEPTED; final PluginInfo info = PluginInfoDetectorKt.getPluginInfo(getClassName(data)); context.setPayload(PLUGIN_INFO, info); if (info.getType() == PluginType.UNKNOWN) { // if we can't detect a plugin then probably it's not a class name return ValidationResultType.REJECTED; } return info.isSafeToReport() ? ValidationResultType.ACCEPTED : ValidationResultType.THIRD_PARTY; }
doValidate
273,559
String (@NotNull String data) { int i = data.indexOf("$$Lambda$"); if (i == -1) { return data; } return data.substring(0, i); }
getClassName
273,560
long () { return myUsersCount; }
getUsersCount
273,561
long () { return myUsagesCount; }
getUsagesCount
273,562
double () { return myUsagesPerUserRatio; }
getUsagesPerUserRatio
273,563
double () { return myUsersRatio; }
getUsersRatio
273,564
int () { return DEFAULT_STATISTICS_VERSION; }
getDefaultStatisticsVersion
273,565
int () { return UPDATED_STATISTICS_VERSION; }
getUpdatedStatisticsVersion
273,566
ActionGlobalUsageInfo (String actionID) { return myStatisticsMap.get(actionID); }
getActionStatistics
273,567
ActionGlobalUsageInfo (String actionID) { return myUpdatedStatisticsMap.get(actionID); }
getUpdatedActionStatistics
273,568
ActionsGlobalTotalSummary () { return mySummary; }
getTotalSummary
273,569
ActionsGlobalTotalSummary () { return myUpdatedSummary; }
getUpdatedTotalSummary
273,570
ActionsGlobalTotalSummary (Map<String, ActionGlobalUsageInfo> statistics) { long maxCount = 0; long minCount = Long.MAX_VALUE; for (ActionGlobalUsageInfo value : statistics.values()) { long count = value.getUsagesCount(); maxCount = Math.max(count, maxCount); minCount = Math.min(count, minCount); } return new ActionsGlobalTotalSummary(maxCount, minCount); }
calculateTotalSummary
273,571
record (long maxUsageCount, long minUsageCount) { }
ActionsGlobalTotalSummary
273,572
String () { Application app = ApplicationManager.getApplication(); if (app != null && !app.isDisposed()) { String productName = ApplicationNamesInfo.getInstance().getFullProductName(); String version = ApplicationInfo.getInstance().getBuild().asStringWithoutProductCode(); return productName + '/' + version; } return "IntelliJ"; }
getUserAgent
273,573
StatsProxyInfo (@NotNull String url) { Application app = ApplicationManager.getApplication(); if (app != null && !app.isDisposed()) { Proxy proxy = findProxy(url); if (proxy != Proxy.NO_PROXY) { return new StatsProxyInfo(proxy, getAuthProvider()); } } return NO_PROXY; }
selectProxy
273,574
Proxy (@NotNull String url) { try { List<Proxy> proxies = IdeUiService.getInstance().getProxyList(new URL(url)); return !proxies.isEmpty() ? proxies.get(0) : Proxy.NO_PROXY; } catch (MalformedURLException e) { // ignore } return Proxy.NO_PROXY; }
findProxy
273,575
void (String message) { myLogger.info(message); }
info
273,576
void (@Nullable String message, Throwable t) { myLogger.info(message, t); }
info
273,577
void (String message) { myLogger.warn(message); }
warn
273,578
void (@Nullable String message, Throwable t) { myLogger.warn(message, t); }
warn
273,579
void (String message) { myLogger.trace(message); }
trace
273,580
boolean () { return myLogger.isTraceEnabled(); }
isTraceEnabled
273,581
void (@NotNull String recorderId, @NotNull String eventId, @NotNull Throwable exception) { EventLogSystemLogger.logSystemError(recorderId, eventId, exception.getClass().getName(), -1); }
logErrorEvent
273,582
String () { return EVENT_LOG_SETTINGS_URL_TEMPLATE; }
getTemplateUrl
273,583
String () { return ApplicationInfo.getInstance().getBuild().getProductCode(); }
getProductCode
273,584
String () { final ApplicationInfo info = ApplicationInfo.getInstance(); return info.getMajorVersion() + "." + info.getMinorVersion(); }
getProductVersion
273,585
int () { final ApplicationInfo info = ApplicationInfo.getInstance(); return info.getBuild().getBaselineVersion(); }
getBaselineVersion
273,586
EventLogConnectionSettings () { return myConnectionSettings; }
getConnectionSettings
273,587
boolean () { return StatisticsUploadAssistant.isTestStatisticsEnabled(); }
isInternal
273,588
boolean () { return myIsTestConfig; }
isTestConfig
273,589
boolean () { return myIsTestSendEndpoint; }
isTestSendEndpoint
273,590
boolean () { return ApplicationManager.getApplication().isEAP(); }
isEAP
273,591
DataCollectorDebugLogger () { return LOG; }
getLogger
273,592
DataCollectorSystemEventLogger () { return myEventLogger; }
getEventLogger
273,593
EventLogConfigOptionsService () { return ApplicationManager.getApplication().getService(EventLogConfigOptionsService.class); }
getInstance
273,594
void (@NotNull String recorderId, @NotNull EventLogMetadataLoader loader) { EventLogMetadataSettingsPersistence persisted = EventLogMetadataSettingsPersistence.getInstance(); Map<String, String> newOptions = ContainerUtil.filter(loader.getOptionValues(), option -> ourOptions.contains(option)); Map<String, String> changedOptions = persisted.updateOptions(recorderId, newOptions); if (!changedOptions.isEmpty()) { ApplicationManager.getApplication().getMessageBus().syncPublisher(TOPIC).optionsChanged(recorderId, changedOptions); } }
updateOptions
273,595
EventLogOptions (@NotNull String recorderId) { return new EventLogOptions(EventLogMetadataSettingsPersistence.getInstance().getOptions(recorderId)); }
getOptions
273,596
void (@NotNull String recorderId, @NotNull Map<String, String> options) { if (StringUtil.equals(myRecorderId, recorderId)) { for (Map.Entry<String, String> entry : options.entrySet()) { String name = entry.getKey(); String value = entry.getValue(); if (StringUtil.equals(name, DATA_THRESHOLD)) { onThresholdChanged(tryParseInt(value)); } if (StringUtil.equals(name, GROUP_THRESHOLD)) { onGroupThresholdChanged(tryParseInt(value)); } if (StringUtil.equals(name, GROUP_ALERT_THRESHOLD)) { onGroupAlertThresholdChanged(tryParseInt(value)); } } } }
optionsChanged
273,597
void (@NotNull String recorderId, @Nullable String version) { final FeatureUsageData data = new FeatureUsageData(recorderId).addVersionByString(version); logEvent(recorderId, "metadata.loaded", data); }
logMetadataLoad
273,598
void (@NotNull String recorderId, @Nullable String version) { final FeatureUsageData data = new FeatureUsageData(recorderId).addVersionByString(version); logEvent(recorderId, "metadata.updated", data); }
logMetadataUpdated
273,599
void (@NotNull String recorderId, @NotNull EventLogMetadataUpdateError error) { logMetadataError(recorderId, "metadata.load.failed", error); }
logMetadataErrorOnLoad