Merge "Crash reports now include build number and JDK runtime version." into idea14-1.4-dev
automerge: 9977471
* commit '9977471b8cdcf6f161ee55b13f85a16577551ffb':
Crash reports now include build number and JDK runtime version.
diff --git a/platform/bootstrap/src/com/intellij/idea/Main.java b/platform/bootstrap/src/com/intellij/idea/Main.java
index 2d17638..a79a245 100755
--- a/platform/bootstrap/src/com/intellij/idea/Main.java
+++ b/platform/bootstrap/src/com/intellij/idea/Main.java
@@ -19,6 +19,7 @@
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.SystemInfoRt;
+import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.util.ArrayUtilRt;
import com.intellij.util.Restarter;
@@ -218,6 +219,13 @@
File f = new File(PathManager.getTempPath(),
String.format("%s.%s", System.getProperty(PLATFORM_PREFIX_PROPERTY), UUID.randomUUID().toString()));
if (f.createNewFile()) {
+ FileWriter fw = new FileWriter(f);
+ try {
+ fw.write(FileUtil.loadFile(new File(PathManager.getHomePath(), "build.txt")));
+ fw.write(System.getProperty("java.runtime.version"));
+ } finally {
+ fw.close();
+ }
// We use a system property to pass the filename across classloaders.
System.setProperty("studio.record.file", f.getAbsolutePath());
}
diff --git a/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java b/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java
index b06941a..b0ab5f9 100644
--- a/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java
+++ b/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java
@@ -156,16 +156,24 @@
}
private static void reportPreviousCrashes() {
+ final String recordFile = System.getProperty("studio.record.file");
+
File[] previousRecords = new File(PathManager.getTempPath()).listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.getName().startsWith(PlatformUtils.getPlatformPrefix()) &&
- !pathname.getAbsolutePath().equals(System.getProperty("studio.record.file"));
+ !pathname.getAbsolutePath().equals(recordFile);
}
});
if (previousRecords != null) {
for (File record : previousRecords) {
- PlatformUsageTracker.trackException(new StudioCrash(), true);
+ String description = "<unknown>";
+ try {
+ description = FileUtil.loadFile(new File(recordFile));
+ } catch (IOException ex) {
+ // ignored.
+ }
+ PlatformUsageTracker.trackCrash("StudioCrash: " + description);
FileUtil.delete(record);
}
}
@@ -293,6 +301,4 @@
}
}, INITIAL_DELAY_MINUTES, INTERVAL_IN_MINUTES, TimeUnit.MINUTES);
}
-
- private static class StudioCrash extends Throwable {}
}
diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/analytics/PlatformUsageTracker.java b/platform/platform-impl/src/com/intellij/internal/statistic/analytics/PlatformUsageTracker.java
index e8fa61c..a78e86e 100644
--- a/platform/platform-impl/src/com/intellij/internal/statistic/analytics/PlatformUsageTracker.java
+++ b/platform/platform-impl/src/com/intellij/internal/statistic/analytics/PlatformUsageTracker.java
@@ -42,7 +42,6 @@
import java.io.IOException;
import java.util.List;
import java.util.Locale;
-import java.util.Set;
/**
* This class mirrors some function of the Android plugin's UsageTracker class.
@@ -99,6 +98,16 @@
return DEBUG || StatisticsUploadAssistant.isSendAllowed();
}
+ public static void trackCrash(@NotNull String description) {
+ if (!DEBUG && !trackingEnabled()) {
+ return;
+ }
+
+ post(ImmutableList.of(new BasicNameValuePair("t", "exception"),
+ new BasicNameValuePair("exd", description),
+ new BasicNameValuePair("exf", "1")));
+ }
+
public static void trackException(@NotNull Throwable t, boolean fatal) {
if (!DEBUG && !trackingEnabled()) {
return;