Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/intellij14' into intellij14.1
Browse files Browse the repository at this point in the history
# Conflicts:
#	gradle.properties
  • Loading branch information
uwolfer committed Jul 26, 2016
2 parents 1572c15 + 2ce9082 commit d1bd46a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ideaVersion=IC-14.1.6
ijPluginRepoChannel=
downloadIdeaSources=false
version=0.9.8.2-141
version=0.9.9.0-141
javaVersion=1.6
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@

package com.urswolfer.intellij.plugin.gerrit.errorreport;

import com.google.common.base.Strings;
import com.google.common.base.Throwables;
import com.google.gson.Gson;
import com.intellij.openapi.application.ex.ApplicationInfoEx;
import com.intellij.openapi.diagnostic.ErrorReportSubmitter;
import com.intellij.openapi.diagnostic.IdeaLoggingEvent;
import com.intellij.openapi.diagnostic.SubmittedReportInfo;
import com.intellij.openapi.ui.Messages;
import com.intellij.util.Consumer;
import com.urswolfer.intellij.plugin.gerrit.Version;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
Expand All @@ -47,6 +50,17 @@ public String getReportActionText() {

@Override
public boolean submit(IdeaLoggingEvent[] events, String additionalInfo, Component parentComponent, Consumer<SubmittedReportInfo> consumer) {
if (Strings.isNullOrEmpty(additionalInfo) || !additionalInfo.contains("@")) {
String emailAddress = Messages.showInputDialog(
"It seems you have not included your email address.\n" +
"If you enter it below, you will get most probably a message " +
"with a solution for your issue or a question which " +
"will help to solve it.", "Information Required", null);
if (!Strings.isNullOrEmpty(emailAddress)) {
additionalInfo = additionalInfo == null
? emailAddress : additionalInfo + '\n' + emailAddress;
}
}
ErrorBean errorBean = createErrorBean(events[0], additionalInfo);
String json = new Gson().toJson(errorBean);
postError(json);
Expand All @@ -73,7 +87,15 @@ private void postError(String json) {
HttpPost httpPost = new HttpPost(ERROR_REPORT_URL);
httpPost.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
try {
httpClient.execute(httpPost);
CloseableHttpResponse response = httpClient.execute(httpPost);
try {
if (response.getStatusLine().getStatusCode() == 406) {
String reasonPhrase = response.getStatusLine().getReasonPhrase();
Messages.showErrorDialog(reasonPhrase, "Gerrit Plugin Message");
}
} finally {
response.close();
}
} catch (IOException e) {
throw Throwables.propagate(e);
}
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@
href="https://github.com/uwolfer/gerrit-intellij-plugin#pre-releases">
https://github.com/uwolfer/gerrit-intellij-plugin#pre-releases</a>.</li>
<li>0.9.9.0</li>
<ul>
<li>fix automatic update for IntelliJ 2016.2 (by bumping version number)</li>
<li>improvements in error reporting flow</li>
</ul>
<li>0.9.8.2</li>
<ul>
<li>fix displaying most significant label in change list</li>
Expand Down

0 comments on commit d1bd46a

Please sign in to comment.