Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: NoClassDefFoundError: org/apache/commons/lang/exception/ExceptionUtils in IJ 2023.3 EAP #1194

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -218,7 +219,7 @@ public void run() {
}
ServerTrace newServerTrace = settings.getServerTrace();
if (newServerTrace != null && !newServerTrace.equals(serverTraceComboBox.getSelectedItem())) {
serverTraceComboBox.setSelectedItem(newServerTrace);
serverTraceComboBox.setSelectedItem(newServerTrace);
}
}
};
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -304,4 +305,18 @@ public void dispose() {
private boolean isDisposed() {
return disposed || project.isDisposed();
}

/**
* Code copied from https://github.com/apache/commons-lang/blob/24744a40b2c094945e542b71cc1fbf59caa0d70b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java#L400C5-L407C6
* @param throwable
* @return
*/
private static String getStackTrace(final Throwable throwable) {
if (throwable == null) {
return "";
}
final StringWriter sw = new StringWriter();
throwable.printStackTrace(new PrintWriter(sw, true));
return sw.toString();
}
}
Loading