mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
error reporting: don't send attachments which are excluded from the error report by user
This commit is contained in:
@@ -18,6 +18,7 @@ package com.intellij.diagnostic;
|
||||
import com.intellij.notification.Notification;
|
||||
import com.intellij.openapi.diagnostic.Attachment;
|
||||
import com.intellij.openapi.diagnostic.SubmittedReportInfo;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Calendar;
|
||||
@@ -102,9 +103,23 @@ public abstract class AbstractMessage {
|
||||
public void setAssigneeId(Integer assigneeId) {
|
||||
myAssigneeId = assigneeId;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<Attachment> getAttachments() {
|
||||
|
||||
public List<Attachment> getAllAttachments() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list of attachments which are marked by user to be included into the error report
|
||||
*/
|
||||
public List<Attachment> getIncludedAttachments() {
|
||||
return ContainerUtil.filter(getAllAttachments(), Attachment::isIncluded);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #getIncludedAttachments()} instead
|
||||
*/
|
||||
@NotNull
|
||||
public List<Attachment> getAttachments() {
|
||||
return getIncludedAttachments();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,11 +69,11 @@ public class GroupedLogMessage extends AbstractMessage {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<Attachment> getAttachments() {
|
||||
public List<Attachment> getAllAttachments() {
|
||||
return ContainerUtil.concat(getMessages(), new Function<AbstractMessage, Collection<? extends Attachment>>() {
|
||||
@Override
|
||||
public Collection<? extends Attachment> fun(AbstractMessage message) {
|
||||
return message.getAttachments();
|
||||
return message.getAllAttachments();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public class ITNReporter extends ErrorReportSubmitter {
|
||||
Object data = event.getData();
|
||||
if (data instanceof AbstractMessage) {
|
||||
errorBean.setAssigneeId(((AbstractMessage)data).getAssigneeId());
|
||||
errorBean.setAttachments(((AbstractMessage)data).getAttachments());
|
||||
errorBean.setAttachments(((AbstractMessage)data).getIncludedAttachments());
|
||||
}
|
||||
|
||||
String login = settings.ITN_LOGIN;
|
||||
|
||||
@@ -45,7 +45,6 @@ import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
@@ -433,11 +432,7 @@ public class IdeErrorsDialog extends DialogWrapper implements MessagePoolListene
|
||||
|
||||
private void updateAttachmentWarning(final AbstractMessage message) {
|
||||
if (message == null) return;
|
||||
final List<Attachment> includedAttachments = ContainerUtil.filter(message.getAttachments(), new Condition<Attachment>() {
|
||||
public boolean value(final Attachment attachment) {
|
||||
return attachment.isIncluded();
|
||||
}
|
||||
});
|
||||
final List<Attachment> includedAttachments = message.getIncludedAttachments();
|
||||
if (!includedAttachments.isEmpty()) {
|
||||
myAttachmentWarningPanel.setVisible(true);
|
||||
if (includedAttachments.size() == 1) {
|
||||
@@ -613,7 +608,7 @@ public class IdeErrorsDialog extends DialogWrapper implements MessagePoolListene
|
||||
boolean hasAttachment = false;
|
||||
for (ArrayList<AbstractMessage> merged : myMergedMessages) {
|
||||
final AbstractMessage message = merged.get(0);
|
||||
if (!message.getAttachments().isEmpty()) {
|
||||
if (!message.getAllAttachments().isEmpty()) {
|
||||
hasAttachment = true;
|
||||
break;
|
||||
}
|
||||
@@ -657,7 +652,7 @@ public class IdeErrorsDialog extends DialogWrapper implements MessagePoolListene
|
||||
|
||||
myDetailsTabForm.setAssigneeId(message == null ? null : message.getAssigneeId());
|
||||
|
||||
List<Attachment> attachments = message != null ? message.getAttachments() : Collections.<Attachment>emptyList();
|
||||
List<Attachment> attachments = message != null ? message.getAllAttachments() : Collections.<Attachment>emptyList();
|
||||
if (!attachments.isEmpty()) {
|
||||
if (myTabs.indexOfComponent(myAttachmentsTabForm.getContentPane()) == -1) {
|
||||
myTabs.addTab(DiagnosticBundle.message("error.attachments.tab.title"), myAttachmentsTabForm.getContentPane());
|
||||
|
||||
@@ -78,7 +78,7 @@ public class LogMessageEx extends LogMessage {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<Attachment> getAttachments() {
|
||||
public List<Attachment> getAllAttachments() {
|
||||
return myAttachments != null ? myAttachments : Collections.<Attachment>emptyList();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user