mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
AstLoadingFilter: don't report same traces multiple times
This commit is contained in:
@@ -8,6 +8,7 @@ import com.intellij.openapi.util.ThrowableComputable;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -64,6 +65,7 @@ import java.util.function.Supplier;
|
||||
public class AstLoadingFilter {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(AstLoadingFilter.class);
|
||||
private static final Set<String> ourReportedTraces = ContainerUtil.newConcurrentSet();
|
||||
/**
|
||||
* Holds not-null value if loading was disabled in current thread.
|
||||
* Initial value is {@code null} meaning loading is enabled by default.
|
||||
@@ -85,7 +87,10 @@ public class AstLoadingFilter {
|
||||
// loading was disabled but then re-enabled for file
|
||||
}
|
||||
else {
|
||||
LOG.error("Tree access disabled", new AstLoadingException(), new Attachment("debugInfo", buildDebugInfo(file, disabledInfo)));
|
||||
AstLoadingException throwable = new AstLoadingException();
|
||||
if (ourReportedTraces.add(ExceptionUtil.getThrowableText(throwable))) {
|
||||
LOG.error("Tree access disabled", throwable, new Attachment("debugInfo", buildDebugInfo(file, disabledInfo)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user