Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
273,700 | Set<String> () { try { InputStream resourceStream = resourceHolder.getResourceAsStream(relativePath); if (resourceStream == null) { throw new IOException("Resource " + relativePath + " not found"); } try (BufferedReader reader = new BufferedReader(new InputStreamReader(resourceStream, StandardCharsets.UTF_8))) { final List<String> values = FileUtil.loadLines(reader); if (!values.isEmpty()) { return ContainerUtil.map2SetNotNull(values, s -> createValue(s)); } } } catch (IOException e) { LOG.info(e); } return Collections.emptySet(); } | readItems |
273,701 | EventLogUploadErrorType () { return myErrorType; } | getErrorType |
273,702 | String () { return groupID; } | getGroupId |
273,703 | String (@NotNull String key) { return key.replaceAll(FORBIDDEN_PATTERN, FORBIDDEN_PATTERN_REPLACEMENT); } | replaceForbiddenSymbols |
273,704 | String (@NotNull String key) { return key; } | ensureProperKey |
273,705 | FUCounterUsageLogger () { return ApplicationManager.getApplication().getService(FUCounterUsageLogger.class); } | getInstance |
273,706 | void (@NotNull CounterUsageCollectorEP extension, @NotNull PluginDescriptor pluginDescriptor) { registerGroupFromEP(extension); } | extensionAdded |
273,707 | void (CounterUsageCollectorEP ep) { if (ep.implementationClass == null) { final String id = ep.getGroupId(); if (StringUtil.isNotEmpty(id)) { register(new EventLogGroup(id, ep.version)); } } } | registerGroupFromEP |
273,708 | List<FeatureUsagesCollector> () { List<FeatureUsagesCollector> result = new ArrayList<>(COUNTER_EP_NAME.getPoint().size()); COUNTER_EP_NAME.processWithPluginDescriptor((ep, pluginDescriptor) -> { if (ep.implementationClass != null) { result.add(createCounterCollector(ep, pluginDescriptor)); } return Unit.INSTANCE; }); return result; } | instantiateCounterCollectors |
273,709 | FeatureUsagesCollector ( @NotNull CounterUsageCollectorEP ep, @NotNull PluginDescriptor pluginDescriptor ) { Class<Object> aClass; try { aClass = ApplicationManager.getApplication().loadClass(ep.implementationClass, pluginDescriptor); } catch (ClassNotFoundException e) { throw new PluginException(e, pluginDescriptor.getPluginId()); } Field instanceField; try { instanceField = aClass.getDeclaredField("INSTANCE"); } catch (NoSuchFieldException e) { return ApplicationManager.getApplication().instantiateClass(ep.implementationClass, pluginDescriptor); } instanceField.setAccessible(true); try { return (FeatureUsagesCollector)instanceField.get(null); } catch (IllegalAccessException e) { throw new PluginException(e, pluginDescriptor.getPluginId()); } } | createCounterCollector |
273,710 | void (@NotNull EventLogGroup group) { myGroups.put(group.getId(), group); } | register |
273,711 | CompletableFuture<Void> () { List<CompletableFuture<Void>> futures = new ArrayList<>(); for (EventLogGroup group : myGroups.values()) { futures.add(FeatureUsageLogger.INSTANCE.log(group, EventLogSystemEvents.COLLECTOR_REGISTERED)); } Map<String, StatisticsEventLogger> recorderLoggers = new HashMap<>(); for (FeatureUsagesCollector collector : instantiateCounterCollectors()) { EventLogGroup group = collector.getGroup(); if (group != null) { String recorder = group.getRecorder(); StatisticsEventLogger logger = recorderLoggers.get(recorder); if (logger == null) { logger = StatisticsEventLogProviderUtil.getEventLogProvider(recorder).getLogger(); recorderLoggers.put(recorder, logger); } futures.add(logger.logAsync(group, EventLogSystemEvents.COLLECTOR_REGISTERED, false)); } else { try { // get group id to check that either group or group id is overridden if (StringUtil.isEmpty(collector.getGroupId())) { LOG.error("Please override either getGroupId() or getGroup() with not empty string in " + collector.getClass().getName()); } } catch (IllegalStateException e) { LOG.error(e.getMessage() + " in " + collector.getClass().getName()); } } } return CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])); } | logRegisteredGroups |
273,712 | void (@Nullable Project project, @NonNls @NotNull String groupId, @NonNls @NotNull String eventId) { final EventLogGroup group = findRegisteredGroupById(groupId); if (group != null) { final Map<String, Object> data = new FeatureUsageData(group.getRecorder()).addProject(project).build(); FeatureUsageLogger.INSTANCE.log(group, eventId, data); } } | logEvent |
273,713 | void (@Nullable Project project, @NonNls @NotNull String groupId, @NonNls @NotNull String eventId, @NotNull FeatureUsageData data) { final EventLogGroup group = findRegisteredGroupById(groupId); if (group != null) { FeatureUsageLogger.INSTANCE.log(group, eventId, data.addProject(project).build()); } } | logEvent |
273,714 | void (@NonNls @NotNull String groupId, @NonNls @NotNull String eventId) { final EventLogGroup group = findRegisteredGroupById(groupId); if (group != null) { FeatureUsageLogger.INSTANCE.log(group, eventId); } } | logEvent |
273,715 | void (@NonNls @NotNull String groupId, @NonNls @NotNull String eventId, @NotNull FeatureUsageData data) { final EventLogGroup group = findRegisteredGroupById(groupId); if (group != null) { FeatureUsageLogger.INSTANCE.log(group, eventId, data.build()); } } | logEvent |
273,716 | EventLogGroup (@NotNull String groupId) { if (!myGroups.containsKey(groupId)) { LOG.error( "Cannot record event because group '" + groupId + "' is not registered. " + "To fix it add '<statistics.counterUsagesCollector groupId=\"" + groupId + "\" version=\"1\"/>' in plugin.xml"); return null; } return myGroups.get(groupId); } | findRegisteredGroupById |
273,717 | void () { deleteCaches(getSentDataFile()); deleteCaches(getLegacyStateFile()); deleteCaches(getPersistenceStateFile()); deleteCaches(getStatisticsCacheDirectory()); deleteCaches(getStatisticsLegacyCacheDirectory()); deleteSystemEventIdsFiles(); } | clearLegacyStates |
273,718 | void () { try { File[] files = EventLogConfiguration.getInstance().getEventLogSettingsPath().toFile() .listFiles((directory, name) -> name.endsWith("_system_event_id")); if (files != null) { for (File file : files) { FileUtil.delete(file); } } } catch (Exception e) { LOG.info(e); } } | deleteSystemEventIdsFiles |
273,719 | void (@Nullable File dir) { if (dir != null && dir.exists()) { try { final boolean delete = FileUtil.delete(dir); if (!delete) { LOG.info("Failed deleting legacy caches"); } } catch (Exception e) { LOG.info(e); } } } | deleteCaches |
273,720 | File () { return PathManager.getConfigDir().resolve(FUS_CACHE_PATH + "/").toFile(); } | getStatisticsCacheDirectory |
273,721 | File () { return Paths.get(PathManager.getSystemPath()).resolve(FUS_CACHE_PATH).toFile(); } | getStatisticsLegacyCacheDirectory |
273,722 | File () { return getFileInStatisticsCacheDirectory(PERSISTENCE_STATE_FILE); } | getPersistenceStateFile |
273,723 | File () { return getFileInStatisticsCacheDirectory(LEGACY_PERSISTENCE_STATE_FILE); } | getLegacyStateFile |
273,724 | File (@NotNull String fileName) { return new File(getStatisticsCacheDirectory(), "/" + fileName); } | getFileInStatisticsCacheDirectory |
273,725 | File () { return getFileInStatisticsCacheDirectory(SENT_DATA_FILE); } | getSentDataFile |
273,726 | boolean () { return Pattern.compile(GROUP_ID_PATTERN).matcher(getGroupId()).matches(); } | isValid |
273,727 | String () { EventLogGroup group = getGroup(); if (group == null) { throw PluginException.createByClass("Please override either getGroupId() or getGroup() in " + getClass().getName(), null, getClass()); } return group.getId(); } | getGroupId |
273,728 | int () { EventLogGroup group = getGroup(); if (group != null) { return group.getVersion(); } return 1; } | getVersion |
273,729 | EventLogGroup () { return null; } | getGroup |
273,730 | void (@NotNull PluginDescriptor pluginDescriptor) { myPluginDescriptor = pluginDescriptor; } | setPluginDescriptor |
273,731 | FeatureUsagesCollector () { if (instance != null) return instance; synchronized (this) { if (instance != null) return instance; //noinspection NonPrivateFieldAccessedInSynchronizedContext instance = ApplicationManager.getApplication().instantiateClass(implementationClass, myPluginDescriptor); } return instance; } | getCollector |
273,732 | boolean (String arg) { return arg.startsWith("--"); } | isOptionName |
273,733 | boolean (String arg) { return !EventLogUploaderOptions.INTERNAL_OPTION.equals(arg) && !EventLogUploaderOptions.TEST_SEND_ENDPOINT.equals(arg) && !EventLogUploaderOptions.TEST_CONFIG.equals(arg) && !EventLogUploaderOptions.EAP_OPTION.equals(arg); } | requireValue |
273,734 | void (String[] args) { DataCollectorDebugLogger logger = new ExternalDataCollectorLogger(); ExternalEventsLogger eventsLogger = new ExternalEventsLogger(); try { execute(args, logger, eventsLogger); } catch (Throwable e) { logger.warn("Failed uploading logs", e); eventsLogger.logSendingLogsFinished("EXCEPTION_OCCURRED"); } } | main |
273,735 | void (String[] args, DataCollectorDebugLogger logger, ExternalEventsLogger eventsLogger) { logger.info("Process started with '" + String.join(" ", args) + "'"); logger.info("Classpath:" + System.getProperty("java.class.path")); eventsLogger.logSendingLogsStarted(); if (args.length == 0) { logger.warn("No arguments were found"); eventsLogger.logSendingLogsFinished("NO_ARGUMENTS"); return; } Map<String, String> options = EventLogUploaderCliParser.parseOptions(args); EventLogApplicationInfo appInfo = newApplicationInfo(options, logger, eventsLogger); if (appInfo == null) { logger.warn("Failed creating application info from arguments"); eventsLogger.logSendingLogsFinished("NO_APPLICATION_CONFIG"); return; } List<EventLogExternalSendConfig> configs = EventLogExternalSendConfig.parseSendConfigurations(options, (recorder, error) -> { logger.warn("[" + recorder + "] Failed creating send config from arguments because " + error.getType().name()); eventsLogger.logSendingLogsFinished(recorder, error.getType().name()); }); if (!waitForIde(logger, options, 20)) { logger.warn("Cannot send logs because IDE didn't close during " + (20 * WAIT_FOR_IDE_MS) + "ms"); eventsLogger.logSendingLogsFinished("IDE_NOT_CLOSING"); return; } ExecutorService service = Executors.newFixedThreadPool(configs.size()); for (EventLogExternalSendConfig config : configs) { service.execute(() -> sendLogsByRecorder(appInfo, config, logger, eventsLogger)); } service.shutdown(); try { service.awaitTermination(5, TimeUnit.MINUTES); } catch (InterruptedException e) { // ignore } } | execute |
273,736 | void (@NotNull EventLogApplicationInfo appInfo, @NotNull EventLogSendConfig config, @NotNull DataCollectorDebugLogger logger, @NotNull ExternalEventsLogger eventsLogger) { String recorderId = config.getRecorderId(); logger.info("[" + recorderId + "] Start uploading..."); EventLogConnectionSettings connectionSettings = appInfo.getConnectionSettings(); logger.info("[" + recorderId + "] {" + "product:" + appInfo.getProductCode() + ", productVersion:" + appInfo.getProductVersion() + ", userAgent:" + connectionSettings.getUserAgent() + ", url: " + appInfo.getTemplateUrl() + ", internal:" + appInfo.isInternal() + ", isTestConfig:" + appInfo.isTestConfig() + ", isTestSendEndpoint:" + appInfo.isTestSendEndpoint() + "}"); String logs = config.getFilesToSendProvider().getFilesToSend().stream(). map(file -> file.getFile().getAbsolutePath()).collect(Collectors.joining(File.pathSeparator)); logger.info("[" + recorderId + "] {recorder:" + config.getRecorderId() + ", files:" + logs + "}"); logger.info("[" + recorderId + "] {device:" + config.getDeviceId() + ", bucket:" + config.getBucket() + "}"); try { EventLogStatisticsService service = new EventLogStatisticsService( config, appInfo, new EventLogSendListener() { @Override public void onLogsSend(@NotNull List<String> successfullySentFiles, @NotNull List<Integer> errors, int totalLocalFiles) { eventsLogger.logSendingLogsSucceed(recorderId, successfullySentFiles, errors, totalLocalFiles); } }); StatisticsResult result = service.send(); eventsLogger.logSendingLogsFinished(recorderId, result.getCode()); if (logger.isTraceEnabled()) { logger.trace("[" + recorderId + "] Uploading finished with " + result.getCode().name()); logger.trace("[" + recorderId + "] " + result.getDescription()); } } catch (Exception e) { logger.warn("[" + recorderId + "] Failed sending files: " + e.getMessage()); eventsLogger.logSendingLogsFinished(recorderId, "ERROR_ON_SEND"); } } | sendLogsByRecorder |
273,737 | void (@NotNull List<String> successfullySentFiles, @NotNull List<Integer> errors, int totalLocalFiles) { eventsLogger.logSendingLogsSucceed(recorderId, successfullySentFiles, errors, totalLocalFiles); } | onLogsSend |
273,738 | EventLogApplicationInfo (Map<String, String> options, DataCollectorDebugLogger logger, DataCollectorSystemEventLogger eventLogger) { String productCode = options.get(EventLogUploaderOptions.PRODUCT_OPTION); String productVersion = options.get(EventLogUploaderOptions.PRODUCT_VERSION_OPTION); String url = options.get(EventLogUploaderOptions.URL_OPTION); String userAgent = options.get(EventLogUploaderOptions.USER_AGENT_OPTION); String headersString = options.get(EventLogUploaderOptions.EXTRA_HEADERS); Map<String, String> extraHeaders = ExtraHTTPHeadersParser.parse(headersString); int baselineVersion = Integer.parseInt(options.get(EventLogUploaderOptions.BASELINE_VERSION)); if (url != null && productCode != null) { boolean isInternal = options.containsKey(EventLogUploaderOptions.INTERNAL_OPTION); boolean isTestSendEndpoint = options.containsKey(EventLogUploaderOptions.TEST_SEND_ENDPOINT); boolean isTestConfig = options.containsKey(EventLogUploaderOptions.TEST_CONFIG); boolean isEAP = options.containsKey(EventLogUploaderOptions.EAP_OPTION); return new EventLogExternalApplicationInfo( url, productCode, productVersion, userAgent, isInternal, isTestConfig, isTestSendEndpoint, isEAP, extraHeaders, logger, eventLogger, baselineVersion); } return null; } | newApplicationInfo |
273,739 | boolean (DataCollectorDebugLogger logger, Map<String, String> options, int maxAttempts) { String ideToken = options.get(EventLogUploaderOptions.IDE_TOKEN); if (ideToken == null) { return true; } logger.info("IDE token file: " + ideToken); File token = new File(ideToken); try { int attempt = 0; while (attempt < maxAttempts && token.exists()) { logger.info("Waiting for " + WAIT_FOR_IDE_MS + "ms for IDE to close. Attempt #" + attempt); //noinspection BusyWait Thread.sleep(WAIT_FOR_IDE_MS); attempt++; } } catch (InterruptedException e) { // ignore } return !token.exists(); } | waitForIde |
273,740 | String () { return myRecorderId; } | getRecorderId |
273,741 | String () { return myDeviceId; } | getDeviceId |
273,742 | int () { return myBucket; } | getBucket |
273,743 | MachineId () { return myMachineId; } | getMachineId |
273,744 | boolean () { return myIsSendEnabled; } | isSendEnabled |
273,745 | boolean () { return myIsEscapeEnabled; } | isEscapingEnabled |
273,746 | FilesToSendProvider () { return myFilesProvider; } | getFilesToSendProvider |
273,747 | List<EventLogExternalSendConfig> (@NotNull Map<String, String> options, @NotNull ParseConfigurationExceptionHandler errorHandler) { String recorder = options.get(EventLogUploaderOptions.RECORDERS_OPTION); if (recorder == null) { return Collections.emptyList(); } String[] recorderIds = recorder.split(";"); List<EventLogExternalSendConfig> configurations = new ArrayList<>(); for (String recorderId : recorderIds) { try { configurations.add(parseSendConfiguration(recorderId, options)); } catch (ParseSendConfigurationException e) { errorHandler.handle(recorderId, e); } } return configurations; } | parseSendConfigurations |
273,748 | int (@NotNull String name, @NotNull Map<String, String> options) { try { String option = options.get(name); return option != null ? Integer.parseInt(option) : -1; } catch (NumberFormatException e) { // ignore } return -1; } | getIntOption |
273,749 | Boolean (@NotNull String name, @NotNull Map<String, String> options) { String option = options.get(name); return option != null ? Boolean.parseBoolean(option) : null; } | getBooleanOption |
273,750 | ParseErrorType () { return myType; } | getType |
273,751 | String (long requiredFreeSpace) { String dir = System.getProperty("java.io.tmpdir"); if (dir != null && isValidDir(dir, requiredFreeSpace)) { return dir; } return null; } | findDirectory |
273,752 | boolean (String path, long space) { File dir = new File(path); return dir.isDirectory() && dir.canWrite() && dir.getUsableSpace() >= space; } | isValidDir |
273,753 | Handler (@NotNull String logPath) { try { @NonNls FileHandler appender = new FileHandler(logPath, false); appender.setLevel(Level.ALL); appender.setFormatter(new Formatter() { @Override public String format(LogRecord record) { String level = record.getLevel() == Level.WARNING ? "WARN" : record.getLevel().toString(); String result = String.format("%1$td/%1$tm %1$tT %2$5s %3$s - %4$s%5$s", record.getMillis(), level, record.getLoggerName(), record.getMessage(), System.lineSeparator()); Throwable thrown = record.getThrown(); if (thrown != null) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); thrown.printStackTrace(pw); return result + sw; } return result; } }); return appender; } catch (IOException e) { //noinspection UseOfSystemOutOrSystemErr System.err.println("Error creating log file: " + e.getMessage()); return new ConsoleHandler(); } } | newAppender |
273,754 | String (LogRecord record) { String level = record.getLevel() == Level.WARNING ? "WARN" : record.getLevel().toString(); String result = String.format("%1$td/%1$tm %1$tT %2$5s %3$s - %4$s%5$s", record.getMillis(), level, record.getLoggerName(), record.getMessage(), System.lineSeparator()); Throwable thrown = record.getThrown(); if (thrown != null) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); thrown.printStackTrace(pw); return result + sw; } return result; } | format |
273,755 | void (String message) { myLogger.info(message); } | info |
273,756 | void (String message, Throwable t) { myLogger.log(Level.INFO, message, t); } | info |
273,757 | void (String message) { myLogger.warning(message); } | warn |
273,758 | void (String message, Throwable t) { myLogger.log(Level.WARNING, message, t); } | warn |
273,759 | void (String message) { myLogger.finer(message); } | trace |
273,760 | boolean () { return myLogger.isLoggable(Level.FINER); } | isTraceEnabled |
273,761 | String (@NotNull Map<String, String> headers) { StringBuilder stringBuilder = new StringBuilder(); headers.forEach((k, v) -> { stringBuilder.append(k); stringBuilder.append('='); stringBuilder.append(v); stringBuilder.append(';'); }); if (!headers.isEmpty()) stringBuilder.deleteCharAt(stringBuilder.length() - 1); return stringBuilder.toString(); } | serialize |
273,762 | int () { return mySucceed; } | getSucceed |
273,763 | int () { return myFailed; } | getFailed |
273,764 | int () { return myTotal; } | getTotal |
273,765 | List<String> () { return mySuccessfullySentFiles; } | getSuccessfullySentFiles |
273,766 | List<Integer> () { return myErrors; } | getErrors |
273,767 | boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; ExternalUploadSendEvent event = (ExternalUploadSendEvent)o; return mySucceed == event.mySucceed && myFailed == event.myFailed && myTotal == event.myTotal && Objects.equals(mySuccessfullySentFiles, event.mySuccessfullySentFiles) && Objects.equals(myErrors, event.myErrors); } | equals |
273,768 | int () { return Objects.hash(super.hashCode(), mySucceed, myFailed, myTotal, mySuccessfullySentFiles, myErrors); } | hashCode |
273,769 | ExternalSystemEventType (@NotNull String event) { for (ExternalSystemEventType type : values()) { if (StatisticsStringUtil.equals(type.name(), event)) { return type; } } return null; } | parse |
273,770 | String () { return myError; } | getError |
273,771 | boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; ExternalUploadFinishedEvent event = (ExternalUploadFinishedEvent)o; return Objects.equals(myError, event.myError); } | equals |
273,772 | int () { return Objects.hash(super.hashCode(), myError); } | hashCode |
273,773 | Handler (@NotNull String logPath) { try { @NonNls FileHandler appender = new FileHandler(logPath, false); appender.setFormatter(new Formatter() { @Override public String format(LogRecord record) { return record.getMessage() + "\n"; } }); appender.setLevel(Level.ALL); return appender; } catch (IOException e) { //noinspection UseOfSystemOutOrSystemErr System.err.println("Error creating log file: " + e.getMessage()); return new ConsoleHandler(); } } | newAppender |
273,774 | String (LogRecord record) { return record.getMessage() + "\n"; } | format |
273,775 | File (@NotNull String logDirectory, int version) { return new File(logDirectory, "idea_statistics_uploader_events_v" + version + ".log"); } | getEventLogFile |
273,776 | void () { logEvent(new ExternalUploadStartedEvent(System.currentTimeMillis(), null)); } | logSendingLogsStarted |
273,777 | void (@NotNull String error) { logEvent(new ExternalUploadFinishedEvent(System.currentTimeMillis(), error, null)); } | logSendingLogsFinished |
273,778 | void (@NotNull String recorderId, @NotNull String error) { logEvent(new ExternalUploadFinishedEvent(System.currentTimeMillis(), error, recorderId)); } | logSendingLogsFinished |
273,779 | void (@NotNull String recorderId, @NotNull StatisticsResult.ResultCode code) { String error = code == StatisticsResult.ResultCode.SEND ? null : code.name(); logEvent(new ExternalUploadFinishedEvent(System.currentTimeMillis(), error, recorderId)); } | logSendingLogsFinished |
273,780 | void (@NotNull String recorderId, @NotNull List<String> successfullySentFiles, @NotNull List<Integer> errors, int total) { int succeed = successfullySentFiles.size(); int failed = errors.size(); logEvent(new ExternalUploadSendEvent(System.currentTimeMillis(), succeed, failed, total, successfullySentFiles, errors, recorderId)); } | logSendingLogsSucceed |
273,781 | void (@NotNull String recorderId, @NotNull String eventId, @NotNull Throwable exception) { logEvent(new ExternalSystemErrorEvent(System.currentTimeMillis(), eventId, exception, recorderId)); } | logErrorEvent |
273,782 | void (@NotNull ExternalSystemEvent event) { myLogger.info(ExternalSystemEventSerializer.serialize(event)); } | logEvent |
273,783 | String () { return myEvent; } | getEvent |
273,784 | String () { return myErrorClass; } | getErrorClass |
273,785 | boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; ExternalSystemErrorEvent event = (ExternalSystemErrorEvent)o; return Objects.equals(myEvent, event.myEvent) && Objects.equals(myErrorClass, event.myErrorClass); } | equals |
273,786 | int () { return Objects.hash(super.hashCode(), myEvent, myErrorClass); } | hashCode |
273,787 | long () { return myTimestamp; } | getTimestamp |
273,788 | ExternalSystemEventType () { return myEventType; } | getEventType |
273,789 | String () { return myRecorderId; } | getRecorderId |
273,790 | boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ExternalSystemEvent event = (ExternalSystemEvent)o; return myTimestamp == event.myTimestamp && myEventType == event.myEventType; } | equals |
273,791 | int () { return Objects.hash(myTimestamp, myEventType); } | hashCode |
273,792 | String (@NotNull ExternalSystemEvent event) { String prefix = event.getTimestamp() + " " + event.getEventType().name() + " " + event.getRecorderId(); if (event instanceof ExternalUploadFinishedEvent failed) { if (isNotEmpty(failed.getError())) { return prefix + " " + escape(failed.getError()); } return prefix; } else if (event instanceof ExternalUploadSendEvent finished) { String hashedFiles = filesToString(finished.getSuccessfullySentFiles()); String errors = errorsToString(finished.getErrors()); return prefix + " " + finished.getSucceed() + " " + finished.getFailed() + " " + finished.getTotal() + " " + hashedFiles + " " + errors; } else if (event instanceof ExternalSystemErrorEvent error) { return prefix + " " + escape(error.getEvent()) + " " + escape(error.getErrorClass()); } return prefix; } | serialize |
273,793 | ExternalSystemEvent (@NotNull String line, int version) { int payloadStartIndex = version == 0 ? 2 : 3; String[] parts = line.split(" "); int length = parts.length; if (length < payloadStartIndex) { return null; } ExternalSystemEventType type = ExternalSystemEventType.parse(parts[1]); if (type == null) { return null; } long timestamp = parseLong(parts[0]); String recorderId = version == 0 ? "FUS" : parts[2]; if (type == ExternalSystemEventType.FINISHED) { String error = length > payloadStartIndex ? parts[payloadStartIndex].trim() : null; return new ExternalUploadFinishedEvent(timestamp, error, recorderId); } else if (type == ExternalSystemEventType.SEND && length > payloadStartIndex + 2) { int succeed = parseInt(parts[payloadStartIndex]); int failed = parseInt(parts[payloadStartIndex + 1]); int total = parseInt(parts[payloadStartIndex + 2]); List<String> sentFiles = length > payloadStartIndex + 3 ? parseSentFiles(parts[payloadStartIndex + 3]) : Collections.emptyList(); List<Integer> errors = length > payloadStartIndex + 4 ? parseErrors(parts[payloadStartIndex + 4]) : Collections.emptyList(); return new ExternalUploadSendEvent(timestamp, succeed, failed, total, sentFiles, errors, recorderId); } else if (type == ExternalSystemEventType.STARTED && length == payloadStartIndex) { return new ExternalUploadStartedEvent(timestamp, recorderId); } else if (type == ExternalSystemEventType.ERROR && length == payloadStartIndex + 2) { String event = parts[payloadStartIndex].trim(); String errorClass = parts[payloadStartIndex + 1].trim(); return new ExternalSystemErrorEvent(timestamp, event, errorClass, recorderId); } return null; } | deserialize |
273,794 | List<String> (@NotNull String part) { return parseValues(part, value -> new String(Base64.getDecoder().decode(value), StandardCharsets.UTF_8)); } | parseSentFiles |
273,795 | List<Integer> (@NotNull String part) { return parseValues(part, value -> parseInt(value)); } | parseErrors |
273,796 | String (@NotNull List<String> files) { return valuesToString(files, path -> Base64.getEncoder().encodeToString(path.getBytes(StandardCharsets.UTF_8))); } | filesToString |
273,797 | String (@NotNull List<Integer> errors) { return valuesToString(errors, error -> String.valueOf(error)); } | errorsToString |
273,798 | int (String value) { try { return Integer.parseInt(value); } catch (NumberFormatException e) { return -1; } } | parseInt |
273,799 | long (String value) { try { return Long.parseLong(value); } catch (NumberFormatException e) { return -1; } } | parseLong |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.