mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
new statistics 2018.1: added more "throw new" exceptions
This commit is contained in:
+1
-1
@@ -36,7 +36,7 @@ public abstract class ConfigurableStatisticsService<T extends StatisticsConnecti
|
||||
return new StatisticsNotification(groupDisplayId, listener);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
// result: the content was sent.
|
||||
protected abstract String sendData();
|
||||
|
||||
|
||||
+16
-4
@@ -20,6 +20,7 @@ import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
public class FUStatisticsService extends ConfigurableStatisticsService<FUStatisticsSettingsService> {
|
||||
private static final Logger LOG = Logger.getInstance("com.intellij.internal.statistic.service.whiteList.FUStatisticsService");
|
||||
@@ -28,16 +29,27 @@ public class FUStatisticsService extends ConfigurableStatisticsService<FUStatist
|
||||
private static final FUStatisticsAggregator myAggregator = FUStatisticsAggregator.create();
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String sendData() {
|
||||
String serviceUrl = mySettingsService.getServiceUrl();
|
||||
if (serviceUrl == null) return null;
|
||||
if (serviceUrl == null) {
|
||||
throw new StatServiceException("Unknown Statistics Server URL");
|
||||
}
|
||||
|
||||
FSContent allDataFromCollectors = myAggregator.getUsageCollectorsData(mySettingsService.getApprovedGroups());
|
||||
if (allDataFromCollectors == null) return null;
|
||||
Set<String> approvedGroups = mySettingsService.getApprovedGroups();
|
||||
if (approvedGroups.isEmpty()) {
|
||||
throw new StatServiceException("There are no approved collectors or Statistics White List Service is unavailable.");
|
||||
}
|
||||
FSContent allDataFromCollectors = myAggregator.getUsageCollectorsData(approvedGroups);
|
||||
if (allDataFromCollectors == null) {
|
||||
throw new StatServiceException("There are no data from collectors to send");
|
||||
}
|
||||
|
||||
try {
|
||||
String dataToSend = FUStatisticsStateService.create().getMergedDataToSend(allDataFromCollectors.asJsonString());
|
||||
if (dataToSend == null) return null;
|
||||
if (dataToSend == null) {
|
||||
throw new StatServiceException("There are no data from collectors to send");
|
||||
}
|
||||
|
||||
HttpResponse response = postStatistics(serviceUrl, dataToSend);
|
||||
|
||||
|
||||
+1
@@ -36,6 +36,7 @@ public class OldConfigurableStatisticsService extends
|
||||
private static final Logger LOG = Logger.getInstance(OldConfigurableStatisticsService.class);
|
||||
private final StatisticsConnectionService connectionService = new OldStatisticsConnectionService();
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String sendData() {
|
||||
String url = connectionService.getServiceUrl();
|
||||
|
||||
Reference in New Issue
Block a user