From 6dc5ec311c98206f0f6dcec170fb601842d9dab5 Mon Sep 17 00:00:00 2001 From: azerr Date: Tue, 3 Oct 2023 16:05:53 +0200 Subject: [PATCH] fix: NoClassDefFoundError: org/apache/commons/lang/exception/ExceptionUtils in IJ 2023.3 EAP Fixes #1191 Signed-off-by: azerr --- .../lsp4ij/console/LSPConsoleToolWindowPanel.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4ij/console/LSPConsoleToolWindowPanel.java b/src/main/java/com/redhat/devtools/intellij/lsp4ij/console/LSPConsoleToolWindowPanel.java index c5690748a..8a9cf2d2c 100644 --- a/src/main/java/com/redhat/devtools/intellij/lsp4ij/console/LSPConsoleToolWindowPanel.java +++ b/src/main/java/com/redhat/devtools/intellij/lsp4ij/console/LSPConsoleToolWindowPanel.java @@ -37,12 +37,13 @@ import com.redhat.devtools.intellij.lsp4ij.console.explorer.LanguageServerTreeNode; import com.redhat.devtools.intellij.lsp4ij.settings.ServerTrace; import com.redhat.devtools.intellij.lsp4ij.settings.UserDefinedLanguageServerSettings; -import org.apache.commons.lang.exception.ExceptionUtils; import org.jetbrains.annotations.NotNull; import javax.swing.*; import javax.swing.tree.DefaultMutableTreeNode; import java.awt.*; +import java.io.PrintWriter; +import java.io.StringWriter; import java.util.HashSet; import java.util.Set; @@ -218,7 +219,7 @@ public void run() { } ServerTrace newServerTrace = settings.getServerTrace(); if (newServerTrace != null && !newServerTrace.equals(serverTraceComboBox.getSelectedItem())) { - serverTraceComboBox.setSelectedItem(newServerTrace); + serverTraceComboBox.setSelectedItem(newServerTrace); } } }; @@ -249,7 +250,7 @@ public void showMessage(String message) { } public void showError(Throwable exception) { - String stacktrace = ExceptionUtils.getStackTrace(exception); + String stacktrace = getStackTrace(exception); consoleView.print(stacktrace, ConsoleViewContentType.ERROR_OUTPUT); } @@ -304,4 +305,11 @@ public void dispose() { private boolean isDisposed() { return disposed || project.isDisposed(); } + + private static String getStackTrace(Throwable throwable) { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw, true); + throwable.printStackTrace(pw); + return sw.getBuffer().toString(); + } }