Skip to content

Commit b08e78c

Browse files
Siedlerchrkoppor
andauthored
Fix missing module error for CSL (#10689)
* Add more debug output * add commons lang 3 --------- Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
1 parent 32fbf08 commit b08e78c

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@ jlink {
592592
requires 'com.google.gson'
593593
requires 'org.slf4j'
594594
requires 'jakarta.xml.bind'
595+
requires 'org.apache.commons.lang3'
595596
uses 'org.mariadb.jdbc.credential.CredentialPlugin'
596597
uses 'org.mariadb.jdbc.authentication.AuthenticationPlugin'
597598
uses 'org.mariadb.jdbc.tls.TlsSocketPlugin'

src/main/java/org/jabref/gui/preview/PreviewViewer.java

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package org.jabref.gui.preview;
22

33
import java.io.IOException;
4+
import java.io.PrintWriter;
5+
import java.io.StringWriter;
46
import java.net.MalformedURLException;
57
import java.util.Objects;
68
import java.util.Optional;
@@ -257,13 +259,22 @@ private void update() {
257259

258260
Number.serialExportNumber = 1; // Set entry number in case that is included in the preview layout.
259261

262+
final BibEntry theEntry = entry.get();
260263
BackgroundTask
261-
.wrap(() -> layout.generatePreview(entry.get(), database))
264+
.wrap(() -> layout.generatePreview(theEntry, database))
262265
.onRunning(() -> setPreviewText("<i>" + Localization.lang("Processing %0", Localization.lang("Citation Style")) + ": " + layout.getDisplayName() + " ..." + "</i>"))
263266
.onSuccess(this::setPreviewText)
264267
.onFailure(exception -> {
265268
LOGGER.error("Error while generating citation style", exception);
266-
setPreviewText(Localization.lang("Error while generating citation style"));
269+
270+
// Convert stack trace to a string
271+
StringWriter stringWriter = new StringWriter();
272+
PrintWriter printWriter = new PrintWriter(stringWriter);
273+
exception.printStackTrace(printWriter);
274+
String stackTraceString = stringWriter.toString();
275+
276+
// Set the preview text with the localized error message and the stack trace
277+
setPreviewText(Localization.lang("Error while generating citation style") + "\n\n" + exception.getLocalizedMessage() + "\n\nBibTeX (internal):\n" + theEntry + "\n\nStack Trace:\n" + stackTraceString);
267278
})
268279
.executeWith(taskExecutor);
269280
}

0 commit comments

Comments
 (0)