EA-104729 - IAE: ErrorDiffRequest.<init>

This commit is contained in:
Aleksey Pivovarov
2017-07-17 12:42:23 +03:00
parent cd23749a3a
commit 6f996ef063

View File

@@ -16,6 +16,7 @@
package com.intellij.diff.requests;
import com.intellij.diff.chains.DiffRequestProducer;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -32,15 +33,15 @@ public class ErrorDiffRequest extends MessageDiffRequest {
}
public ErrorDiffRequest(@Nullable String title, @NotNull Throwable e) {
this(title, e.getMessage(), null, e);
this(title, getErrorMessage(e), null, e);
}
public ErrorDiffRequest(@NotNull Throwable e) {
this(null, e.getMessage(), null, e);
this(null, getErrorMessage(e), null, e);
}
public ErrorDiffRequest(@Nullable DiffRequestProducer producer, @NotNull Throwable e) {
this(producer != null ? producer.getName() : null, e.getMessage(), producer, e);
this(producer != null ? producer.getName() : null, getErrorMessage(e), producer, e);
}
public ErrorDiffRequest(@Nullable DiffRequestProducer producer, @NotNull String message) {
@@ -65,4 +66,10 @@ public class ErrorDiffRequest extends MessageDiffRequest {
public Throwable getException() {
return myException;
}
@NotNull
private static String getErrorMessage(@NotNull Throwable e) {
String message = e.getMessage();
return StringUtil.isEmptyOrSpaces(message) ? "Error: can't show diff" : message;
}
}