Blank input editor - Uncaught exception occured in Thread[JavaFX Application Thread,5,main]
<!-- 
Note: Please use the GitHub issue tracker only for bug reports. 
Feature requests, questions and general feedback is now handled at http://discourse.jabref.org.
Thanks! 
--> 
Ubuntu 18.04 with Gnome desktop:
Installed from .deb file downloaded from https://builds.jabref.org/master/jabref_5.0.0-1_amd64.deb
JabRef version:
JabRef 5.0.0-dev--2019-10-21----0f0dce621
Linux 5.0.0-32-generic amd64 
Java 12.0.2

Steps to reproduce the behavior:


1. Open JabRef with .bib file
2. Exception is thrown
3. Entry editor is blank (Just a white field. I'm in dark mode)
4. Exception is thrown with statement: 
  ```Uncaught exception occured in Thread[JavaFX Application Thread,5,main]``` and 
  ```Invalid stylesheet URL```
5.  Clicking other tabs such as: Optional Fields, Deprecated Fields etc. results in additional exceptions thrown with the ```invalid stylesheet URL``` error.
Here's the Log summary:
<details>
  <summary>Log File</summary>
  
  ```
  java.lang.IllegalArgumentException: Invalid stylesheet URL
	at org.jabref.merged.module/javafx.scene.web.WebEngine$2.invalidated(Unknown Source)
	at org.jabref.merged.module/javafx.beans.property.StringPropertyBase.markInvalid(Unknown Source)
	at org.jabref.merged.module/javafx.beans.property.StringPropertyBase.set(Unknown Source)
	at org.jabref.merged.module/javafx.beans.property.StringPropertyBase.set(Unknown Source)
	at org.jabref.merged.module/javafx.scene.web.WebEngine.setUserStyleSheetLocation(Unknown Source)
	at org.jabref/org.jabref.gui.preview.PreviewViewer.setTheme(Unknown Source)
	at org.jabref/org.jabref.gui.preview.PreviewPanel.<init>(Unknown Source)
	at org.jabref/org.jabref.gui.entryeditor.FieldsEditorTab.initPanel(Unknown Source)
	at org.jabref/org.jabref.gui.entryeditor.FieldsEditorTab.bindToEntry(Unknown Source)
	at org.jabref/org.jabref.gui.entryeditor.EntryEditorTab.notifyAboutFocus(Unknown Source)
	at org.jabref/org.jabref.gui.entryeditor.EntryEditor.lambda$new$0(Unknown Source)
	at org.jabref.merged.module/org.fxmisc.easybind.EasyBind.lambda$subscribe$12(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/javafx.beans.property.ReadOnlyObjectPropertyBase.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/javafx.beans.property.ObjectPropertyBase.markInvalid(Unknown Source)
	at org.jabref.merged.module/javafx.beans.property.ObjectPropertyBase.set(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.SelectionModel.setSelectedItem(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.TabPane$TabPaneSelectionModel.select(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.TabPane$TabPaneSelectionModel.select(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.TabPane$TabPaneSelectionModel.findNearestAvailableTab(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.TabPane$TabPaneSelectionModel.lambda$new$0(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ObservableListBase.fireChange(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ListChangeBuilder.commit(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ListChangeBuilder.endChange(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ObservableListBase.endChange(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ModifiableObservableListBase.add(Unknown Source)
	at org.jabref/org.jabref.gui.entryeditor.EntryEditor.recalculateVisibleTabs(Unknown Source)
	at org.jabref/org.jabref.gui.entryeditor.EntryEditor.setEntry(Unknown Source)
	at org.jabref/org.jabref.gui.BasePanel.lambda$createMainTable$22(Unknown Source)
	at java.base/java.util.Optional.ifPresent(Unknown Source)
	at org.jabref/org.jabref.gui.BasePanel.lambda$createMainTable$23(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ObservableListBase.fireChange(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ListChangeBuilder.commit(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ListChangeBuilder.endChange(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ObservableListBase.endChange(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.scene.control.SelectedItemsReadOnlyObservableList.lambda$new$1(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ObservableListBase.fireChange(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ListChangeBuilder.commit(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ListChangeBuilder.endChange(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ObservableListBase.endChange(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList._endChange(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.MultipleSelectionModelBase$SelectedIndicesList._endChange(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.ControlUtils.updateSelectedIndices(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.TableView$TableViewArrayListSelectionModel.fireCustomSelectedCellsListChangeEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ObservableListBase.fireChange(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ListChangeBuilder.commit(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ListChangeBuilder.endChange(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ObservableListBase.endChange(Unknown Source)
	at org.jabref.merged.module/javafx.collections.transformation.SortedList.sourceChanged(Unknown Source)
	at org.jabref.merged.module/javafx.collections.transformation.TransformationList.lambda$getListener$0(Unknown Source)
	at org.jabref.merged.module/javafx.collections.WeakListChangeListener.onChanged(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ObservableListBase.fireChange(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ListChangeBuilder.commit(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ListChangeBuilder.endChange(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ObservableListBase.endChange(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ModifiableObservableListBase.add(Unknown Source)
	at java.base/java.util.AbstractList.add(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.scene.control.SelectedCellsMap.add(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.TableView$TableViewArrayListSelectionModel.select(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.TableView$TableViewArrayListSelectionModel.select(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.TableView$TableViewArrayListSelectionModel.selectFirst(Unknown Source)
	at org.jabref/org.jabref.gui.maintable.MainTable.clearAndSelectFirst(Unknown Source)
	at org.jabref/org.jabref.gui.BasePanel.clearAndSelectFirst(Unknown Source)
	at org.jabref/org.jabref.gui.BasePanel.lambda$new$0(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source)
	at org.jabref.merged.module/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
	at org.jabref.merged.module/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at org.jabref.merged.module/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

  ```
</details>

diff --git a/src/main/java/org/jabref/gui/preview/PreviewViewer.java b/src/main/java/org/jabref/gui/preview/PreviewViewer.java
index 4e1201b92d..937a16b987 100644
--- a/src/main/java/org/jabref/gui/preview/PreviewViewer.java
+++ b/src/main/java/org/jabref/gui/preview/PreviewViewer.java
@@ -1,5 +1,7 @@
 package org.jabref.gui.preview;
 
+import java.net.URL;
+import java.util.Base64;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.regex.Pattern;
@@ -27,6 +29,7 @@ import org.jabref.logic.l10n.Localization;
 import org.jabref.logic.search.SearchQuery;
 import org.jabref.model.database.BibDatabaseContext;
 import org.jabref.model.entry.BibEntry;
+import org.jabref.model.strings.StringUtil;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -116,9 +119,14 @@ public class PreviewViewer extends ScrollPane implements InvalidationListener {
 
     public void setTheme(String theme) {
         if (theme.equals(ThemeLoader.DARK_CSS)) {
-            previewView.getEngine().setUserStyleSheetLocation(JabRefFrame.class.getResource(ThemeLoader.DARK_CSS).toString());
+            // We need to load the css file manually, due to a bug in the jdk
+            // TODO: Remove this workaround as soon as https://github.com/openjdk/jfx/pull/22 is merged
+            URL url = JabRefFrame.class.getResource(ThemeLoader.DARK_CSS);
+            String dataUrl = "data:text/css;charset=utf-8;base64," +
+                    Base64.getEncoder().encodeToString(StringUtil.getResourceFileAsString(url).getBytes());
+
+            previewView.getEngine().setUserStyleSheetLocation(dataUrl);
         }
-    
     }
 
     private void highlightSearchPattern() {
diff --git a/src/main/java/org/jabref/model/strings/StringUtil.java b/src/main/java/org/jabref/model/strings/StringUtil.java
index af38b5f012..0551821493 100644
--- a/src/main/java/org/jabref/model/strings/StringUtil.java
+++ b/src/main/java/org/jabref/model/strings/StringUtil.java
@@ -1,5 +1,12 @@
 package org.jabref.model.strings;
 
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.net.URLConnection;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -9,6 +16,7 @@ import java.util.Optional;
 import java.util.StringTokenizer;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import java.util.stream.Collectors;
 
 import org.jabref.architecture.ApacheCommonsLang3Allowed;
 
@@ -721,4 +729,19 @@ public class StringUtil {
     public static String substringBetween(String str, String open, String close) {
         return StringUtils.substringBetween(str, open, close);
     }
+
+    public static String getResourceFileAsString(URL resource) {
+        try {
+            URLConnection conn = resource.openConnection();
+            conn.connect();
+
+            try (InputStream inputStream = new BufferedInputStream(conn.getInputStream());
+                 InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
+                 BufferedReader reader = new BufferedReader(inputStreamReader)) {
+                return reader.lines().collect(Collectors.joining(System.lineSeparator()));
+            }
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
 }
diff --git a/src/test/java/org/jabref/model/strings/StringUtilTest.java b/src/test/java/org/jabref/model/strings/StringUtilTest.java
index 383b97c1cc..5f9569eaa5 100644
--- a/src/test/java/org/jabref/model/strings/StringUtilTest.java
+++ b/src/test/java/org/jabref/model/strings/StringUtilTest.java
@@ -21,7 +21,7 @@ class StringUtilTest {
         Path path = Paths.get("src", "main", "java", StringUtil.class.getName().replace('.', '/') + ".java");
         int lineCount = Files.readAllLines(path, StandardCharsets.UTF_8).size();
 
-        assertTrue(lineCount <= 725, "StringUtil increased in size to " + lineCount + ". "
+        assertTrue(lineCount <= 749, "StringUtil increased in size to " + lineCount + ". "
                 + "We try to keep this class as small as possible. "
                 + "Thus think twice if you add something to StringUtil.");
     }
['src/main/java/org/jabref/gui/preview/PreviewViewer.java', 'src/test/java/org/jabref/model/strings/StringUtilTest.java', 'src/main/java/org/jabref/model/strings/StringUtil.java']